From 5af32db6607ca018936285fd19a776bd10a418f0 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:55:37 +0000 Subject: Detect Early removal of essential libraries Author: jgg Date: 1999-12-24 21:10:56 GMT Detect Early removal of essential libraries --- apt-pkg/packagemanager.cc | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index 392931042..772ad4a5b 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.23 1999/12/09 05:22:33 jgg Exp $ +// $Id: packagemanager.cc,v 1.24 1999/12/24 21:10:56 jgg Exp $ /* ###################################################################### Package Manager - Abstacts the package manager @@ -195,19 +195,22 @@ bool pkgPackageManager::CheckRConflicts(PkgIterator Pkg,DepIterator D, { if (D->Type != pkgCache::Dep::Conflicts) continue; + + // The package hasnt been changed + if (List->IsNow(Pkg) == false) + continue; - if (D.ParentPkg() == Pkg) + // Ignore self conflicts, ignore conflicts from irrelevent versions + if (D.ParentPkg() == Pkg || D.ParentVer() != D.ParentPkg().CurrentVer()) continue; if (pkgCheckDep(D.TargetVer(),Ver,D->CompareOp) == false) continue; - - if (List->IsNow(Pkg) == false) - continue; if (EarlyRemove(D.ParentPkg()) == false) - return false; - } + return _error->Error("Reverse conflicts early remove for package '%s' failed", + Pkg.Name()); + } return true; } /*}}}*/ @@ -367,7 +370,22 @@ bool pkgPackageManager::EarlyRemove(PkgIterator Pkg) return false; // Essential packages get special treatment + bool IsEssential = false; if ((Pkg->Flags & pkgCache::Flag::Essential) != 0) + IsEssential = true; + + /* Check for packages that are the dependents of essential packages and + promote them too */ + if (Pkg->CurrentVer != 0) + { + for (DepIterator D = Pkg.RevDependsList(); D.end() == false && + IsEssential == false; D++) + if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends) + if ((D.ParentPkg()->Flags & pkgCache::Flag::Essential) != 0) + IsEssential = true; + } + + if (IsEssential == true) { if (_config->FindB("APT::Force-LoopBreak",false) == false) return _error->Error("This installation run will require temporarily " @@ -491,8 +509,10 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg) } // Check for reverse conflicts. - CheckRConflicts(Pkg,Pkg.RevDependsList(), - Cache[Pkg].InstVerIter(Cache).VerStr()); + if (CheckRConflicts(Pkg,Pkg.RevDependsList(), + Cache[Pkg].InstVerIter(Cache).VerStr()) == false) + return false; + for (PrvIterator P = Cache[Pkg].InstVerIter(Cache).ProvidesList(); P.end() == false; P++) CheckRConflicts(Pkg,P.ParentPkg().RevDependsList(),P.ProvideVersion()); -- cgit v1.2.3