]> git.saurik.com Git - apt.git/commitdiff
parse version correctly from binary Source field
authorDavid Kalnischkies <david@kalnischkies.de>
Tue, 26 Jan 2016 18:17:11 +0000 (19:17 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Tue, 26 Jan 2016 18:17:11 +0000 (19:17 +0100)
In commit a221efc331693f8905da870141756c892911c433 I promoted the source
package name and version to the binary cache for faster access by e.g.
EDSP, but due to changing the interpretation length to soon we always
ignored the version part of the Source field, so that packages ended up
having the binary version as source version – which while usually just
fine it is wrong for binary rebuilds.

Closes: 812492
apt-pkg/deb/deblistparser.cc
apt-pkg/pkgcache.cc
test/integration/test-apt-get-source

index 090673db2a5a3b358550fda19b54751e3d58e50b..63343005b71b95925d89a96a9c8b2a64f40260ef 100644 (file)
@@ -154,7 +154,6 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
 
       if (Space != NULL)
       {
-        Stop = Space;
         const char * const Open = (const char * const) memchr(Space, '(', Stop - Space);
         if (likely(Open != NULL))
         {
@@ -169,6 +168,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
               }
            }
         }
+        Stop = Space;
       }
 
       std::string const pkgname(Start, Stop - Start);
index d6dd169bbb8dc6b05386e5157aa88ac8a3ea7d37..c9c338e1eff3370550a18d1072a91b0d4883385f 100644 (file)
@@ -59,7 +59,7 @@ pkgCache::Header::Header()
    /* Whenever the structures change the major version should be bumped,
       whenever the generator changes the minor version should be bumped. */
    APT_HEADER_SET(MajorVersion, 10);
-   APT_HEADER_SET(MinorVersion, 4);
+   APT_HEADER_SET(MinorVersion, 5);
    APT_HEADER_SET(Dirty, false);
 
    APT_HEADER_SET(HeaderSz, sizeof(pkgCache::Header));
index 27395ab3b91169fe49c2213ebe14efb64f6ff4fe..10a190b6c7865b472926b52f6cbe28b421048d4c 100755 (executable)
@@ -15,6 +15,12 @@ insertpackage 'wheezy' 'unreleated-package' 'all' '1.0'
 insertpackage 'unstable' 'foo' 'all' '2.0'
 insertsource 'unstable' 'foo' 'all' '2.0'
 
+# binary packages with Source-field
+insertpackage 'unstable' 'bin' 'i386' '3-2+b1' 'Source: bin (3-2)'
+insertsource 'unstable' 'bin' 'any' '3-2'
+insertpackage 'stable' 'bin' 'i386' '2-2+b1' 'Source: bin-backport (2-2)'
+insertsource 'stable' 'bin-backport' 'any' '2-2'
+
 # its possible to have multiple src versions in the sources file, ensure
 # to pick the correct one in this case (bts #731853)
 insertsource 'stable' 'foo' 'all' '1.5'
@@ -37,6 +43,7 @@ insertsource 'unstable' 'baz' 'all' '1.5'
 
 # ensure we really have the situation we wanted (first 2.0 is foo above)
 testequal 'Version: 2.0
+Version: 3-2
 Version: 2.0
 Version: 1.5' grep '^Version:' aptarchive/dists/unstable/main/source/Sources
 
@@ -137,3 +144,16 @@ git clone git://anonscm.debian.org/bar/bar.git -b debian/experimental
 to retrieve the latest (possibly unreleased) updates to the package.
 Need to get 0 B/25 B of source archives.
 Fetch source bar" aptget source bar -s
+
+testsuccessequal "$HEADER
+Need to get 0 B/25 B of source archives.
+Fetch source bin" aptget source bin -s -q
+testsuccessequal "$HEADER
+Selected version '3-2' (unstable) for bin
+Need to get 0 B/25 B of source archives.
+Fetch source bin" aptget source bin/unstable -s -q
+testsuccessequal "$HEADER
+Picking 'bin-backport' as source package instead of 'bin'
+Selected version '2-2' (stable) for bin-backport
+Need to get 0 B/43 B of source archives.
+Fetch source bin-backport" aptget source bin/stable -s -q