]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
Merge remote-tracking branch 'mvo/feature/install-progress' into debian/sid
[apt.git] / apt-pkg / deb / dpkgpm.cc
index 4b5467eff14a6a138708ebf61cc00e67bb108666..3c101376192f6c5ed2a0cd59562ddf08bebe3e04 100644 (file)
@@ -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)
       {