From: David Kalnischkies Date: Mon, 5 Jul 2010 09:34:35 +0000 (+0200) Subject: make the specify order of packages irrelevant (half-close #196021) X-Git-Tag: 0.8.0~9^2~22^2~7 X-Git-Url: https://git.saurik.com/apt.git/commitdiff_plain/6806db8ac030ab7401b7b8b8324c62bb7b4a0275 make the specify order of packages irrelevant (half-close #196021) --- diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 9a6c12ee0..7cf760c27 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -762,6 +762,7 @@ struct TryToInstall { pkgProblemResolver* Fix; bool FixBroken; unsigned long AutoMarkChanged; + APT::PackageSet doAutoInstallLater; TryToInstall(pkgCacheFile &Cache, pkgProblemResolver &PM, bool const &FixBroken) : Cache(&Cache), Fix(&PM), FixBroken(FixBroken), AutoMarkChanged(0) {}; @@ -769,8 +770,6 @@ struct TryToInstall { void operator() (pkgCache::VerIterator const &Ver) { pkgCache::PkgIterator Pkg = Ver.ParentPkg(); -std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl; - Cache->GetDepCache()->SetCandidateVersion(Ver); pkgDepCache::StateCache &State = (*Cache)[Pkg]; @@ -801,8 +800,8 @@ std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl; // Install it with autoinstalling enabled (if we not respect the minial // required deps or the policy) - if ((State.InstBroken() == true || State.InstPolicyBroken() == true) && FixBroken == false) - Cache->GetDepCache()->MarkInstall(Pkg,true); + if (FixBroken == false) + doAutoInstallLater.insert(Pkg); } // see if we need to fix the auto-mark flag @@ -820,6 +819,17 @@ std::clog << "INSTALL " << Pkg << " VER " << Ver.VerStr() << std::endl; AutoMarkChanged++; } } + + void doAutoInstall() { + for (APT::PackageSet::const_iterator P = doAutoInstallLater.begin(); + P != doAutoInstallLater.end(); ++P) { + pkgDepCache::StateCache &State = (*Cache)[P]; + if (State.InstBroken() == false && State.InstPolicyBroken() == false) + continue; + Cache->GetDepCache()->MarkInstall(P, true); + } + doAutoInstallLater.clear(); + } }; /*}}}*/ // TryToRemove - Mark a package for removal /*{{{*/ @@ -1336,6 +1346,7 @@ bool TryToInstallBuildDep(pkgCache::PkgIterator Pkg,pkgCacheFile &Cache, } else if (Cache[Pkg].CandidateVer != 0) { TryToInstall InstallAction(Cache, Fix, BrokenFix); InstallAction(Cache[Pkg].CandidateVerIter(Cache)); + InstallAction.doAutoInstall(); } else return AllowFail; @@ -1743,8 +1754,10 @@ bool DoInstall(CommandLine &CmdL) for (unsigned short i = 0; order[i] != 0; ++i) { - if (order[i] == MOD_INSTALL) + if (order[i] == MOD_INSTALL) { InstallAction = std::for_each(verset[MOD_INSTALL].begin(), verset[MOD_INSTALL].end(), InstallAction); + InstallAction.doAutoInstall(); + } else if (order[i] == MOD_REMOVE) RemoveAction = std::for_each(verset[MOD_REMOVE].begin(), verset[MOD_REMOVE].end(), RemoveAction); } diff --git a/debian/changelog b/debian/changelog index 0b1ca3cf1..a76bd0f0d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,7 @@ apt (0.7.26~exp8) UNRELEASED; urgency=low - check in Grouped* first without modifier interpretation * cmdline/apt-get.cc: - use the cachsets in the install commands + - make the specify order of packages irrelevant (half-close #196021) * apt-pkg/orderlist.cc: - untouched packages are never missing * apt-pkg/packagemanager.cc: