summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-08-28 10:59:54 +0200
committerMichael Vogt <mvo@debian.org>2013-08-28 10:59:54 +0200
commitf68cba9b720bc44aacf6af468836287d9754afea (patch)
treed2cd3bf53caee0bb5df84c8a14fca5b0e9eef254 /apt-pkg
parent45dc05ff2f51612945232dac469ac1c6926d4019 (diff)
parent7546c8da99ade7b6e1bd6aaa9d026f61400214d1 (diff)
Merge remote-tracking branch 'mvo/feature/install-progress' into debian/sid
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc17
-rw-r--r--apt-pkg/deb/dpkgpm.h2
2 files changed, 18 insertions, 1 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 4b5467eff..3c1013761 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -632,6 +632,9 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
<< ":" << (PackagesDone/float(PackagesTotal)*100.0)
<< ":" << s
<< endl;
+ if(_config->FindB("DPkgPM::Progress", false) == true)
+ SendTerminalProgress(PackagesDone/float(PackagesTotal)*100.0);
+
if(OutStatusFd > 0)
FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
if (Debug == true)
@@ -874,6 +877,18 @@ bool pkgDPkgPM::CloseLog()
return true;
}
/*}}}*/
+// DPkgPM::SendTerminalProgress /*{{{*/
+// ---------------------------------------------------------------------
+/* Send progress info to the terminal
+ */
+void pkgDPkgPM::SendTerminalProgress(float percentage)
+{
+ // FIXME: use colors too
+ std::cout << "\r\n"
+ << "Progress: [" << percentage << "%]"
+ << "\r\n";
+}
+ /*}}}*/
/*{{{*/
// This implements a racy version of pselect for those architectures
// that don't have a working implementation.
@@ -1294,7 +1309,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
}
Child = ExecFork();
-
+
// This is the child
if (Child == 0)
{
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index c31d56f8e..29901a204 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -84,6 +84,8 @@ class pkgDPkgPM : public pkgPackageManager
bool SendPkgsInfo(FILE * const F, unsigned int const &Version);
void WriteHistoryTag(std::string const &tag, std::string value);
+ void SendTerminalProgress(float percentage);
+
// apport integration
void WriteApportReport(const char *pkgpath, const char *errormsg);