From 30426f4822516bdd26528aa2e6d8d69c1291c8d3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 9 Sep 2011 12:35:22 +0200 Subject: M-A:same lockstep unpack should operate on installed packages first (LP: #835625) --- apt-pkg/packagemanager.cc | 31 ++++++++++++++++++---- debian/changelog | 4 ++- .../test-bug-618288-multiarch-same-lockstep | 4 +-- .../test-bug-632221-cross-dependency-satisfaction | 16 +++++------ ...u-bug-835625-multiarch-lockstep-installed-first | 31 ++++++++++++++++++++++ 5 files changed, 70 insertions(+), 16 deletions(-) create mode 100755 test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 6601d9f6b..8b73b9980 100644 --- a/apt-pkg/packagemanager.cc +++ b/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. diff --git a/debian/changelog b/debian/changelog index 39445f443..4c677784f 100644 --- a/debian/changelog +++ b/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 Mon, 05 Sep 2011 15:53:12 +0200 + -- David Kalnischkies Fri, 09 Sep 2011 12:34:04 +0200 apt (0.8.15.6) unstable; urgency=low diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep index 7e384e428..a05f03df4 100755 --- a/test/integration/test-bug-618288-multiarch-same-lockstep +++ b/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 ] diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index 58de44843..4299f052f 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/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]) diff --git a/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first b/test/integration/test-ubuntu-bug-835625-multiarch-lockstep-installed-first new file mode 100755 index 000000000..a9a4069cf --- /dev/null +++ b/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 -- cgit v1.2.3