diff options
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 10 | ||||
-rwxr-xr-x | test/integration/test-multiarch-allowed | 50 |
2 files changed, 38 insertions, 22 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index b4fd0641e..807f3bf6c 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -626,16 +626,16 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg, StringView Name, pkgCache::PkgIterator const M = Grp.FindPreferredPkg(false); // native or any foreign pkg will do if (M.end() == false) { pkgCache::PrvIterator Prv; + pkgCache::VerIterator Ver; Dynamic<pkgCache::PrvIterator> DynPrv(Prv); + Dynamic<pkgCache::VerIterator> DynVer(Ver); for (Prv = M.ProvidesList(); Prv.end() == false; ++Prv) { if ((Prv->Flags & pkgCache::Flag::ArchSpecific) != 0) continue; - pkgCache::VerIterator Ver = Prv.OwnerVer(); - Dynamic<pkgCache::VerIterator> DynVer(Ver); - if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed || - ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign && - (Prv->Flags & pkgCache::Flag::MultiArchImplicit) == 0)) + Ver = Prv.OwnerVer(); + if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign && + (Prv->Flags & pkgCache::Flag::MultiArchImplicit) == 0) { if (APT::Configuration::checkArchitecture(Ver.ParentPkg().Arch()) == false) continue; diff --git a/test/integration/test-multiarch-allowed b/test/integration/test-multiarch-allowed index b9af20084..69d0bfa10 100755 --- a/test/integration/test-multiarch-allowed +++ b/test/integration/test-multiarch-allowed @@ -19,8 +19,8 @@ insertpackage 'unstable' 'coolfoo' 'amd64' '1' 'Multi-Arch:allowed Provides: coolbar' insertpackage 'unstable' 'coolfoover' 'amd64' '1' 'Multi-Arch:allowed Provides: coolbar (= 2)' -insertpackage 'unstable' 'needscoolfoo' 'amd64' '1' 'Depends: coolfoo, coolbar' -insertpackage 'unstable' 'needscoolfooany' 'amd64' '1' 'Depends: coolfoo:any, coolbar:any' +insertpackage 'unstable' 'needscoolfoo' 'amd64,i386' '1' 'Depends: coolfoo, coolbar' +insertpackage 'unstable' 'needscoolfooany' 'amd64,i386' '1' 'Depends: coolfoo:any, coolbar:any' insertpackage 'unstable' 'needscoolfoover0' 'amd64' '1' 'Depends: coolfoo:any (>= 1), coolbar:any' insertpackage 'unstable' 'needscoolfoover1' 'amd64' '1' 'Depends: coolfoo:any (>= 1), coolbar:any (>= 1)' insertpackage 'unstable' 'needscoolfoover2' 'amd64' '1' 'Depends: coolfoo:any (>= 2), coolbar:any (>= 1)' @@ -166,6 +166,28 @@ Inst hatesfoonative (1 unstable [amd64]) Conf foo:i386 (1 unstable [i386]) Conf hatesfoonative (1 unstable [amd64])' aptget install foo:i386 hatesfoonative -s +testfailureequal "$BADPREFIX +The following packages have unmet dependencies: + needscoolfoo:i386 : Depends: coolfoo:i386 but it is not installable + Depends: coolbar:i386 but it is not installable +E: Unable to correct problems, you have held broken packages." aptget install needscoolfoo:i386 -s +solveneedscoolfooanyin() { + local NEEDSCOOL='needscoolfooany' + if [ "$1" != 'amd64' ]; then NEEDSCOOL="${NEEDSCOOL}:$1"; fi + testsuccessequal "Reading package lists... +Building dependency tree... +The following additional packages will be installed: + coolfoo +The following NEW packages will be installed: + coolfoo $NEEDSCOOL +0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. +Inst coolfoo (1 unstable [amd64]) +Inst $NEEDSCOOL (1 unstable [$1]) +Conf coolfoo (1 unstable [amd64]) +Conf $NEEDSCOOL (1 unstable [$1])" aptget install $NEEDSCOOL -s +} +solveneedscoolfooanyin 'i386' + solveableinsinglearch3() { testsuccessequal "Reading package lists... Building dependency tree... @@ -191,17 +213,7 @@ Inst needscoolfoo (1 unstable [amd64]) Conf coolfoo (1 unstable [amd64]) Conf coolfoover (1 unstable [amd64]) Conf needscoolfoo (1 unstable [amd64])" aptget install needscoolfoo coolfoover -s - testsuccessequal "Reading package lists... -Building dependency tree... -The following additional packages will be installed: - coolfoo -The following NEW packages will be installed: - coolfoo needscoolfooany -0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded. -Inst coolfoo (1 unstable [amd64]) -Inst needscoolfooany (1 unstable [amd64]) -Conf coolfoo (1 unstable [amd64]) -Conf needscoolfooany (1 unstable [amd64])" aptget install needscoolfooany -s + solveneedscoolfooanyin 'amd64' testsuccessequal 'Reading package lists... Building dependency tree... The following additional packages will be installed: @@ -258,7 +270,9 @@ configarchitecture 'amd64' 'i386' insertinstalledpackage 'foo' 'armel' '1' 'Multi-Arch: allowed' insertinstalledpackage 'coolfoo' 'armel' '1' 'Multi-Arch:allowed Provides: coolbar' -insertinstalledpackage 'bar-needer' 'armel' '1.0' 'Depends: coolbar:any' +insertinstalledpackage 'bar-needer' 'armel' '1.0' 'Depends: coolbar' +insertinstalledpackage 'bar-any-needer' 'armel' '1.0' 'Depends: coolbar:any' +insertinstalledpackage 'bar-armel-needer' 'armel' '1.0' 'Depends: coolbar:armel' testsuccess aptget check testsuccessequal 'Reading package lists... @@ -294,11 +308,13 @@ Building dependency tree... The following additional packages will be installed: coolfoo The following packages will be REMOVED: - coolfoo:armel + bar-armel-needer:armel bar-needer:armel coolfoo:armel The following NEW packages will be installed: coolfoo needscoolfoover0 -0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded. -Remv coolfoo:armel [1] [bar-needer:armel ] +0 upgraded, 2 newly installed, 3 to remove and 0 not upgraded. +Remv bar-armel-needer:armel [1.0] +Remv bar-needer:armel [1.0] +Remv coolfoo:armel [1] [bar-any-needer:armel ] Inst coolfoo (1 unstable [amd64]) Inst needscoolfoover0 (1 unstable [amd64]) Conf coolfoo (1 unstable [amd64]) |