]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/packagemanager.cc
* apt-pkg/init.cc:
[apt.git] / apt-pkg / packagemanager.cc
index 6601d9f6bad94dbe4ee5a6a4131e3d273bc72949..8b73b9980d39c08f08309def0311e8c2d8c99cd3 100644 (file)
@@ -603,18 +603,39 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
 
    List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
 
-   if (instVer->MultiArch == pkgCache::Version::Same)
+   if (Immediate == true && instVer->MultiArch == pkgCache::Version::Same)
+   {
+      /* Do lockstep M-A:same unpacking in two phases:
+        First unpack all installed architectures, then the not installed.
+        This way we avoid that M-A: enabled packages are installed before
+        their older non-M-A enabled packages are replaced by newer versions */
+      bool const installed = Pkg->CurrentVer != 0;
+      if (installed == true && Install(Pkg,FileNames[Pkg->ID]) == false)
+        return false;
       for (PkgIterator P = Pkg.Group().PackageList();
           P.end() == false; P = Pkg.Group().NextPkg(P))
       {
-        if (Pkg == P || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+        if (P->CurrentVer == 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
             Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
              (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
            continue;
-        SmartUnPack(P, false);
+        if (SmartUnPack(P, false) == false)
+           return false;
       }
-
-   if(Install(Pkg,FileNames[Pkg->ID]) == false)
+      if (installed == false && Install(Pkg,FileNames[Pkg->ID]) == false)
+        return false;
+      for (PkgIterator P = Pkg.Group().PackageList();
+          P.end() == false; P = Pkg.Group().NextPkg(P))
+      {
+        if (P->CurrentVer != 0 || P == Pkg || List->IsFlag(P,pkgOrderList::UnPacked) == true ||
+            Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer &&
+             (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall))
+           continue;
+        if (SmartUnPack(P, false) == false)
+           return false;
+      }
+   }
+   else if (Install(Pkg,FileNames[Pkg->ID]) == false)
       return false;
 
    // Perform immedate configuration of the package.