diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-09-13 09:03:14 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-09-13 09:03:14 +0200 |
commit | 23bee63e78b8497f8143edf50b7330daaedffeb5 (patch) | |
tree | 9b096fb021948daaddd2d1498cb28b093c269062 /apt-pkg | |
parent | 2d3032b2c4bd77b103c0d450c90c59dccfbb28fe (diff) |
* cherry pick revision 2173 from lp:~donkult/apt/sid
- M-A:same lockstep unpack should operate on installed
packages first (LP: #835625)
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/packagemanager.cc | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index db18c5521..c6815658b 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) == 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. |