]> git.saurik.com Git - apt.git/commitdiff
Merge remote-tracking branch 'mvo/feature/srv-records' into debian/experimental
authorMichael Vogt <mvo@debian.org>
Thu, 20 Aug 2015 10:05:49 +0000 (12:05 +0200)
committerMichael Vogt <mvo@debian.org>
Thu, 20 Aug 2015 10:05:49 +0000 (12:05 +0200)
apt-pkg/sourcelist.cc
apt-private/private-cmndline.cc
cmdline/apt-cache.cc
cmdline/apt-get.cc
doc/apt-cache.8.xml
test/integration/framework
test/integration/test-apt-cache-showsrc [new file with mode: 0755]
test/integration/test-apt-sources-deb822

index 3e714667c63d07814594db9ff1dc463f3412ef44..d3bcbce5fb1953da42658b83fdf3c174cc5df189 100644 (file)
@@ -384,7 +384,7 @@ bool pkgSourceList::ParseFileOldStyle(std::string const &File)
         continue;
 
       // Grok it
-      std::string const LineType = Buffer.substr(0, Buffer.find(' '));
+      std::string const LineType = Buffer.substr(0, Buffer.find_first_of(" \t\v"));
       if (LineType.empty() || LineType == Buffer)
         return _error->Error(_("Malformed line %u in source list %s (type)"),CurLine,File.c_str());
 
index 3a1564b238ab0f5d321fa3b37e3e11ead38f80c4..1072b9a78b0d113fb8389c3c47d619302cc28603 100644 (file)
@@ -70,7 +70,11 @@ static bool addArgumentsAPTCache(std::vector<CommandLine::Args> &Args, char cons
    {
       addArg('i', "important", "APT::Cache::Important", 0);
    }
-   else if (CmdMatches("gencaches", "showsrc", "showpkg", "stats", "dump",
+   else if (CmdMatches("showsrc"))
+   {
+      addArg(0,"only-source","APT::Cache::Only-Source",0);
+   }
+   else if (CmdMatches("gencaches", "showpkg", "stats", "dump",
            "dumpavail", "showauto", "policy", "madison"))
       ;
    else
index f7abb823d6d671befb1847f56b4580af4ccc0f29..050508663ef3464b2bfc566afe9b68c6f1d1c070 100644 (file)
@@ -1607,6 +1607,10 @@ static bool ShowSrcPackage(CommandLine &CmdL)
       pkgSrcRecords::Parser *Parse;
       unsigned found_this = 0;
       while ((Parse = SrcRecs.Find(*I,false)) != 0) {
+         // SrcRecs.Find() will find both binary and source names
+         if (_config->FindB("APT::Cache::Only-Source", false) == true)
+            if (Parse->Package() != *I)
+               continue;
         cout << Parse->AsStr() << endl;;
         found++;
         found_this++;
index acf6c21555749a73030ae9e8a32505199e91c698..b1260f06a4ebb7c76bed48b3c7ebd85c08b934cc 100644 (file)
@@ -1649,6 +1649,7 @@ int main(int argc,const char *argv[])                                     /*{{{*/
                                   {"markauto",&DoMarkAuto},
                                   {"unmarkauto",&DoMarkAuto},
                                    {"dist-upgrade",&DoDistUpgrade},
+                                   {"full-upgrade",&DoDistUpgrade},
                                    {"dselect-upgrade",&DoDSelectUpgrade},
                                   {"build-dep",&DoBuildDep},
                                    {"clean",&DoClean},
index a8f1b45867ee83e9c46a601186420162cc1b2932..b649149af716acb08e284eb5ba14e60211e24af1 100644 (file)
@@ -135,9 +135,12 @@ Reverse Provides:
      </varlistentry>
      
      <varlistentry><term><option>showsrc</option> <option><replaceable>&synopsis-pkg;</replaceable>…</option></term>
-     <listitem><para><literal>showsrc</literal> displays all the source package records that match
-     the given package names. All versions are shown, as well as all 
-     records that declare the name to be a binary package.</para></listitem>
+     <listitem><para><literal>showsrc</literal> displays all the
+     source package records that match the given package names. All
+     versions are shown, as well as all records that declare the name
+     to be a binary package. Use <option>--only-source</option> to
+     display only source package names.
+     </para></listitem>
      </varlistentry>
      
      <varlistentry><term><option>dump</option></term>
index b443f2a7b48432d03901fe37f7e1d991f8513b38..d9282eedeac118ad3aa42ac3bb02f1d4b37c9a14 100644 (file)
@@ -794,6 +794,7 @@ insertsource() {
        local ARCH="$3"
        local VERSION="$4"
        local DEPENDENCIES="$5"
+        local BINARY="${6:-$NAME}"
        local ARCHS=""
        local SPATH="aptarchive/dists/${RELEASE}/main/source"
        mkdir -p $SPATH
@@ -801,7 +802,7 @@ insertsource() {
        local DSCFILE="${NAME}_${VERSION}.dsc"
        local TARFILE="${NAME}_${VERSION}.tar.gz"
        echo "Package: $NAME
-Binary: $NAME
+Binary: $BINARY
 Version: $VERSION
 Maintainer: Joe Sixpack <joe@example.org>
 Architecture: $ARCH" >> $FILE
diff --git a/test/integration/test-apt-cache-showsrc b/test/integration/test-apt-cache-showsrc
new file mode 100755 (executable)
index 0000000..319b4f2
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# we have a foo source package
+insertsource 'unstable' 'foo' 'all' '1.0' '' 'foo-binary'
+
+# and a similar one that builds a foo binary package
+insertsource 'unstable' 'unreleated' 'all' '1.0' '' 'foo'
+
+# just here to workaround the need for a authenticated package
+insertpackage 'unstable' 'workaround' 'all' '1.0'
+
+setupaptarchive
+
+# by default apt-cache showsrc will look into "binary" and "source" names
+# and show all matches
+aptcache showsrc foo > output.txt
+testsuccess grep "Package: foo" output.txt
+testsuccess grep "Package: unreleated" output.txt
+
+# by default apt-cache showsrc will look into "binary" and "source" names
+# and show all matches
+aptcache showsrc --only-source foo > output.txt
+testsuccess grep "Package: foo" output.txt
+testfailure grep "Package: unreleated" output.txt
index adfe0e0037e1ffc5e87b4d1f12d8f8218a8a49db..259763096e7a61be52d11131b50964835034e1a7 100755 (executable)
@@ -31,6 +31,12 @@ testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.deb
 'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
 'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
 
+msgcleantest 'Test sources.list' 'old style with tabs'
+echo "deb      http://ftp.debian.org/debian    stable main" > $LISTS
+testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0 
+'http://ftp.debian.org/debian/dists/stable/main/binary-i386/Packages.bz2' ftp.debian.org_debian_dists_stable_main_binary-i386_Packages 0 
+'http://ftp.debian.org/debian/dists/stable/main/i18n/Translation-en.bz2' ftp.debian.org_debian_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
+
 msgcleantest 'Test sources.list' 'old style with options'
 echo "deb [trusted=yes arch+=armel,powerpc] http://ftp.debian.org/debian stable main" > $LISTS
 testequal --nomsg "'http://ftp.debian.org/debian/dists/stable/InRelease' ftp.debian.org_debian_dists_stable_InRelease 0