X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/d556d1a1cc89e0f99d1b76fd6da72fd0174f5862..25be5a8f52aa37f4f13ec32f57e434b60d2e43fe:/apt-pkg/packagemanager.cc diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 126caef93..fad40c46a 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: packagemanager.cc,v 1.18 1999/07/10 04:58:42 jgg Exp $ +// $Id: packagemanager.cc,v 1.22 1999/10/22 05:58:54 jgg Exp $ /* ###################################################################### Package Manager - Abstacts the package manager @@ -87,7 +87,7 @@ bool pkgPackageManager::GetArchives(pkgAcquire *Owner,pkgSourceList *Sources, /* This is called to correct the installation when packages could not be downloaded. */ bool pkgPackageManager::FixMissing() -{ +{ pkgProblemResolver Resolve(Cache); List->SetFileList(FileNames); @@ -101,6 +101,10 @@ bool pkgPackageManager::FixMissing() Bad = true; Cache.MarkKeep(I); } + + // We have to empty the list otherwise it will not have the new changes + delete List; + List = 0; if (Bad == false) return true; @@ -153,6 +157,7 @@ bool pkgPackageManager::CreateOrderList() if ((Cache[I].Keep() == true || Cache[I].InstVerIter(Cache) == I.CurrentVer()) && I.State() == pkgCache::PkgIterator::NeedsNothing && + (Cache[I].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall && (I.Purge() != false || Cache[I].Mode != pkgDepCache::ModeDelete || (Cache[I].iFlags & pkgDepCache::Purge) != pkgDepCache::Purge)) continue; @@ -360,6 +365,17 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg) // Woops, it will not be re-installed! if (List->IsFlag(Pkg,pkgOrderList::InList) == false) return false; + + // Essential packages get special treatment + if ((Pkg->Flags & pkgCache::Flag::Essential) != 0) + { + if (_config->FindB("APT::Force-LoopBreak",false) == false) + return _error->Error("This installation run will require temporarily " + "removing the essential package %s due to a " + "Conflicts/Pre-Depends loop. This is often bad, " + "but if you really want to do it, activate the " + "APT::Force-LoopBreak option.",Pkg.Name()); + } bool Res = SmartRemove(Pkg); if (Cache[Pkg].Delete() == false) @@ -399,12 +415,17 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) /* See if this packages install version has any predependencies that are not met by 'now' packages. */ for (DepIterator D = Cache[Pkg].InstVerIter(Cache).DependsList(); - D.end() == false; D++) + D.end() == false; ) { - if (D->Type == pkgCache::Dep::PreDepends) + // Compute a single dependency element (glob or) + pkgCache::DepIterator Start; + pkgCache::DepIterator End; + D.GlobOr(Start,End); + + while (End->Type == pkgCache::Dep::PreDepends) { // Look for possible ok targets. - Version **VList = D.AllTargets(); + Version **VList = Start.AllTargets(); bool Bad = true; for (Version **I = VList; *I != 0 && Bad == true; I++) { @@ -435,18 +456,24 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) } delete [] VList; - - if (Bad == true) - return _error->Error("Internal Error, Couldn't configure a pre-depend"); - continue; + /* If this or element did not match then continue on to the + next or element until a matching element is found*/ + if (Bad == true) + { + if (Start == End) + return _error->Error("Internal Error, Couldn't configure a pre-depend"); + Start++; + } + else + break; } - if (D->Type == pkgCache::Dep::Conflicts) + if (End->Type == pkgCache::Dep::Conflicts) { /* Look for conflicts. Two packages that are both in the install state cannot conflict so we don't check.. */ - Version **VList = D.AllTargets(); + Version **VList = End.AllTargets(); for (Version **I = VList; *I != 0; I++) { VerIterator Ver(Cache,*I); @@ -530,7 +557,9 @@ pkgPackageManager::OrderResult pkgPackageManager::OrderInstall() } // Sanity check - if (Cache[Pkg].Keep() == true && Pkg.State() == pkgCache::PkgIterator::NeedsNothing) + if (Cache[Pkg].Keep() == true && + Pkg.State() == pkgCache::PkgIterator::NeedsNothing && + (Cache[Pkg].iFlags & pkgDepCache::ReInstall) != pkgDepCache::ReInstall) { _error->Error("Internal Error, trying to manipulate a kept package"); return Failed;