diff options
author | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:37 +0000 |
---|---|---|
committer | Arch Librarian <arch@canonical.com> | 2004-09-20 16:55:37 +0000 |
commit | 5af32db6607ca018936285fd19a776bd10a418f0 (patch) | |
tree | 63ce903cd4abe5e57cd3c091c856841e188fff5a /apt-pkg | |
parent | 1cecba4d13975dcc4933b5c28c175ce78907bb64 (diff) | |
download | apt-5af32db6607ca018936285fd19a776bd10a418f0.tar.gz |
Detect Early removal of essential libraries
Author: jgg
Date: 1999-12-24 21:10:56 GMT
Detect Early removal of essential libraries
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/packagemanager.cc | 38 |
1 files changed, 29 insertions, 9 deletions
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()); |