summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2021-09-03 20:45:04 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2021-09-04 15:35:15 +0200
commit20745375afb333fd3d442006f3c6ebbebe195dab (patch)
tree63ac397573697971b346f2f51049418c81a56e99
parent017b3d0ae5232628c15324204e607e76487afb99 (diff)
Do not make provides of M-A:allowed implicit M-A:foreign
As we don't know which architectures we will deal with and to avoid creating many "unneeded" packages (and provides) the cache generation uses a scheme of on-demand creation (see ecc138f858). This assumed a particular handling of :any which got changed later (3addaba1ff) making this code path not only no longer needed for M-A:allowed, but actually wrong as it would go on and create provides for the explicit Provides of a package as if the package would be M-A:foreign. The result was that a package A:amd64 providing B tagged as M-A:allowed would satisfy a "C:armel depends on B". Note that this bug does NOT effect "C:armel depends on A" which is (correctly) not satisfied as before. References: ecc138f858, 3addaba1ff
-rw-r--r--apt-pkg/pkgcachegen.cc10
-rwxr-xr-xtest/integration/test-multiarch-allowed50
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])