diff options
author | Christopher Baines <cbaines8@gmail.com> | 2011-08-12 16:36:25 +0100 |
---|---|---|
committer | Christopher Baines <cbaines8@gmail.com> | 2011-08-12 16:36:25 +0100 |
commit | a99d02a86c5c25c4a36f06aa44c01709de8219c4 (patch) | |
tree | 6fc1b15c9601ad7d7632a62c7a619477a394c09c /apt-pkg/packagemanager.cc | |
parent | 987d8d0315a315c74827ee2160671a30f5bc4e14 (diff) | |
download | apt-a99d02a86c5c25c4a36f06aa44c01709de8219c4.tar.gz |
Added code to allow SmartConfigure to be called mutiple times on the same package to ensure all dependancies are satisfied.
Diffstat (limited to 'apt-pkg/packagemanager.cc')
-rw-r--r-- | apt-pkg/packagemanager.cc | 26 |
1 files changed, 17 insertions, 9 deletions
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"); |