From d77b985a309c379d4978525172a72b728fecd15e Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 16 May 2011 11:41:43 +0200 Subject: * apt-pkg/packagemanager.cc: - ensure for Multi-Arch:same packages that they are unpacked in lock step even in immediate configuration (Closes: #618288) --- apt-pkg/packagemanager.cc | 44 ++++++++++++++++++---- apt-pkg/packagemanager.h | 2 + debian/changelog | 5 ++- .../test-bug-618288-multiarch-same-lockstep | 32 ++++++++++++++++ 4 files changed, 75 insertions(+), 8 deletions(-) create mode 100755 test/integration/test-bug-618288-multiarch-same-lockstep diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 4c655cb7b..fe9f6eb68 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -319,6 +319,17 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States); } + if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same) + for (PkgIterator P = Pkg.Group().PackageList(); + P.end() == false; P = Pkg.Group().NextPkg(P)) + { + if (Pkg == P || List->IsFlag(P,pkgOrderList::Configured) == true || + Cache[P].InstallVer == 0 || (P.CurrentVer() == Cache[P].InstallVer && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall)) + continue; + SmartConfigure(P); + } + // Sanity Check if (List->IsFlag(Pkg,pkgOrderList::Configured) == false) return _error->Error(_("Could not perform immediate configuration on '%s'. " @@ -474,22 +485,29 @@ bool pkgPackageManager::SmartRemove(PkgIterator Pkg) // --------------------------------------------------------------------- /* This performs the task of handling pre-depends. */ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) +{ + return SmartUnPack(Pkg, true); +} +bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate) { // Check if it is already unpacked if (Pkg.State() == pkgCache::PkgIterator::NeedsConfigure && Cache[Pkg].Keep() == true) { List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true) + if (Immediate == true && + List->IsFlag(Pkg,pkgOrderList::Immediate) == true) if (SmartConfigure(Pkg) == false) return _error->Error(_("Could not perform immediate configuration on already unpacked '%s'. " "Please see man 5 apt.conf under APT::Immediate-Configure for details."),Pkg.Name()); return true; } + VerIterator const instVer = Cache[Pkg].InstVerIter(Cache); + /* See if this packages install version has any predependencies that are not met by 'now' packages. */ - for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); + for (DepIterator D = instVer.DependsList(); D.end() == false; ) { // Compute a single dependency element (glob or) @@ -575,20 +593,32 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) // Check for reverse conflicts. if (CheckRConflicts(Pkg,Pkg.RevDependsList(), - Cache[Pkg].InstVerIter(Cache).VerStr()) == false) + instVer.VerStr()) == false) return false; - for (PrvIterator P = Cache[Pkg].InstVerIter(Cache).ProvidesList(); + for (PrvIterator P = instVer.ProvidesList(); P.end() == false; P++) CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); + List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); + + if (instVer->MultiArch == pkgCache::Version::Same) + for (PkgIterator P = Pkg.Group().PackageList(); + P.end() == false; P = Pkg.Group().NextPkg(P)) + { + if (Pkg == P || 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(Install(Pkg,FileNames[Pkg->ID]) == false) return false; - List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States); - // Perform immedate configuration of the package. - if (List->IsFlag(Pkg,pkgOrderList::Immediate) == true) + if (Immediate == true && + List->IsFlag(Pkg,pkgOrderList::Immediate) == true) if (SmartConfigure(Pkg) == false) return _error->Error(_("Could not perform immediate configuration on '%s'. " "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.Name(),2); diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index efd2cfac6..053b4dc13 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -69,7 +69,9 @@ class pkgPackageManager : protected pkgCache::Namespace // Install helpers bool ConfigureAll(); bool SmartConfigure(PkgIterator Pkg); + //FIXME: merge on abi break bool SmartUnPack(PkgIterator Pkg); + bool SmartUnPack(PkgIterator Pkg, bool const Immediate); bool SmartRemove(PkgIterator Pkg); bool EarlyRemove(PkgIterator Pkg); diff --git a/debian/changelog b/debian/changelog index edcd2b851..591610108 100644 --- a/debian/changelog +++ b/debian/changelog @@ -56,8 +56,11 @@ apt (0.8.14.2) UNRELEASED; urgency=low quote an already quoted string in the request later (Closes: #602412) * apt-pkg/contrib/netrc.cc: - replace non-posix gnu-extension strdupa with strdup + * apt-pkg/packagemanager.cc: + - ensure for Multi-Arch:same packages that they are unpacked in + lock step even in immediate configuration (Closes: #618288) - -- David Kalnischkies Fri, 13 May 2011 01:08:04 +0200 + -- David Kalnischkies Mon, 16 May 2011 11:41:05 +0200 apt (0.8.14.1) unstable; urgency=low diff --git a/test/integration/test-bug-618288-multiarch-same-lockstep b/test/integration/test-bug-618288-multiarch-same-lockstep new file mode 100755 index 000000000..7e384e428 --- /dev/null +++ b/test/integration/test-bug-618288-multiarch-same-lockstep @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework +setupenvironment +configarchitecture 'amd64' 'i386' + +insertinstalledpackage 'libsame' 'i386,amd64' '1' 'Multi-Arch: same' 'required' +insertinstalledpackage 'apt' 'i386' '1' 'Depends: libsame (= 1) +Essential: yes' 'required' +insertinstalledpackage 'apt2' 'amd64' '1' 'Depends: libsame (= 1) +Essential: yes' 'required' +buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same' '' 'required' +buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required' +buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required' + +setupaptarchive + +testequal 'Reading package lists... +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 ] +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 ] +Conf apt2 (2 unstable [amd64]) [apt:i386 ] +Inst apt:i386 [1] (2 unstable [i386]) +Conf apt:i386 (2 unstable [i386])' aptget dist-upgrade -s -- cgit v1.2.3