From 3fdb6f8315de03819a82bcf9fc5ac5d15389fcb0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 24 Jul 2011 19:04:18 +0200 Subject: first round of reorder code without changing result --- cmdline/apt-get.cc | 56 ++++++++++++++++++++++++++---------------------------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 1df3b520e..721ce9dc7 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2725,6 +2725,16 @@ bool DoBuildDep(CommandLine &CmdL) if (skipAlternatives == true) { + /* + * if there are alternatives, we've already picked one, so skip + * the rest + * + * TODO: this means that if there's a build-dep on A|B and B is + * installed, we'll still try to install A; more importantly, + * if A is currently broken, we cannot go back and try B. To fix + * this would require we do a Resolve cycle for each package we + * add to the install list. Ugh + */ if (!hasAlternatives) skipAlternatives = false; // end of or group continue; @@ -2752,10 +2762,10 @@ bool DoBuildDep(CommandLine &CmdL) } else // BuildDep || BuildDepIndep { - pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package); if (_config->FindB("Debug::BuildDeps",false) == true) cout << "Looking for " << (*D).Package << "...\n"; + pkgCache::PkgIterator Pkg = Cache->FindPkg((*D).Package); if (Pkg.end() == true) { if (_config->FindB("Debug::BuildDeps",false) == true) @@ -2770,34 +2780,6 @@ bool DoBuildDep(CommandLine &CmdL) (*D).Package.c_str()); } - /* - * if there are alternatives, we've already picked one, so skip - * the rest - * - * TODO: this means that if there's a build-dep on A|B and B is - * installed, we'll still try to install A; more importantly, - * if A is currently broken, we cannot go back and try B. To fix - * this would require we do a Resolve cycle for each package we - * add to the install list. Ugh - */ - - /* - * If this is a virtual package, we need to check the list of - * packages that provide it and see if any of those are - * installed - */ - pkgCache::PrvIterator Prv = Pkg.ProvidesList(); - for (; Prv.end() != true; Prv++) - { - if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " Checking provider " << Prv.OwnerPkg().FullName() << endl; - - if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false) - break; - } - - // Get installed version and version we are going to install - pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache); if ((*D).Version[0] != '\0') { // Versioned dependency @@ -2827,6 +2809,21 @@ bool DoBuildDep(CommandLine &CmdL) } else { + /* + * If this is a virtual package, we need to check the list of + * packages that provide it and see if any of those are + * installed + */ + pkgCache::PrvIterator Prv = Pkg.ProvidesList(); + for (; Prv.end() != true; Prv++) + { + if (_config->FindB("Debug::BuildDeps",false) == true) + cout << " Checking provider " << Prv.OwnerPkg().FullName() << endl; + + if ((*Cache)[Prv.OwnerPkg()].InstVerIter(*Cache).end() == false) + break; + } + // Only consider virtual packages if there is no versioned dependency if (Prv.end() == false) { @@ -2837,6 +2834,7 @@ bool DoBuildDep(CommandLine &CmdL) } } + pkgCache::VerIterator IV = (*Cache)[Pkg].InstVerIter(*Cache); if (IV.end() == false) { if (_config->FindB("Debug::BuildDeps",false) == true) -- cgit v1.2.3