diff options
author | David Kalnischkies <david@kalnischkies.de> | 2014-11-25 10:50:58 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2014-12-07 19:12:51 +0100 |
commit | 4e6a7e260eb713318b1b5019a72073050242ac3c (patch) | |
tree | d470cb43478001d2702e391d674bdd8fe7052ed7 /apt-pkg | |
parent | 1d838084dc775c0a4184edb4f3b9138903ac27fb (diff) |
properly handle already reinstall pkgs in ordering
The bugreport itself describes the case of the ordering code detecting a
loop where none is present, but the testcase finds also cases in which
there is actually a loop and we fail to realize it. --reinstall can be
considered an interactive command through and it usually doesn't
encounter such "hard" problems (= looping essentials), so this is less
serious than it sounds at first.
Closes: 770291
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/packagemanager.cc | 46 |
1 files changed, 36 insertions, 10 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index ba48c53cc..d137dc75a 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -400,7 +400,8 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth) // Check if the current version of the package is available and will satisfy this dependency if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true && List->IsFlag(DepPkg,pkgOrderList::Removed) == false && - DepPkg.State() == PkgIterator::NeedsNothing) + DepPkg.State() == PkgIterator::NeedsNothing && + (Cache[DepPkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) { Bad = false; break; @@ -413,8 +414,13 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth) if (PkgLoop == true) { if (Debug) - std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure" << std::endl; - Bad = false; + std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure"; + if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) + Bad = false; + else if (Debug) + std::clog << ", but it isn't unpacked yet"; + if (Debug) + std::clog << std::endl; } } @@ -426,7 +432,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth) if (Bad == false) { if (Debug) - std::clog << OutputInDepth(Depth) << "Found ok dep " << D.TargetPkg() << std::endl; + std::clog << OutputInDepth(Depth) << "Found ok dep " << Start.TargetPkg() << std::endl; continue; } @@ -444,7 +450,8 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth) // Check if the current version of the package is available and will satisfy this dependency if (DepPkg.CurrentVer() == Ver && List->IsNow(DepPkg) == true && List->IsFlag(DepPkg,pkgOrderList::Removed) == false && - DepPkg.State() == PkgIterator::NeedsNothing) + DepPkg.State() == PkgIterator::NeedsNothing && + (Cache[DepPkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) continue; // Check if the version that is going to be installed will satisfy the dependency @@ -454,8 +461,13 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth) if (PkgLoop == true) { if (Debug) - std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure" << std::endl; - Bad = false; + std::clog << OutputInDepth(Depth) << "Package " << Pkg << " loops in SmartConfigure"; + if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) + Bad = false; + else if (Debug) + std::clog << ", but it isn't unpacked yet"; + if (Debug) + std::clog << std::endl; } else { @@ -722,7 +734,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c // See if the current version is ok if (Pkg.CurrentVer() == Ver && List->IsNow(Pkg) == true && - Pkg.State() == PkgIterator::NeedsNothing) + Pkg.State() == PkgIterator::NeedsNothing && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) { Bad = false; if (Debug) @@ -744,8 +757,11 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c PkgIterator DepPkg = Ver.ParentPkg(); // Not the install version - if (Cache[DepPkg].InstallVer != *I || - (Cache[DepPkg].Keep() == true && DepPkg.State() == PkgIterator::NeedsNothing)) + if (Cache[DepPkg].InstallVer != *I) + continue; + + if (Cache[DepPkg].Keep() == true && DepPkg.State() == PkgIterator::NeedsNothing && + (Cache[DepPkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) continue; if (List->IsFlag(DepPkg,pkgOrderList::Configured)) @@ -757,6 +773,16 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c // check if it needs unpack or if if configure is enough if (List->IsFlag(DepPkg,pkgOrderList::UnPacked) == false) { + // two packages pre-depending on each other can't be handled sanely + if (List->IsFlag(DepPkg,pkgOrderList::Loop) && PkgLoop) + { + // this isn't an error as there is potential for something else to satisfy it + // (like a provides or an or-group member) + if (Debug) + clog << OutputInDepth(Depth) << "Unpack loop detected between " << DepPkg.FullName() << " and " << Pkg.FullName() << endl; + continue; + } + if (Debug) clog << OutputInDepth(Depth) << "Trying to SmartUnpack " << DepPkg.FullName() << endl; if (NonLoopingSmart(UNPACK_IMMEDIATE, Pkg, DepPkg, Depth, PkgLoop, &Bad, &Changed) == false) |