]> git.saurik.com Git - apt.git/commitdiff
Merge branch 'debian/sid' of ssh://git.debian.org/git/apt/apt into debian/sid
authorMichael Vogt <mvo@debian.org>
Sun, 1 Sep 2013 16:33:26 +0000 (18:33 +0200)
committerMichael Vogt <mvo@debian.org>
Sun, 1 Sep 2013 16:33:26 +0000 (18:33 +0200)
apt-pkg/contrib/fileutl.cc
apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.h

index 4806ae3f9bc29248dff48b3a000f37bd6a843435..3966eb0edd41f1e175469e5f1108638020292736 100644 (file)
@@ -977,7 +977,7 @@ bool FileFd::Open(string FileName,unsigned int const Mode,APT::Configuration::Co
       if((iFd = mkstemp(name)) == -1)
       {
           free(name);
-          return FileFdErrno("mkostemp", "Could not create temporary file for %s", FileName.c_str());
+          return FileFdErrno("mkstemp", "Could not create temporary file for %s", FileName.c_str());
       }
 
       TemporaryFileName = string(name);
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)
       {
index c31d56f8ea995c4563ecb090df5bc75bc86015d7..29901a20446edbf888ea5b8be79db93097f2e593 100644 (file)
@@ -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);