summaryrefslogtreecommitdiff
path: root/cmdline
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2010-07-05 11:34:35 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2010-07-05 11:34:35 +0200
commit6806db8ac030ab7401b7b8b8324c62bb7b4a0275 (patch)
tree7c731ba36f7891e47be6a42ab916eb5c5a9e646d /cmdline
parentdcfa253fa4b3c563b3ed085c40d3336933840d55 (diff)
make the specify order of packages irrelevant (half-close #196021)
Diffstat (limited to 'cmdline')
-rw-r--r--cmdline/apt-get.cc23
1 files changed, 18 insertions, 5 deletions
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);
}