]> git.saurik.com Git - apt.git/commitdiff
Only stop on SigInt if the system state is right (still needs more testing).
authorChristopher Baines <cbaines8@gmail.com>
Mon, 1 Aug 2011 11:27:10 +0000 (12:27 +0100)
committerChristopher Baines <cbaines8@gmail.com>
Mon, 1 Aug 2011 11:27:10 +0000 (12:27 +0100)
More inprovements to the package manager to prevent packages from being configured
twice.

apt-pkg/deb/dpkgpm.cc
apt-pkg/packagemanager.cc

index 47912665829d1fe718de8a049a41816a28d4fc8a..68d9ca1de25aed935f07982fcb9bc8ff113aaee0 100644 (file)
@@ -1066,7 +1066,8 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       sighandler_t old_SIGINT = signal(SIGINT,SigINT);
       
       // Check here for any SIGINT
-      if (pkgPackageManager::SigINTStop) break;
+      if (pkgPackageManager::SigINTStop && 
+         (I->Op == Item::Install || I->Op == Item::Remove || I->Op == Item::Purge)) break;
 
       // ignore SIGHUP as well (debian #463030)
       sighandler_t old_SIGHUP = signal(SIGHUP,SIG_IGN);
@@ -1315,7 +1316,6 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 }
 
 void SigINT(int sig) {
-   cout << " -- SIGINT -- " << endl;
    if (_config->FindB("APT::Immediate-Configure-All",false)) 
       pkgPackageManager::SigINTStop = true;
 } 
index 8bcf3d884f2a92b88dea78c00bce4fb1276cdca4..324b7ffba46c761f9e8409186804349aa367ce64 100644 (file)
@@ -286,6 +286,10 @@ bool pkgPackageManager::ConfigureAll()
    for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
    {
       PkgIterator Pkg(Cache,*I);
+      
+      /* Check if the package has been configured, this can happen if SmartConfigure
+         calls its self */ 
+      if (List->IsFlag(Pkg,pkgOrderList::Configured)) continue;
 
       if (ConfigurePkgs == true && SmartConfigure(Pkg) == false) {
          _error->Error("Internal error, packages left unconfigured. %s",Pkg.Name());
@@ -415,6 +419,9 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
    static std::string const conf = _config->Find("PackageManager::Configure","all");
    static bool const ConfigurePkgs = (conf == "all" || conf == "smart");
 
+   if (List->IsFlag(Pkg,pkgOrderList::Configured)) 
+      return _error->Error("Internal configure error on '%s'. ",Pkg.Name(),1);
+
    if (ConfigurePkgs == true && Configure(Pkg) == false)
       return false;
       
@@ -577,6 +584,11 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
            if (Cache[Pkg].InstallVer != *I || 
                (Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing))
               continue;
+              
+           if (List->IsFlag(Pkg,pkgOrderList::Configured)) {
+              Bad = false;
+              continue;
+           }
 
            if (Debug)
               clog << "Trying to SmartConfigure " << Pkg.Name() << endl;