Sfoglia il codice sorgente

M-A: allowed pkgs of unconfigured archs do not statisfy :any

We parse all architectures we encounter recently, which means we also
parse packages from architectures which are neither native nor foreign,
but still came onto the system somehow (usually via heavy force).
David Kalnischkies 11 anni fa
parent
commit
384f17b40e

+ 12 - 8
apt-pkg/deb/deblistparser.cc

@@ -824,13 +824,13 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver,
 /* */
 bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
 {
+   string const Arch = Ver.Arch();
    const char *Start;
    const char *Stop;
    if (Section.Find("Provides",Start,Stop) == true)
    {
       string Package;
       string Version;
-      string const Arch = Ver.Arch();
       unsigned int Op;
 
       while (1)
@@ -847,8 +847,9 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
 	    if (NewProvides(Ver, Package, OtherArch, Version, pkgCache::Flag::ArchSpecific) == false)
 	       return false;
 	 } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) {
-	    if (NewProvidesAllArch(Ver, Package, Version, 0) == false)
-	       return false;
+	    if (APT::Configuration::checkArchitecture(Arch))
+	       if (NewProvidesAllArch(Ver, Package, Version, 0) == false)
+		  return false;
 	 } else {
 	    if (NewProvides(Ver, Package, Arch, Version, 0) == false)
 	       return false;
@@ -859,13 +860,16 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
       }
    }
 
-   if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
+   if (APT::Configuration::checkArchitecture(Arch))
    {
-      string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
-      return NewProvides(Ver, Package, "any", Ver.VerStr(), pkgCache::Flag::MultiArchImplicit);
+      if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
+      {
+	 string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
+	 return NewProvides(Ver, Package, "any", Ver.VerStr(), pkgCache::Flag::MultiArchImplicit);
+      }
+      else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
+	 return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr(), pkgCache::Flag::MultiArchImplicit);
    }
-   else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
-      return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr(), pkgCache::Flag::MultiArchImplicit);
 
    return true;
 }

+ 49 - 0
test/integration/test-multiarch-allowed

@@ -242,3 +242,52 @@ solveableinsinglearch1 'needsfoover1'
 testfailureequal "$NEEDSFOO2NATIVE" aptget install needsfoover2 -s
 solveableinsinglearch2
 solveableinsinglearch3
+
+msgmsg 'multi-arch with barbarian archs'
+configarchitecture 'amd64' 'i386'
+insertinstalledpackage 'foo' 'armel' '1' 'Multi-Arch: allowed'
+insertinstalledpackage 'coolfoo' 'armel' '1' 'Multi-Arch:allowed
+Provides: coolbar'
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+  foo
+The following packages will be REMOVED:
+  foo:armel
+The following NEW packages will be installed:
+  foo needsfooany
+0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv foo:armel [1]
+Inst foo (1 unstable [amd64])
+Inst needsfooany (1 unstable [amd64])
+Conf foo (1 unstable [amd64])
+Conf needsfooany (1 unstable [amd64])' aptget install needsfooany -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+  foo
+The following packages will be REMOVED:
+  foo:armel
+The following NEW packages will be installed:
+  foo needsfooany:i386
+0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv foo:armel [1]
+Inst foo (1 unstable [amd64])
+Inst needsfooany:i386 (1 unstable [i386])
+Conf foo (1 unstable [amd64])
+Conf needsfooany:i386 (1 unstable [i386])' aptget install needsfooany:i386 -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+  coolfoo
+The following packages will be REMOVED:
+  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]
+Inst coolfoo (1 unstable [amd64])
+Inst needscoolfoover0 (1 unstable [amd64])
+Conf coolfoo (1 unstable [amd64])
+Conf needscoolfoover0 (1 unstable [amd64])' aptget install needscoolfoover0 -s

+ 35 - 0
test/integration/test-multiarch-foreign

@@ -240,3 +240,38 @@ msgmsg 'switch to single architecture'
 configarchitecture 'amd64'
 
 satisfiable_in_singlearch
+
+msgmsg 'switch to multi-arch with barbarian architecture'
+
+insertinstalledpackage 'foo' 'armhf' '1.0' 'Multi-Arch: foreign'
+insertinstalledpackage 'bar' 'armhf' '1.0' 'Provides: bar-provider
+Multi-Arch: foreign'
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+  foo
+The following packages will be REMOVED:
+  foo:armhf
+The following NEW packages will be installed:
+  cool-foo foo
+0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv foo:armhf [1.0]
+Inst foo (1.0 unstable [amd64])
+Inst cool-foo (1.0 unstable [amd64])
+Conf foo (1.0 unstable [amd64])
+Conf cool-foo (1.0 unstable [amd64])' aptget install cool-foo -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following additional packages will be installed:
+  bar
+The following packages will be REMOVED:
+  bar:armhf
+The following NEW packages will be installed:
+  bar cool-bar
+0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
+Remv bar:armhf [1.0]
+Inst bar (1.0 unstable [amd64])
+Inst cool-bar (1.0 unstable [amd64])
+Conf bar (1.0 unstable [amd64])
+Conf cool-bar (1.0 unstable [amd64])' aptget install cool-bar -s