]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/dpkgpm.cc
The modification to orderlist.cc is from a patch DonKult (David) gave me, The modific...
[apt.git] / apt-pkg / deb / dpkgpm.cc
index 7b0955b96bd8390849df74f5474116d4b5fa81d3..b37980b7ecbbdae96d210bb6ffca6a700c94d23b 100644 (file)
@@ -308,6 +308,15 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
         SetCloseExec(STDIN_FILENO,false);      
         SetCloseExec(STDERR_FILENO,false);
 
+        if (_config->FindDir("DPkg::Chroot-Directory","/") != "/") 
+        {
+           std::cerr << "Chrooting into " 
+                     << _config->FindDir("DPkg::Chroot-Directory") 
+                     << std::endl;
+           if (chroot(_config->FindDir("DPkg::Chroot-Directory","/").c_str()) != 0)
+              _exit(100);
+        }
+
         const char *Args[4];
         Args[0] = "/bin/sh";
         Args[1] = "-c";
@@ -382,8 +391,9 @@ void pkgDPkgPM::DoTerminalPty(int master)
    {
       // this happens when the child is about to exit, we
       // give it time to actually exit, otherwise we run
-      // into a race
-      usleep(500000);
+      // into a race so we sleep for half a second.
+      struct timespec sleepfor = { 0, 500000000 };
+      nanosleep(&sleepfor, NULL);
       return;
    }  
    if(len <= 0) 
@@ -993,6 +1003,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
       else
       {
         string const nativeArch = _config->Find("APT::Architecture");
+        unsigned long const oldSize = I->Op == Item::Configure ? Size : 0;
         for (;I != J && Size < MaxArgBytes; I++)
         {
            if((*I).Pkg.end() == true)
@@ -1007,8 +1018,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
               Args[n++] = Packages[pkgcount++];
            }
            Size += strlen(Args[n-1]);
-        }       
-      }      
+        }
+        // skip configure action if all sheduled packages disappeared
+        if (oldSize == Size)
+           continue;
+      }
       Args[n] = 0;
       J = I;