// -*- 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
/* This is called to correct the installation when packages could not
be downloaded. */
bool pkgPackageManager::FixMissing()
-{
+{
pkgProblemResolver Resolve(Cache);
List->SetFileList(FileNames);
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;
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;
// 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)
/* 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++)
{
}
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);
}
// 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;