]> git.saurik.com Git - apt.git/commitdiff
add test, deal with InRelease
authorMichael Vogt <mvo@debian.org>
Wed, 4 Dec 2013 06:58:37 +0000 (07:58 +0100)
committerMichael Vogt <mvo@debian.org>
Wed, 4 Dec 2013 07:07:00 +0000 (08:07 +0100)
cmdline/apt-get.cc
test/integration/test-apt-get-source [new file with mode: 0755]

index 2370318e872c187ddf7b949a68dc44b9f4399ac3..3003c19713d103671077895847346206e32f0897 100644 (file)
@@ -293,7 +293,10 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
                if (&SI == (*IF))
                {
                   std::string dirname = _config->FindDir("Dir::State::lists");
                if (&SI == (*IF))
                {
                   std::string dirname = _config->FindDir("Dir::State::lists");
-                  std::string path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release";
+                  std::string path;
+                  path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_Release";
+                  if (!FileExists(path))
+                     path = dirname + URItoFileName((*S)->GetURI()) + "dists_" + (*S)->GetDist() + "_InRelease";
                   indexRecords records;
                   records.Load(path);
                   if (records.GetSuite() == DefRel)
                   indexRecords records;
                   records.Load(path);
                   if (records.GetSuite() == DefRel)
@@ -327,7 +330,6 @@ pkgSrcRecords::Parser *FindSrc(const char *Name,pkgRecords &Recs,
         // was the version check above an exact match? If so, we don't need to look further
          if (VerTag.empty() == false && (VerTag == Ver))
          {
         // was the version check above an exact match? If so, we don't need to look further
          if (VerTag.empty() == false && (VerTag == Ver))
          {
-            std::cerr << "meep" << std::endl;
            break;
          }
       }
            break;
          }
       }
diff --git a/test/integration/test-apt-get-source b/test/integration/test-apt-get-source
new file mode 100755 (executable)
index 0000000..d2b8dea
--- /dev/null
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# we need to insert a package into "unstable" so that a Release file is
+# create for the test
+insertpackage 'wheezy' 'unreleated-package' 'all' '1.0'
+
+# a "normal" package with source and binary
+insertpackage 'unstable' 'foo' 'all' '2.0'
+insertsource 'unstable' 'foo' 'all' '2.0'
+
+insertpackage 'stable' 'foo' 'all' '1.0'
+insertsource 'stable' 'foo' 'all' '1.0'
+
+# this package exists only as source
+insertsource 'wheezy' 'foo' 'all' '0.1'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+# normal operation gets highest version number
+testequal "'file://${APTARCHIVE}/foo_2.0.dsc' foo_2.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_2.0.tar.gz' foo_2.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo
+
+# select by release
+testequal "Selectied version '1.0' (stable) for foo
+'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/stable
+
+# select by version
+testequal "'file://${APTARCHIVE}/foo_1.0.dsc' foo_1.0.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_1.0.tar.gz' foo_1.0.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo=1.0
+
+# select by release with no binary package (Bug#731102)
+testequal "Selectied version '0.1' (wheezy) for foo
+'file://${APTARCHIVE}/foo_0.1.dsc' foo_0.1.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/foo_0.1.tar.gz' foo_0.1.tar.gz 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qq --print-uris foo/wheezy
+