]> git.saurik.com Git - apt.git/commitdiff
Merge branch 'debian/sid' into feature/install-progress-refactor
authorMichael Vogt <mvo@debian.org>
Thu, 17 Oct 2013 06:03:41 +0000 (08:03 +0200)
committerMichael Vogt <mvo@debian.org>
Thu, 17 Oct 2013 06:03:41 +0000 (08:03 +0200)
Conflicts:
apt-pkg/deb/dpkgpm.cc

1  2 
apt-pkg/deb/dpkgpm.cc
apt-pkg/deb/dpkgpm.h

index fbb5e4c96d4e5cbdfbcb4297aa3903ef21aa073b,f870fab936f7139c7b04cb726b0090e599aeb3aa..1b234c0ed61da4da88f5ec56f3b428213466f89e
@@@ -558,6 -575,8 +571,14 @@@ void pkgDPkgPM::ProcessDpkgStatusLine(c
     }
     const char* const pkg = pkgname.c_str();
     const char* action = list[2].c_str();
+    
+    std::string short_pkgname = StringSplit(pkgname, ":")[0];
++   std::string i18n_pkgname = short_pkgname;
++   if (pkgname.find(":") != string::npos)
++   {
++      strprintf(i18n_pkgname, "%s (%s)", short_pkgname.c_str(),
++                StringSplit(pkgname, ":")[1].c_str());
++   }
  
     // 'processing' from dpkg looks like
     // 'processing: action: pkg'
     {
        // only read the translation if there is actually a next
        // action
 -      const char *translation = _(states[PackageOpsDone[pkg]].str);
 -      char s[200];
 -      snprintf(s, sizeof(s), translation, short_pkgname.c_str());
 +      std::string translation;
-       strprintf(translation, _(states[PackageOpsDone[pkg]].str), pkg);
++      strprintf(translation, _(states[PackageOpsDone[pkg]].str), 
++                i18n_pkgname.c_str());
  
        // we moved from one dpkg state to a new one, report that
        PackageOpsDone[pkg]++;
        PackagesDone++;
 -      // build the status str
 -      status << "pmstatus:" << short_pkgname
 -           << ":"  << (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)
 -       std::clog << "send: '" << status.str() << "'" << endl;
++
 +      // and send to the progress
-       d->progress->StatusChanged(pkg, PackagesDone, PackagesTotal,
++      d->progress->StatusChanged(pkgname, PackagesDone, PackagesTotal,
 +                                 translation);
     }
     if (Debug == true) 
-       std::clog << "(parsed from dpkg) pkg: " << pkg 
 -      std::clog << "(parsed from dpkg) pkg: " << short_pkgname
++      std::clog << "(parsed from dpkg) pkg: " << pkgname
                << " action: " << action << endl;
  }
                                                                        /*}}}*/
@@@ -1264,12 -1394,20 +1287,14 @@@ bool pkgDPkgPM::Go(APT::Progress::Packa
         _error->DumpErrors(std::cerr);
        _error->RevertToStack();
  
 -       // Fork dpkg
 -      pid_t Child;
 +      // this is the dpkg status-fd, we need to keep it
        _config->Set("APT::Keep-Fds::",fd[1]);
 -      // send status information that we are about to fork dpkg
 -      if(OutStatusFd > 0) {
 -       ostringstream status;
 -       status << "pmstatus:dpkg-exec:" 
 -              << (PackagesDone/float(PackagesTotal)*100.0) 
 -              << ":" << _("Running dpkg")
 -              << endl;
 -       FileFd::Write(OutStatusFd, status.str().c_str(), status.str().size());
 -      }
  
 -      Child = ExecFork();
 +       // Tell the progress that its starting and fork dpkg 
++      // FIXME: this is called once per dpkg run which is *too often*
 +      d->progress->Start();
++
 +      pid_t Child = ExecFork();
        // This is the child
        if (Child == 0)
        {
         if (select_ret < 0 && (errno == EINVAL || errno == ENOSYS))
            select_ret = racy_pselect(max(master, _dpkgin)+1, &rfds, NULL,
                                      NULL, &tv, &original_sigmask);
 +         d->progress->Pulse();
++
         if (select_ret == 0) 
            continue;
         else if (select_ret < 0 && errno == EINTR)
         if(stopOnError) 
         {
            CloseLog();
 -            CleanupTerminal();
++            d->progress->Stop();
            return false;
         }
        }      
     CloseLog();
  
     // dpkg is done at this point
 -   if(_config->FindB("DPkgPM::Progress", false) == true)
 -      SendTerminalProgress(100);
 +   d->progress->StatusChanged("", PackagesDone, PackagesTotal, "");
++   d->progress->Stop();
 -   CleanupTerminal();
  
     if (pkgPackageManager::SigINTStop)
         _error->Warning(_("Operation was interrupted before it could finish"));
Simple merge