From a99d02a86c5c25c4a36f06aa44c01709de8219c4 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Fri, 12 Aug 2011 16:36:25 +0100 Subject: Added code to allow SmartConfigure to be called mutiple times on the same package to ensure all dependancies are satisfied. --- apt-pkg/packagemanager.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'apt-pkg/packagemanager.cc') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 8fc571f2f..7a0f11d85 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -324,7 +324,10 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) VerIterator InstallVer = VerIterator(Cache,Cache[Pkg].InstallVer); clog << "SmartConfigure " << Pkg.Name() << InstallVer.VerStr() << endl; } - + + // If this is true, only check and correct and dependancies without the Loop flag + bool PkgLoop = List->IsFlag(Pkg,pkgOrderList::Loop); + VerIterator const instVer = Cache[Pkg].InstVerIter(Cache); /* Because of the ordered list, most dependancies should be unpacked, @@ -365,16 +368,19 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) // Check if the version that is going to be installed will satisfy the dependancy if (Cache[DepPkg].InstallVer == *I) { if (List->IsFlag(DepPkg,pkgOrderList::UnPacked)) { + if (PkgLoop && List->IsFlag(DepPkg,pkgOrderList::Loop)) { + // This dependancy has already been dealt with by another SmartConfigure on Pkg + Bad = false; + break; + } /* Check for a loop to prevent one forming If A depends on B and B depends on A, SmartConfigure will just hop between them if this is not checked */ - if (!List->IsFlag(DepPkg,pkgOrderList::Loop)) { - List->Flag(Pkg,pkgOrderList::Loop); - // If SmartConfigure was succesfull, Bad is false, so break - Bad = !SmartConfigure(DepPkg); - List->RmFlag(Pkg,pkgOrderList::Loop); - if (!Bad) break; - } + List->Flag(Pkg,pkgOrderList::Loop); + // If SmartConfigure was succesfull, Bad is false, so break + Bad = !SmartConfigure(DepPkg); + List->RmFlag(Pkg,pkgOrderList::Loop); + if (!Bad) break; } else if (List->IsFlag(DepPkg,pkgOrderList::Configured)) { Bad = false; break; @@ -389,7 +395,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) List->Flag(Pkg,pkgOrderList::Loop); if (Debug) cout << " Unpacking " << DepPkg.Name() << " to avoid loop" << endl; - SmartUnPack(DepPkg, true); + SmartUnPack(DepPkg, false); List->RmFlag(Pkg,pkgOrderList::Loop); } } @@ -412,6 +418,8 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg) _error->Warning(_("Could not configure '%s'. "),Pkg.Name()); return false; } + + if (PkgLoop) return true; static std::string const conf = _config->Find("PackageManager::Configure","all"); static bool const ConfigurePkgs = (conf == "all" || conf == "smart"); -- cgit v1.2.3