]> git.saurik.com Git - apt.git/commitdiff
always create pkg at the time pkg:arch is created
authorDavid Kalnischkies <david@kalnischkies.de>
Tue, 19 Jan 2016 23:09:36 +0000 (00:09 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Mon, 25 Jan 2016 17:15:44 +0000 (18:15 +0100)
To resolve dependencies like "pkg:arch" we create a package with the
name "pkg:arch" and the architecture "any". We create these packages
only if a dependency needs it as these kind of dependencies aren't that
common. This commit ensured that in the even this architecture specific
dependency is the only relation this package has we still create the
underlying package to have them available in provides resolution.

apt-pkg/pkgcachegen.cc
test/integration/test-apt-cache
test/integration/test-specific-architecture-dependencies

index 55d1ee89de2c27e4fcffa825758a4e87c42a97a6..6e307fba9b32df572709ea1a324815bb7aeeb3d5 100644 (file)
@@ -660,31 +660,44 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg, StringView Name,
    if (Arch == "any")
    {
       size_t const found = Name.find(':');
-      StringView const NameA = Name.substr(0, found);
       StringView ArchA = Name.substr(found + 1);
-      pkgCache::PkgIterator PkgA = Cache.FindPkg(NameA, ArchA);
-      if (PkgA.end() == false)
+      if (ArchA != "any")
       {
         // ArchA is used inside the loop which might remap (NameA is not used)
         Dynamic<StringView> DynArchA(ArchA);
+        StringView NameA = Name.substr(0, found);
+        pkgCache::PkgIterator PkgA = Cache.FindPkg(NameA, ArchA);
         Dynamic<pkgCache::PkgIterator> DynPkgA(PkgA);
-        pkgCache::PrvIterator Prv = PkgA.ProvidesList();
-        for (; Prv.end() == false; ++Prv)
+        if (PkgA.end())
         {
-           if (Prv.IsMultiArchImplicit())
-              continue;
-           pkgCache::VerIterator V = Prv.OwnerVer();
-           if (ArchA != V.ParentPkg().Arch())
-              continue;
-           if (NewProvides(V, Pkg, V->VerStr, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
+           Dynamic<StringView> DynNameA(NameA);
+           if (NewPackage(PkgA, NameA, ArchA) == false)
               return false;
         }
-        pkgCache::VerIterator V = PkgA.VersionList();
-        Dynamic<pkgCache::VerIterator> DynV(V);
-        for (; V.end() == false; ++V)
+        if (unlikely(PkgA.end()))
+           return _error->Fatal("NewPackage was successful for %s:%s,"
+                 "but the package doesn't exist anyhow!",
+                 NameA.to_string().c_str(), ArchA.to_string().c_str());
+        else
         {
-           if (NewProvides(V, Pkg, V->VerStr, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
-              return false;
+           pkgCache::PrvIterator Prv = PkgA.ProvidesList();
+           for (; Prv.end() == false; ++Prv)
+           {
+              if (Prv.IsMultiArchImplicit())
+                 continue;
+              pkgCache::VerIterator V = Prv.OwnerVer();
+              if (ArchA != V.ParentPkg().Arch())
+                 continue;
+              if (NewProvides(V, Pkg, V->VerStr, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
+                 return false;
+           }
+           pkgCache::VerIterator V = PkgA.VersionList();
+           Dynamic<pkgCache::VerIterator> DynV(V);
+           for (; V.end() == false; ++V)
+           {
+              if (NewProvides(V, Pkg, V->VerStr, pkgCache::Flag::MultiArchImplicit | pkgCache::Flag::ArchSpecific) == false)
+                 return false;
+           }
         }
       }
    }
index 48d623596d5974bcf508107567a2638022bb37f0..bff1667e80a44f7c514114e41d6df34191a891e3 100755 (executable)
@@ -120,9 +120,12 @@ bar
   Depends: bar
   Breaks: foo
   Replaces: foo
+  Breaks: <foo:i386>
+  Replaces: <foo:i386>
 <foobar>
 <cool>
-<cooler>' aptcache depends foo --recurse --implicit
+<cooler>
+<foo:i386>' aptcache depends foo --recurse --implicit
 testsuccessequal 'foo
   Depends: bar
 bar
@@ -132,7 +135,9 @@ testsuccessequal 'foo
   Depends: bar
 bar
   Depends: bar
-  Replaces: foo' aptcache depends foo --recurse --important --replaces --implicit
+  Replaces: foo
+  Replaces: <foo:i386>
+<foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
 testsuccessequal 'bar
   Depends: bar
   Breaks: foo
@@ -140,7 +145,9 @@ testsuccessequal 'bar
 testsuccessequal 'bar
   Depends: bar
   Breaks: foo
-  Replaces: foo' aptcache depends bar --implicit
+  Replaces: foo
+  Breaks: <foo:i386>
+  Replaces: <foo:i386>' aptcache depends bar --implicit
 
 testsuccessequal 'specific
   Depends: <bar:i386>
index 746ecb351a6eebfe8b2f19fd45634ec818423649..9595556199aec0525d12734fdd30f6faee4c6412 100755 (executable)
@@ -108,12 +108,12 @@ Conf depender-x64:i386 (1 unstable [i386])' aptget install depender-x64:i386 -s
 testequal 'Reading package lists...
 Building dependency tree...
 The following packages will be REMOVED:
-  libold libold:i386
+  libold:i386 libold
 The following NEW packages will be installed:
   breaker
 0 upgraded, 1 newly installed, 2 to remove and 0 not upgraded.
-Remv libold [1]
 Remv libold:i386 [1]
+Remv libold [1]
 Inst breaker (1 unstable [all])
 Conf breaker (1 unstable [all])' aptget install breaker -s