Explorar o código

equal comparisions are used mostly in same-source relations,
so use this to try to reuse some version strings

David Kalnischkies %!s(int64=13) %!d(string=hai) anos
pai
achega
b8a884c0c7
Modificáronse 2 ficheiros con 16 adicións e 6 borrados
  1. 14 6
      apt-pkg/pkgcachegen.cc
  2. 2 0
      debian/changelog

+ 14 - 6
apt-pkg/pkgcachegen.cc

@@ -864,12 +864,20 @@ bool pkgCacheGenerator::NewDepends(pkgCache::PkgIterator &Pkg,
    map_ptrloc index = 0;
    if (Version.empty() == false)
    {
-      void const * const oldMap = Map.Data();
-      index = WriteStringInMap(Version);
-      if (unlikely(index == 0))
-	 return false;
-      if (oldMap != Map.Data())
-	 OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+      int const CmpOp = Op & 0x0F;
+      // =-deps are used (79:1) for lockstep on same-source packages (e.g. data-packages)
+      if (CmpOp == pkgCache::Dep::Equals && strcmp(Version.c_str(), Ver.VerStr()) == 0)
+	 index = Ver->VerStr;
+
+      if (index == 0)
+      {
+	 void const * const oldMap = Map.Data();
+	 index = WriteStringInMap(Version);
+	 if (unlikely(index == 0))
+	    return false;
+	 if (oldMap != Map.Data())
+	    OldDepLast += (map_ptrloc*) Map.Data() - (map_ptrloc*) oldMap;
+      }
    }
    return NewDepends(Pkg, Ver, index, Op, Type, OldDepLast);
 }

+ 2 - 0
debian/changelog

@@ -8,6 +8,8 @@ apt (0.9.7.8~exp2+nmu1) UNRELEASED; urgency=low
     - handle language tags for descriptions are unique strings to be shared
     - factor version string creation out of NewDepends, so we can easily reuse
       version strings e.g. for implicit multi-arch dependencies
+    - equal comparisions are used mostly in same-source relations,
+      so use this to try to reuse some version strings
   * apt-pkg/deb/debversion.cc:
     - add a string-equal shortcut for equal version comparisions