Explorar o código

M-A:same lockstep unpack should operate on installed
packages first (LP: #835625)

David Kalnischkies %!s(int64=15) %!d(string=hai) anos
pai
achega
30426f4822

+ 26 - 5
apt-pkg/packagemanager.cc

@@ -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.

+ 3 - 1
debian/changelog

@@ -5,6 +5,8 @@ apt (0.8.15.7) UNRELEASED; urgency=low
     - ignore "self"-conflicts for all architectures of a package
       instead of just for the architecture of the package locked at
       in the ordering of installations too (Closes: #802901)
+    - M-A:same lockstep unpack should operate on installed
+      packages first (LP: #835625)
   * test/*
     - reorganize the various testcases and helper we have and
       integrate them better into the buildsystem
@@ -36,7 +38,7 @@ apt (0.8.15.7) UNRELEASED; urgency=low
     - reword Acquire::Max-ValidTime documentation to make clear
       that it doesn't provide the new Min-ValidTime functionality
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 05 Sep 2011 15:53:12 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 09 Sep 2011 12:34:04 +0200
 
 apt (0.8.15.6) unstable; urgency=low
 

+ 2 - 2
test/integration/test-bug-618288-multiarch-same-lockstep

@@ -22,8 +22,8 @@ Building dependency tree...
 The following packages will be upgraded:
   apt:i386 apt2 libsame libsame:i386
 4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
-Inst libsame [1] (2 unstable [amd64]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:i386 apt2:amd64 ]
-Inst libsame:i386 [1] (2 unstable [i386]) [apt2:amd64 apt:i386 ]
+Inst libsame:i386 [1] (2 unstable [i386]) [libsame:amd64 on libsame:i386] [libsame:i386 on libsame:amd64] [libsame:amd64 apt:i386 ]
+Inst libsame [1] (2 unstable [amd64]) [apt2:amd64 apt:i386 ]
 Conf libsame:i386 (2 unstable [i386]) [apt2:amd64 apt:i386 ]
 Conf libsame (2 unstable [amd64]) [apt2:amd64 apt:i386 ]
 Inst apt2 [1] (2 unstable [amd64]) [apt:i386 ]

+ 8 - 8
test/integration/test-bug-632221-cross-dependency-satisfaction

@@ -47,10 +47,10 @@ Inst amdboot (1.0 unstable [amd64])
 Inst cool (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
 Inst foreigner (1.0 unstable [amd64])
-Inst libc6:armel (1.0 unstable [armel])
 Inst libc6 (1.0 unstable [amd64])
-Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libc6:armel (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [amd64])
+Inst libc6-dev:armel (1.0 unstable [armel])
 Conf amdboot (1.0 unstable [amd64])
 Conf cool (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
@@ -90,10 +90,10 @@ Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst cool (1.0 unstable [armel])
 Inst doxygen (1.0 unstable [armel])
 Inst foreigner (1.0 unstable [armel])
-Inst libc6 (1.0 unstable [armel])
 Inst libc6:amd64 (1.0 unstable [amd64])
-Inst libc6-dev (1.0 unstable [armel])
+Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev:amd64 (1.0 unstable [amd64])
+Inst libc6-dev (1.0 unstable [armel])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf cool (1.0 unstable [armel])
 Conf doxygen (1.0 unstable [armel])
@@ -129,10 +129,10 @@ The following NEW packages will be installed:
 0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
 Inst amdboot (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [amd64])
-Inst libc6:armel (1.0 unstable [armel])
 Inst libc6 (1.0 unstable [amd64])
-Inst libc6-dev:armel (1.0 unstable [armel])
+Inst libc6:armel (1.0 unstable [armel])
 Inst libc6-dev (1.0 unstable [amd64])
+Inst libc6-dev:armel (1.0 unstable [armel])
 Conf amdboot (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [amd64])
 Conf libc6 (1.0 unstable [amd64])
@@ -169,10 +169,10 @@ The following NEW packages will be installed:
 0 upgraded, 6 newly installed, 0 to remove and 2 not upgraded.
 Inst amdboot:amd64 (1.0 unstable [amd64])
 Inst doxygen (1.0 unstable [armel])
-Inst libc6 (1.0 unstable [armel])
 Inst libc6:amd64 (1.0 unstable [amd64])
-Inst libc6-dev (1.0 unstable [armel])
+Inst libc6 (1.0 unstable [armel])
 Inst libc6-dev:amd64 (1.0 unstable [amd64])
+Inst libc6-dev (1.0 unstable [armel])
 Conf amdboot:amd64 (1.0 unstable [amd64])
 Conf doxygen (1.0 unstable [armel])
 Conf libc6:amd64 (1.0 unstable [amd64])

+ 31 - 0
test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first

@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64' 'i386'
+
+insertinstalledpackage 'libsame' 'i386' '1'
+insertinstalledpackage 'apt' 'i386' '1' 'Depends: libsame (= 1)'
+
+insertpackage 'unstable' 'libsame' 'i386,amd64' '2' 'Multi-Arch: same'
+insertpackage 'unstable' 'apt' 'i386' '2' 'Depends: libsame (= 2)'
+
+setupaptarchive
+
+testequal 'Reading package lists...
+Building dependency tree...
+The following extra packages will be installed:
+  apt:i386 libsame:i386
+The following NEW packages will be installed:
+  libsame
+The following packages will be upgraded:
+  apt:i386 libsame:i386
+2 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst libsame:i386 [1] (2 unstable [i386]) [apt:i386 ]
+Inst libsame (2 unstable [amd64]) [apt:i386 ]
+Conf libsame:i386 (2 unstable [i386]) [apt:i386 ]
+Conf libsame (2 unstable [amd64]) [apt:i386 ]
+Inst apt:i386 [1] (2 unstable [i386])
+Conf apt:i386 (2 unstable [i386])' aptget install libsame:amd64 -s