diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-06-11 00:16:51 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-06-11 00:16:51 +0200 |
commit | d5dea0bed00ff1811fac1b56c2046d63c937a3f6 (patch) | |
tree | 9fdee47cd759d3fa86006c9299d3dca2a71bc6af | |
parent | a9a370d92c490f3f28cc1a1b1619971832c76de5 (diff) |
check build-dep candidate if install is forbidden
-rw-r--r-- | cmdline/apt-get.cc | 58 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | test/integration/framework | 3 | ||||
-rwxr-xr-x | test/integration/test-bug-632221-cross-dependency-satisfaction | 14 |
4 files changed, 56 insertions, 20 deletions
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index a4fd3cfb9..870c77280 100644 --- a/cmdline/apt-get.cc +++ b/cmdline/apt-get.cc @@ -2889,33 +2889,42 @@ bool DoBuildDep(CommandLine &CmdL) else Pkg = Cache->FindPkg(D->Package); - // We need to decide if host or build arch, so find a version we can look at - pkgCache::VerIterator Ver; - // a bad version either is invalid or doesn't satify dependency - #define BADVER(Ver) Ver.end() == true || \ - (Ver.end() == false && D->Version.empty() == false && \ - Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false) + #define BADVER(Ver) (Ver.end() == true || \ + (D->Version.empty() == false && \ + Cache->VS().CheckDep(Ver.VerStr(),D->Op,D->Version.c_str()) == false)) + APT::VersionList verlist; if (Pkg.end() == false) { - Ver = (*Cache)[Pkg].InstVerIter(*Cache); - if (BADVER(Ver)) - Ver = (*Cache)[Pkg].CandidateVerIter(*Cache); + pkgCache::VerIterator Ver = (*Cache)[Pkg].InstVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); + Ver = (*Cache)[Pkg].CandidateVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); } - if (BADVER(Ver)) + if (verlist.empty() == true) { pkgCache::PkgIterator HostPkg = Cache->FindPkg(D->Package, hostArch); if (HostPkg.end() == false) { - Ver = (*Cache)[HostPkg].InstVerIter(*Cache); - if (BADVER(Ver)) - Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache); + pkgCache::VerIterator Ver = (*Cache)[HostPkg].InstVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); + Ver = (*Cache)[HostPkg].CandidateVerIter(*Cache); + if (BADVER(Ver) == false) + verlist.insert(Ver); } } - if ((BADVER(Ver)) == false) + #undef BADVER + + string forbidden; + // We need to decide if host or build arch, so find a version we can look at + APT::VersionList::const_iterator Ver = verlist.begin(); + for (; Ver != verlist.end(); ++Ver) { - string forbidden; + forbidden.clear(); if (Ver->MultiArch == pkgCache::Version::None || Ver->MultiArch == pkgCache::Version::All) { if (colon == string::npos) @@ -2953,10 +2962,24 @@ bool DoBuildDep(CommandLine &CmdL) } // native gets buildArch } + if (forbidden.empty() == false) { if (_config->FindB("Debug::BuildDeps",false) == true) - cout << D->Package.substr(colon, string::npos) << " is not allowed from " << forbidden << " package " << (*D).Package << endl; + cout << D->Package.substr(colon, string::npos) << " is not allowed from " << forbidden << " package " << (*D).Package << " (" << Ver.VerStr() << ")" << endl; + continue; + } + + //we found a good version + break; + } + if (Ver == verlist.end()) + { + if (_config->FindB("Debug::BuildDeps",false) == true) + cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl; + + if (forbidden.empty() == false) + { if (hasAlternatives) continue; return _error->Error(_("%s dependency for %s can't be satisfied " @@ -2965,9 +2988,6 @@ bool DoBuildDep(CommandLine &CmdL) D->Package.c_str(), forbidden.c_str()); } } - else if (_config->FindB("Debug::BuildDeps",false) == true) - cout << " No multiarch info as we have no satisfying installed nor candidate for " << D->Package << " on build or host arch" << endl; - #undef BADVER } else Pkg = Cache->FindPkg(D->Package); diff --git a/debian/changelog b/debian/changelog index 720b07273..ee108b059 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ apt (0.9.5.2) UNRELEASED; urgency=low - print URIs for all changelogs in case of --print-uris, thanks to Daniel Hartwig for the patch! (Closes: #674897) - show 'bzr branch' as 'bzr get' is deprecated (LP: #1011032) + - check build-dep candidate if install is forbidden * debian/apt-utils.links: - the internal resolver 'apt' is now directly installed in /usr/lib/apt/solvers, so don't instruct dh to create a broken link diff --git a/test/integration/framework b/test/integration/framework index 5a0e1070f..dba8c0162 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -508,7 +508,8 @@ Architecture: $ARCH" >> $FILE test -z "$DEPENDENCIES" || echo "$DEPENDENCIES" >> $FILE echo "Files: d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.dsc - d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz" >> $FILE + d41d8cd98f00b204e9800998ecf8427e 0 ${NAME}_${VERSION}.tar.gz +" >> $FILE } insertinstalledpackage() { diff --git a/test/integration/test-bug-632221-cross-dependency-satisfaction b/test/integration/test-bug-632221-cross-dependency-satisfaction index a128366c5..93cc153e6 100755 --- a/test/integration/test-bug-632221-cross-dependency-satisfaction +++ b/test/integration/test-bug-632221-cross-dependency-satisfaction @@ -23,8 +23,22 @@ insertpackage 'unstable' 'linux-stuff' 'amd64,armel' '1.0' insertsource 'unstable' 'apt' 'any' '0.8.15' 'Build-Depends: doxygen, libc6-dev, libc6-dev:native, cool:any, amdboot:amd64, foreigner, libfwibble-dev, arm-stuff [any-arm] | linux-stuff [ linux-any]' +insertsource 'unstable' 'forbidden-none' 'any' '1' 'Build-Depends: amdboot:any' +insertsource 'unstable' 'forbidden-same' 'any' '1' 'Build-Depends: libc6:any' +insertsource 'unstable' 'forbidden-foreign' 'any' '1' 'Build-Depends: doxygen:any' + setupaptarchive +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-none can't be satisfied because amdboot:any is not allowed on 'Multi-Arch: none' packages" aptget build-dep forbidden-none -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-same can't be satisfied because libc6:any is not allowed on 'Multi-Arch: same' packages" aptget build-dep forbidden-same -s -a armel +testequal "Reading package lists... +Building dependency tree... +E: Build-Depends dependency for forbidden-foreign can't be satisfied because doxygen:any is not allowed on 'Multi-Arch: foreign' packages" aptget build-dep forbidden-foreign -s -a armel + testequal 'Reading package lists... Building dependency tree... The following NEW packages will be installed: |