]> git.saurik.com Git - apt.git/commitdiff
* apt-pkg/pkgcachegen.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 17 Mar 2010 13:47:05 +0000 (14:47 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 17 Mar 2010 13:47:05 +0000 (14:47 +0100)
  - merge versions correctly even if multiple different versions
    with the same version number are available.
    Thanks to Magnus Holmgren for the patch! (Closes: #351056)

apt-pkg/pkgcachegen.cc
debian/changelog

index 3eeb18cae69c2ee85ea1242a7481f1d7a917876b..75a0e34f076d8f5dbb23d468cdd0fddd5a1020d1 100644 (file)
@@ -175,17 +175,22 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
       pkgCache::VerIterator Ver = Pkg.VersionList();
       map_ptrloc *LastVer = &Pkg->VersionList;
       int Res = 1;
+      unsigned long const Hash = List.VersionHash();
       for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
       {
         Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
-        if (Res >= 0)
+        // Version is higher as current version - insert here
+        if (Res > 0)
            break;
+        // Versionstrings are equal - is hash also equal?
+        if (Res == 0 && Ver->Hash == Hash)
+           break;
+        // proceed with the next till we have either the right
+        // or we found another version (which will be lower)
       }
-      
-      /* We already have a version for this item, record that we
-         saw it */
-      unsigned long Hash = List.VersionHash();
-      if (Res == 0 && Ver->Hash == Hash)
+
+      /* We already have a version for this item, record that we saw it */
+      if (Res == 0)
       {
         if (List.UsePackage(Pkg,Ver) == false)
            return _error->Error(_("Error occurred while processing %s (UsePackage2)"),
@@ -204,17 +209,6 @@ bool pkgCacheGenerator::MergeList(ListParser &List,
         }
         
         continue;
-      }      
-
-      // Skip to the end of the same version set.
-      if (Res == 0)
-      {
-        for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++)
-        {
-           Res = Cache.VS->CmpVersion(Version,Ver.VerStr());
-           if (Res != 0)
-              break;
-        }
       }
 
       // Add a new version
index ddbf1921486b2f84083055da910ee7d2f0e16930..bdafa70e831c223280c65838be8883cce415f1b6 100644 (file)
@@ -35,6 +35,10 @@ apt (0.7.26) UNRELEASED; urgency=low
   * doc/makefile, doc/*:
     - generate subdirectories for building the manpages in on the fly
       depending on the po files we have.
+  * apt-pkg/pkgcachegen.cc:
+    - merge versions correctly even if multiple different versions
+      with the same version number are available.
+      Thanks to Magnus Holmgren for the patch! (Closes: #351056)
 
   [ Julian Andres Klode ]
   * cmdline/apt-mark: