From 09ddf81f7665f3ae2c854308fc60d9722beed13a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 7 Dec 2006 23:09:25 +0100 Subject: merged iwjs patch --- apt-pkg/algorithms.cc | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index ddfda754d..9011821bb 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -986,6 +986,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) } if (Debug) clog << " Will not break " << Pkg.Name() << " as stated in Breaks field in " << I.Name() < Date: Thu, 16 Aug 2007 01:10:35 +0100 Subject: dpkg-triggers: deal properly with new package states; 0.7.6ubuntu6 --- apt-pkg/algorithms.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index b21fcbb2f..62727a852 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -257,6 +257,8 @@ bool pkgApplyStatus(pkgDepCache &Cache) re-unpacked (probably) */ case pkgCache::State::UnPacked: case pkgCache::State::HalfConfigured: + case pkgCache::State::TriggersAwaited: + case pkgCache::State::TriggersPending: if ((I->CurrentVer != 0 && I.CurrentVer().Downloadable() == true) || I.State() != pkgCache::PkgIterator::NeedsUnpack) Cache.MarkKeep(I, false, false); -- cgit v1.2.3 From fce726023f703c369ae030684e75ed03c7544d6b Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 21 Dec 2007 13:56:19 +0100 Subject: implement AptAuthenticationReliabtlity spec --- apt-pkg/algorithms.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 158f9c258..c5e3c7b38 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1107,8 +1107,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) return _error->Error(_("Unable to correct problems, you have held broken packages.")); } - // set the auto-flags (mvo: I'm not sure if we _really_ need this, but - // I didn't managed + // set the auto-flags (mvo: I'm not sure if we _really_ need this) pkgCache::PkgIterator I = Cache.PkgBegin(); for (;I.end() != true; I++) { if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) { -- cgit v1.2.3 From b26daf93a588aeed441d5a0622b3e96ec7dffe91 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 9 Jan 2008 22:24:22 +0000 Subject: * apt-pkg/algorithms.cc: - Since APT::Get::List-Cleanup and APT::List-Cleanup both default to true, the effect of the compatibility code was to require both of them to be set to false in order to disable list cleanup; this broke the installer. Instead, disable list cleanup if either of them is set to false. --- apt-pkg/algorithms.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 6e2b97557..57b85e24f 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1356,7 +1356,7 @@ bool ListUpdate(pkgAcquireStatus &Stat, // Keep "APT::Get::List-Cleanup" name for compatibility, but // this is really a global option for the APT library now if (!TransientNetworkFailure && !Failed && - (_config->FindB("APT::Get::List-Cleanup",true) == true || + (_config->FindB("APT::Get::List-Cleanup",true) == true && _config->FindB("APT::List-Cleanup",true) == true)) { if (Fetcher.Clean(_config->FindDir("Dir::State::lists")) == false || -- cgit v1.2.3 From 803ea2a87f81252b2c0d541b8502ed206ce57c84 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 12 Feb 2010 00:04:31 +0100 Subject: Add yet another pseudo package which isn't as pseudo as the others: Arch all packages are now represented by arch depending packages which all depend on a package with the same name and the special arch "all". This packages has NO dependencies, but beside this the same information. It is the only package which has a size, the arch depending ones all have a zero size. While the arch depending pseudo packages are used for dependency resolution the arch "all" package is used for downloading and ordering of the package. --- apt-pkg/algorithms.cc | 52 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 34da745de..c905cffa9 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -83,13 +83,28 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) { // Adapt the iterator - PkgIterator Pkg = Sim.FindPkg(iPkg.Name()); + PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); Flags[Pkg->ID] = 1; cout << "Inst "; Describe(Pkg,cout,true,true); Sim.MarkInstall(Pkg,false); - + + if (strcmp(Pkg.Arch(),"all") == 0) + { + pkgCache::GrpIterator G = Pkg.Group(); + pkgCache::GrpIterator iG = iPkg.Group(); + for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P)) + { + if (strcmp(P.Arch(), "all") == 0) + continue; + if (iG.FindPkg(P.Arch())->CurrentVer == 0) + continue; + Flags[P->ID] = 1; + Sim.MarkInstall(P, false); + } + } + // Look for broken conflicts+predepends. for (PkgIterator I = Sim.PkgBegin(); I.end() == false; I++) { @@ -131,9 +146,22 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) bool pkgSimulate::Configure(PkgIterator iPkg) { // Adapt the iterator - PkgIterator Pkg = Sim.FindPkg(iPkg.Name()); + PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); Flags[Pkg->ID] = 2; + + if (strcmp(Pkg.Arch(),"all") == 0) + { + pkgCache::GrpIterator G = Pkg.Group(); + for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P)) + { + if (strcmp(P.Arch(), "all") == 0) + continue; + if (Flags[P->ID] == 1) + Flags[P->ID] = 2; + } + } + // Sim.MarkInstall(Pkg,false); if (Sim[Pkg].InstBroken() == true) { @@ -181,10 +209,26 @@ bool pkgSimulate::Configure(PkgIterator iPkg) bool pkgSimulate::Remove(PkgIterator iPkg,bool Purge) { // Adapt the iterator - PkgIterator Pkg = Sim.FindPkg(iPkg.Name()); + PkgIterator Pkg = Sim.FindPkg(iPkg.Name(), iPkg.Arch()); Flags[Pkg->ID] = 3; Sim.MarkDelete(Pkg); + + if (strcmp(Pkg.Arch(),"all") == 0) + { + pkgCache::GrpIterator G = Pkg.Group(); + pkgCache::GrpIterator iG = iPkg.Group(); + for (pkgCache::PkgIterator P = G.FindPkg("any"); P.end() != true; P = G.NextPkg(P)) + { + if (strcmp(P.Arch(), "all") == 0) + continue; + if (iG.FindPkg(P.Arch())->CurrentVer == 0) + continue; + Flags[P->ID] = 3; + Sim.MarkDelete(P); + } + } + if (Purge == true) cout << "Purg "; else -- cgit v1.2.3 From 5e5d20643487fd1693af418bd1201be5802c232d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 1 Mar 2010 22:47:17 +0100 Subject: fix compiler error if compiled with -std=c++0x --- apt-pkg/algorithms.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index c905cffa9..f8a9e210c 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -535,11 +535,11 @@ void pkgProblemResolver::MakeScores() // Important Required Standard Optional Extra signed short PrioMap[] = { 0, - _config->FindI("pkgProblemResolver::Scores::Important",3), - _config->FindI("pkgProblemResolver::Scores::Required",2), - _config->FindI("pkgProblemResolver::Scores::Standard",1), - _config->FindI("pkgProblemResolver::Scores::Optional",-1), - _config->FindI("pkgProblemResolver::Scores::Extra",-2) + (signed short) _config->FindI("pkgProblemResolver::Scores::Important",3), + (signed short) _config->FindI("pkgProblemResolver::Scores::Required",2), + (signed short) _config->FindI("pkgProblemResolver::Scores::Standard",1), + (signed short) _config->FindI("pkgProblemResolver::Scores::Optional",-1), + (signed short) _config->FindI("pkgProblemResolver::Scores::Extra",-2) }; signed short PrioEssentials = _config->FindI("pkgProblemResolver::Scores::Essentials",100); signed short PrioInstalledAndNotObsolete = _config->FindI("pkgProblemResolver::Scores::NotObsolete",1); -- cgit v1.2.3 From 1cd1c398d18b78f4aa9d882a5de5385f4538e0be Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 7 Apr 2010 16:38:18 +0200 Subject: * apt-pkg/contrib/fileutl.cc: - add a parent-guarded "mkdir -p" as CreateDirectory() * apt-pkg/acquire.{cc,h}: - add a delayed constructor with Setup() for success reporting - check for and create directories in Setup if needed instead of error out unfriendly in the Constructor (Closes: #523920, #525783) - optional handle a lock file in Setup() * cmdline/apt-get.cc: - remove the lock file handling and let Acquire take care of it instead --- apt-pkg/algorithms.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index f8a9e210c..f1e51131a 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1398,7 +1398,9 @@ bool ListUpdate(pkgAcquireStatus &Stat, int PulseInterval) { pkgAcquire::RunResult res; - pkgAcquire Fetcher(&Stat); + pkgAcquire Fetcher; + if (Fetcher.Setup(&Stat, _config->FindDir("Dir::State::Lists")) == false) + return false; // Populate it with the source selection if (List.GetIndexes(&Fetcher) == false) -- cgit v1.2.3 From 47f6d1b72bc883ecdc00542da4c824a5c4fb79fa Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Aug 2010 15:58:09 +0200 Subject: * apt-pkg/algorithms.cc: - change the debug outputs to display also arch of the package and version dependencies information --- apt-pkg/algorithms.cc | 74 +++++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 37 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index f17c76d6c..12c5b8710 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -58,7 +58,7 @@ void pkgSimulate::Describe(PkgIterator Pkg,ostream &out,bool Current,bool Candid { VerIterator Ver(Sim); - out << Pkg.Name(); + out << Pkg.FullName(true); if (Current == true) { @@ -123,9 +123,9 @@ bool pkgSimulate::Install(PkgIterator iPkg,string /*File*/) { if ((Sim[End] & pkgDepCache::DepGInstall) == 0) { - cout << " [" << I.Name() << " on " << Start.TargetPkg().Name() << ']'; + cout << " [" << I.FullName(false) << " on " << Start.TargetPkg().FullName(false) << ']'; if (Start->Type == pkgCache::Dep::Conflicts) - _error->Error("Fatal, conflicts violated %s",I.Name()); + _error->Error("Fatal, conflicts violated %s",I.FullName(false).c_str()); } } } @@ -165,7 +165,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg) // Sim.MarkInstall(Pkg,false); if (Sim[Pkg].InstBroken() == true) { - cout << "Conf " << Pkg.Name() << " broken" << endl; + cout << "Conf " << Pkg.FullName(false) << " broken" << endl; Sim.Update(); @@ -177,17 +177,17 @@ bool pkgSimulate::Configure(PkgIterator iPkg) continue; if (D->Type == pkgCache::Dep::Obsoletes) - cout << " Obsoletes:" << D.TargetPkg().Name(); + cout << " Obsoletes:" << D.TargetPkg().FullName(false); else if (D->Type == pkgCache::Dep::Conflicts) - cout << " Conflicts:" << D.TargetPkg().Name(); + cout << " Conflicts:" << D.TargetPkg().FullName(false); else if (D->Type == pkgCache::Dep::DpkgBreaks) - cout << " Breaks:" << D.TargetPkg().Name(); + cout << " Breaks:" << D.TargetPkg().FullName(false); else - cout << " Depends:" << D.TargetPkg().Name(); + cout << " Depends:" << D.TargetPkg().FullName(false); } cout << endl; - _error->Error("Conf Broken %s",Pkg.Name()); + _error->Error("Conf Broken %s",Pkg.FullName(false)); } else { @@ -254,7 +254,7 @@ void pkgSimulate::ShortBreaks() if (Sim[I].InstBroken() == true) { if (Flags[I->ID] == 0) - cout << I.Name() << ' '; + cout << I.FullName(false) << ' '; /* else cout << I.Name() << "! ";*/ } @@ -290,7 +290,7 @@ bool pkgApplyStatus(pkgDepCache &Cache) Cache.MarkInstall(I, false, 0, false); else return _error->Error(_("The package %s needs to be reinstalled, " - "but I can't find an archive for it."),I.Name()); + "but I can't find an archive for it."),I.FullName(true)); } continue; @@ -325,7 +325,7 @@ bool pkgApplyStatus(pkgDepCache &Cache) default: if (I->InstState != pkgCache::State::Ok) return _error->Error("The package %s is not ok and I " - "don't know how to fix it!",I.Name()); + "don't know how to fix it!",I.FullName(false)); } } return true; @@ -709,7 +709,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) if ((Flags[P->ID] & Protected) == Protected) { if (Debug == true) - clog << " Reinst Failed because of protected " << P.Name() << endl; + clog << " Reinst Failed because of protected " << P.FullName(false) << endl; Fail = true; } else @@ -720,7 +720,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) if (DoUpgrade(P) == false) { if (Debug == true) - clog << " Reinst Failed because of " << P.Name() << endl; + clog << " Reinst Failed because of " << P.FullName(false) << endl; Fail = true; } else @@ -739,7 +739,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) break; if (Debug == true) - clog << " Reinst Failed early because of " << Start.TargetPkg().Name() << endl; + clog << " Reinst Failed early because of " << Start.TargetPkg().FullName(false) << endl; Fail = true; } } @@ -763,7 +763,7 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg) } if (Debug == true) - clog << " Re-Instated " << Pkg.Name() << endl; + clog << " Re-Instated " << Pkg.FullName(false) << endl; return true; } /*}}}*/ @@ -863,7 +863,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) (Flags[I->ID] & ReInstateTried) == 0) { if (Debug == true) - clog << " Try to Re-Instate " << I.Name() << endl; + clog << " Try to Re-Instate " << I.FullName(false) << endl; unsigned long OldBreaks = Cache.BrokenCount(); pkgCache::Version *OldVer = Cache[I].InstallVer; Flags[I->ID] &= ReInstateTried; @@ -879,14 +879,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) } else if (Debug == true) - clog << "Re-Instated " << I.Name() << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl; + clog << "Re-Instated " << I.FullName(false) << " (" << OldBreaks << " vs " << Cache.BrokenCount() << ')' << endl; } if (Cache[I].InstallVer == 0 || Cache[I].InstBroken() == false) continue; if (Debug == true) - clog << "Investigating " << I.Name() << endl; + clog << "Investigating " << I << endl; // Isolate the problem dependency PackageKill KillList[100]; @@ -911,7 +911,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if ((Flags[I->ID] & Protected) != Protected) { if (Debug == true) - clog << " Or group remove for " << I.Name() << endl; + clog << " Or group remove for " << I.FullName(false) << endl; Cache.MarkDelete(I); Change = true; } @@ -919,7 +919,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if (OldEnd == LEnd && OrOp == OrKeep) { if (Debug == true) - clog << " Or group keep for " << I.Name() << endl; + clog << " Or group keep for " << I.FullName(false) << endl; Cache.MarkKeep(I, false, false); Change = true; } @@ -956,7 +956,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) } if (Debug == true) - clog << "Package " << I.Name() << " has broken " << Start.DepType() << " on " << Start.TargetPkg().Name() << endl; + clog << "Broken " << Start << endl; /* Look across the version list. If there are no possible targets then we keep the package and bail. This is necessary @@ -987,8 +987,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) pkgCache::PkgIterator Pkg = Ver.ParentPkg(); if (Debug == true) - clog << " Considering " << Pkg.Name() << ' ' << (int)Scores[Pkg->ID] << - " as a solution to " << I.Name() << ' ' << (int)Scores[I->ID] << endl; + clog << " Considering " << Pkg.FullName(false) << ' ' << (int)Scores[Pkg->ID] << + " as a solution to " << I.FullName(false) << ' ' << (int)Scores[I->ID] << endl; /* Try to fix the package under consideration rather than fiddle with the VList package */ @@ -1026,7 +1026,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) Cache.MarkInstall(I, false, 0, false); if (Debug == true) - clog << " Holding Back " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl; + clog << " Holding Back " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl; } else { @@ -1036,7 +1036,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if (InOr == false) { if (Debug == true) - clog << " Removing " << I.Name() << " rather than change " << Start.TargetPkg().Name() << endl; + clog << " Removing " << I.FullName(false) << " rather than change " << Start.TargetPkg().FullName(false) << endl; Cache.MarkDelete(I); if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID]) Scores[I->ID] = Scores[Pkg->ID]; @@ -1068,7 +1068,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if (Cache[End] & pkgDepCache::DepGCVer) { if (Debug) - clog << " Upgrading " << Pkg.Name() << " due to Breaks field in " << I.Name() << endl; + clog << " Upgrading " << Pkg.FullName(false) << " due to Breaks field in " << I.FullName(false) << endl; Cache.MarkInstall(Pkg, false, 0, false); continue; } @@ -1079,7 +1079,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) continue; if (Debug == true) - clog << " Added " << Pkg.Name() << " to the remove list" << endl; + clog << " Added " << Pkg.FullName(false) << " to the remove list" << endl; LEnd->Pkg = Pkg; LEnd->Dep = End; @@ -1111,12 +1111,12 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) Cache.MarkInstall(I, false, 0, false); if (Debug == true) - clog << " Holding Back " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl; + clog << " Holding Back " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl; } else { if (Debug == true) - clog << " Removing " << I.Name() << " because I can't find " << Start.TargetPkg().Name() << endl; + clog << " Removing " << I.FullName(false) << " because I can't find " << Start.TargetPkg().FullName(false) << endl; if (InOr == false) Cache.MarkDelete(I); } @@ -1146,14 +1146,14 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) J->Dep->Type == pkgCache::Dep::Obsoletes) { if (Debug == true) - clog << " Fixing " << I.Name() << " via remove of " << J->Pkg.Name() << endl; + clog << " Fixing " << I.FullName(false) << " via remove of " << J->Pkg.FullName(false) << endl; Cache.MarkDelete(J->Pkg); } } else { if (Debug == true) - clog << " Fixing " << I.Name() << " via keep of " << J->Pkg.Name() << endl; + clog << " Fixing " << I.FullName(false) << " via keep of " << J->Pkg.FullName(false) << endl; Cache.MarkKeep(J->Pkg, false, false); } @@ -1189,7 +1189,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) for (;I.end() != true; I++) { if (Cache[I].NewInstall() && !(Flags[I->ID] & PreInstalled)) { if(_config->FindI("Debug::pkgAutoRemove",false)) { - std::clog << "Resolve installed new pkg: " << I.Name() + std::clog << "Resolve installed new pkg: " << I.FullName(false) << " (now marking it as auto)" << std::endl; } Cache[I].Flags |= pkgCache::Flag::Auto; @@ -1252,7 +1252,7 @@ bool pkgProblemResolver::ResolveByKeep() if ((Flags[I->ID] & Protected) == 0) { if (Debug == true) - clog << "Keeping package " << I.Name() << endl; + clog << "Keeping package " << I.FullName(false) << endl; Cache.MarkKeep(I, false, false); if (Cache[I].InstBroken() == false) { @@ -1283,7 +1283,7 @@ bool pkgProblemResolver::ResolveByKeep() while (true) { if (Debug == true) - clog << "Package " << I.Name() << " has broken " << Start.DepType() << " on " << Start.TargetPkg().Name() << endl; + clog << "Package " << I.FullName(false) << " " << Start << endl; // Look at all the possible provides on this package SPtrArray VList = Start.AllTargets(); @@ -1300,7 +1300,7 @@ bool pkgProblemResolver::ResolveByKeep() if ((Flags[I->ID] & Protected) == 0) { if (Debug == true) - clog << " Keeping Package " << Pkg.Name() << " due to " << Start.DepType() << endl; + clog << " Keeping Package " << Pkg.FullName(false) << " due to " << Start.DepType() << endl; Cache.MarkKeep(Pkg, false, false); } @@ -1325,7 +1325,7 @@ bool pkgProblemResolver::ResolveByKeep() // Restart again. if (K == LastStop) - return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.Name()); + return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false)); LastStop = K; K = PList - 1; } -- cgit v1.2.3 From 09a10f9cd2661d28b2ff53d59a0936563cfe1cf7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 13 Aug 2010 14:41:55 +0200 Subject: * apt-pkg/algorithms.cc: - let the problem resolver install packages to fix or-groups as a needed remove nuked another or-member (helps for #591882) The resolver sometimes need to break or-groups because he need to remove the previous satisfier as a result of a breaks/conflicts. In such broken or-groups he now tries to install a non-installed non-deleted member of the or-group to statisfy it again. This move is dangerous as it introduces the possibility of a bunch of "new" broken breaks/conflicts on the new statisfier or its dependencies and we don't know about them beforehand. We also don't have the infrastructure to undo the decision later, so we just do it and pray! For now a test option is provided to disable this behavior on the fly to test if the situation is worse: pkgProblemResolver::FixByInstall --- apt-pkg/algorithms.cc | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 12c5b8710..5641869ab 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -187,7 +187,7 @@ bool pkgSimulate::Configure(PkgIterator iPkg) } cout << endl; - _error->Error("Conf Broken %s",Pkg.FullName(false)); + _error->Error("Conf Broken %s",Pkg.FullName(false).c_str()); } else { @@ -290,7 +290,7 @@ bool pkgApplyStatus(pkgDepCache &Cache) Cache.MarkInstall(I, false, 0, false); else return _error->Error(_("The package %s needs to be reinstalled, " - "but I can't find an archive for it."),I.FullName(true)); + "but I can't find an archive for it."),I.FullName(true).c_str()); } continue; @@ -325,7 +325,7 @@ bool pkgApplyStatus(pkgDepCache &Cache) default: if (I->InstState != pkgCache::State::Ok) return _error->Error("The package %s is not ok and I " - "don't know how to fix it!",I.FullName(false)); + "don't know how to fix it!",I.FullName(false).c_str()); } } return true; @@ -847,6 +847,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) not be possible for a loop to form (that is a < b < c and fixing b by changing a breaks c) */ bool Change = true; + bool const TryFixByInstall = _config->FindB("pkgProblemResolver::FixByInstall", true); for (int Counter = 0; Counter != 10 && Change == true; Counter++) { Change = false; @@ -863,7 +864,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) (Flags[I->ID] & ReInstateTried) == 0) { if (Debug == true) - clog << " Try to Re-Instate " << I.FullName(false) << endl; + clog << " Try to Re-Instate (" << Counter << ") " << I.FullName(false) << endl; unsigned long OldBreaks = Cache.BrokenCount(); pkgCache::Version *OldVer = Cache[I].InstallVer; Flags[I->ID] &= ReInstateTried; @@ -886,7 +887,7 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) continue; if (Debug == true) - clog << "Investigating " << I << endl; + clog << "Investigating (" << Counter << ") " << I << endl; // Isolate the problem dependency PackageKill KillList[100]; @@ -904,9 +905,9 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if (Start == End) { // Decide what to do - if (InOr == true) + if (InOr == true && OldEnd == LEnd) { - if (OldEnd == LEnd && OrOp == OrRemove) + if (OrOp == OrRemove) { if ((Flags[I->ID] & Protected) != Protected) { @@ -914,9 +915,9 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) clog << " Or group remove for " << I.FullName(false) << endl; Cache.MarkDelete(I); Change = true; - } - } - if (OldEnd == LEnd && OrOp == OrKeep) + } + } + else if (OrOp == OrKeep) { if (Debug == true) clog << " Or group keep for " << I.FullName(false) << endl; @@ -1041,6 +1042,23 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) if (Counter > 1 && Scores[Pkg->ID] > Scores[I->ID]) Scores[I->ID] = Scores[Pkg->ID]; } + else if (TryFixByInstall == true && + Start.TargetPkg()->CurrentVer == 0 && + Cache[Start.TargetPkg()].Delete() == false && + Cache.GetCandidateVer(Start.TargetPkg()).end() == false) + { + /* Before removing or keeping the package with the broken dependency + try instead to install the first not previously installed package + solving this dependency. This helps every time a previous solver + is removed by the resolver because of a conflict or alike but it is + dangerous as it could trigger new breaks/conflicts… */ + std::cout << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl; + unsigned long const OldBroken = Cache.BrokenCount(); + Cache.MarkInstall(Start.TargetPkg(), true, 1, false); + // FIXME: we should undo the complete MarkInstall process here + if (Cache[Start.TargetPkg()].InstBroken() == true || Cache.BrokenCount() > OldBroken) + Cache.MarkDelete(Start.TargetPkg(), false, 1, false); + } } } @@ -1325,7 +1343,7 @@ bool pkgProblemResolver::ResolveByKeep() // Restart again. if (K == LastStop) - return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false)); + return _error->Error("Internal Error, pkgProblemResolver::ResolveByKeep is looping on package %s.",I.FullName(false).c_str()); LastStop = K; K = PList - 1; } -- cgit v1.2.3 From 443266ef94244f2c6854f34ddbacf1fcacfdb0f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 14 Aug 2010 01:21:50 +0200 Subject: do not unconditional print the new debugoutput for "FixByInstall" --- apt-pkg/algorithms.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg/algorithms.cc') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 5641869ab..3c8711b74 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1052,7 +1052,8 @@ bool pkgProblemResolver::Resolve(bool BrokenFix) solving this dependency. This helps every time a previous solver is removed by the resolver because of a conflict or alike but it is dangerous as it could trigger new breaks/conflicts… */ - std::cout << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl; + if (Debug == true) + clog << " Try Installing " << Start.TargetPkg() << " before changing " << I.FullName(false) << std::endl; unsigned long const OldBroken = Cache.BrokenCount(); Cache.MarkInstall(Start.TargetPkg(), true, 1, false); // FIXME: we should undo the complete MarkInstall process here -- cgit v1.2.3