Przeglądaj źródła

merged from donkult

Michael Vogt 15 lat temu
rodzic
commit
555a487afb

+ 2 - 0
apt-pkg/acquire.h

@@ -348,6 +348,8 @@ class pkgAcquire
     */
    bool Setup(pkgAcquireStatus *Progress = NULL, string const &Lock = "");
 
+   void SetLog(pkgAcquireStatus *Progress) { Log = Progress; }
+
    /** \brief Construct a new pkgAcquire. */
    pkgAcquire(pkgAcquireStatus *Log) __deprecated;
    pkgAcquire();

+ 16 - 2
apt-pkg/policy.cc

@@ -56,8 +56,22 @@ pkgPolicy::pkgPolicy(pkgCache *Owner) : Pins(0), PFPriority(0), Cache(Owner)
    // The config file has a master override.
    string DefRel = _config->Find("APT::Default-Release");
    if (DefRel.empty() == false)
-      CreatePin(pkgVersionMatch::Release,"",DefRel,990);
-      
+   {
+      bool found = false;
+      // FIXME: make ExpressionMatches static to use it here easily
+      pkgVersionMatch vm("", pkgVersionMatch::None);
+      for (pkgCache::PkgFileIterator F = Cache->FileBegin(); F != Cache->FileEnd(); ++F)
+      {
+	 if ((F->Archive != 0 && vm.ExpressionMatches(DefRel, F.Archive()) == true) ||
+	     (F->Codename != 0 && vm.ExpressionMatches(DefRel, F.Codename()) == true) ||
+	     (F->Version != 0 && vm.ExpressionMatches(DefRel, F.Version()) == true))
+	    found = true;
+      }
+      if (found == false)
+	 _error->Error(_("The value '%s' is invalid for APT::Default-Release as such a release is not available in the sources"), DefRel.c_str());
+      else
+	 CreatePin(pkgVersionMatch::Release,"",DefRel,990);
+   }
    InitDefaults();
 }
 									/*}}}*/

+ 1 - 2
cmdline/apt-get.cc

@@ -2366,8 +2366,7 @@ bool DoSource(CommandLine &CmdL)
    // Create the download object
    AcqTextStatus Stat(ScreenWidth,_config->FindI("quiet",0));   
    pkgAcquire Fetcher;
-   if (Fetcher.Setup(&Stat) == false)
-      return false;
+   Fetcher.SetLog(&Stat);
 
    DscFile *Dsc = new DscFile[CmdL.FileSize()];
    

+ 4 - 1
cmdline/apt-key

@@ -5,9 +5,12 @@ unset GREP_OPTIONS
 
 # We don't use a secret keyring, of course, but gpg panics and
 # implodes if there isn't one available
-GPG_CMD='gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring /etc/apt/secring.gpg'
+SECRETKEYRING="$(mktemp)"
+trap "rm -f '${SECRETKEYRING}'" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring '${SECRETKEYRING}'"
 
 if [ "$(id -u)" -eq 0 ]; then
+	# we could use a tmpfile here too, but creation of this tends to be time-consuming
 	GPG_CMD="$GPG_CMD --trustdb-name /etc/apt/trustdb.gpg"
 fi
 

+ 5 - 0
debian/apt.postinst

@@ -15,6 +15,11 @@ set -e
 
 case "$1" in
     configure)
+	SECRING='/etc/apt/secring.gpg'
+	# test if secring is an empty normal file
+	if test -f $SECRING -a ! -s $SECRING; then
+		rm -f $SECRING
+	fi
 	apt-key update
     ;;
 

+ 10 - 1
debian/changelog

@@ -19,12 +19,21 @@ apt (0.8.15.3) UNRELEASED; urgency=low
     - document APT::Architectures list (Closes: #612102)
   * cmdline/apt-get.cc:
     - restore all important dependencies for garbage packages (LP: #806274)
+    - do not require unused partial dirs in 'source' (Closes: #633510)
   * apt-pkg/init.cc:
     - use CndSet in pkgInitConfig (Closes: #629617)
   * apt-pkg/depcache.cc:
     - change default of APT::AutoRemove::SuggestsImportant to true
+  * cmdline/apt-key:
+    - use a tmpfile instead of /etc/apt/secring.gpg (Closes: #632596)
+  * debian/apt.postinst:
+    - remove /etc/apt/secring.gpg if it is an empty file
+  * doc/apt-cache.8.xml:
+    - apply madison typofix from John Feuerstein, thanks! (Closes: #633455)
+  * apt-pkg/policy.cc:
+    - emit an error on unknown APT::Default-Release value (Closes: #407511)
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Fri, 15 Jul 2011 09:29:37 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sat, 16 Jul 2011 16:43:37 +0200
 
 apt (0.8.15.2) unstable; urgency=high
 

+ 1 - 1
doc/apt-cache.8.xml

@@ -263,7 +263,7 @@ Reverse Provides:
      about the priority selection of the named package.</para></listitem>
      </varlistentry>
 
-     <varlistentry><term>madison <replaceable>/[ pkg(s) ]</replaceable></term>
+     <varlistentry><term>madison <replaceable>[ pkg(s) ]</replaceable></term>
      <listitem><para><literal>apt-cache</literal>'s <literal>madison</literal> command attempts to mimic
      the output format and a subset of the functionality of the Debian
      archive management tool, <literal>madison</literal>.  It displays

+ 1 - 1
doc/po/apt-doc.pot

@@ -928,7 +928,7 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/de.po

@@ -1230,8 +1230,8 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ Paket(e) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ Paket(e) ]</replaceable>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:267

+ 1 - 1
doc/po/es.po

@@ -1303,7 +1303,7 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquete(s) ]</replaceable>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 1 - 1
doc/po/fr.po

@@ -1225,7 +1225,7 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
 msgstr "madison <replaceable>[ paquet(s) ]</replaceable>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/ja.po

@@ -1304,8 +1304,8 @@ msgstr ""
 # type: Content of: <refentry><refsect1><refsect2><para><programlisting>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pkg(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pkg(s) ]</replaceable>"
 
 # type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/pl.po

@@ -1311,8 +1311,8 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pakiet(y) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pakiet(y) ]</replaceable>"
 
 #
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>

+ 2 - 2
doc/po/pt.po

@@ -1255,8 +1255,8 @@ msgstr ""
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><term>
 #: apt-cache.8.xml:266
-msgid "madison <replaceable>/[ pkg(s) ]</replaceable>"
-msgstr "madison <replaceable>/[ pacote(s) ]</replaceable>"
+msgid "madison <replaceable>[ pkg(s) ]</replaceable>"
+msgstr "madison <replaceable>[ pacote(s) ]</replaceable>"
 
 #. type: Content of: <refentry><refsect1><variablelist><varlistentry><listitem><para>
 #: apt-cache.8.xml:267

+ 20 - 3
test/integration/framework

@@ -481,6 +481,10 @@ buildaptarchivefromfiles() {
 	generatereleasefiles
 }
 
+# can be overridden by testcases for their pleasure
+getcodenamefromsuite() { echo -n "$1"; }
+getreleaseversionfromsuite() { true; }
+
 generatereleasefiles() {
 	msgninfo "\tGenerate Release files… "
 	local DATE="${1:-now}"
@@ -489,9 +493,22 @@ generatereleasefiles() {
 			aptftparchive -qq release $dir -o APT::FTPArchive::Release::Patterns::='Translation-*' > $dir/Index
 		done
 		for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do
-			local CODENAME="$(echo "$dir" | cut -d'/' -f 4)"
-			aptftparchive -qq release $dir -o APT::FTPArchive::Release::Suite="${CODENAME}" -o APT::FTPArchive::Release::Codename="${CODENAME}" | sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
-			if [ "$CODENAME" = "experimental" -o "$CODENAME" = "experimental2" ]; then
+			local SUITE="$(echo "$dir" | cut -d'/' -f 4)"
+			local CODENAME="$(getcodenamefromsuite $SUITE)"
+			local VERSION="$(getreleaseversionfromsuite $SUITE)"
+			if [ -z "$VERSION" ]; then
+				aptftparchive -qq release $dir \
+					-o APT::FTPArchive::Release::Suite="${SUITE}" \
+					-o APT::FTPArchive::Release::Codename="${CODENAME}" \
+						| sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
+			else
+				aptftparchive -qq release $dir \
+					-o APT::FTPArchive::Release::Suite="${SUITE}" \
+					-o APT::FTPArchive::Release::Codename="${CODENAME}" \
+					-o APT::FTPArchive::Release::Version="${VERSION}" \
+						| sed -e '/0 Release$/ d' > $dir/Release # remove the self reference
+			fi
+			if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
 				sed -i '/^Date: / a\
 NotAutomatic: yes' $dir/Release
 			fi

+ 47 - 0
test/integration/test-bug-407511-fail-invalid-default-release

@@ -0,0 +1,47 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'cool' 'all' '1.0-1'
+
+getcodenamefromsuite() {
+	if [ "$SUITE" = 'unstable' ]; then
+		echo -n 'sid'
+	else
+		echo -n "$SUITE"
+	fi
+}
+getreleaseversionfromsuite() {
+	if [ "$SUITE" = 'unstable' ]; then
+		echo -n '42.0'
+	else
+		echo -n '0.8.15'
+	fi
+}
+
+setupaptarchive
+
+passdist() {
+	msgtest "Test that target-release is accepted" $1
+	aptget dist-upgrade -t $1 -qq && msgpass || msgfail
+}
+
+faildist() {
+	msgtest "Test that target-release is refused" $1
+	aptget dist-upgrade -t $1 -qq 2> /dev/null && msgfail || msgpass
+}
+
+passdist unstable
+passdist sid
+faildist sidd
+faildist stable
+passdist 42.0
+passdist 42.*
+passdist 42*
+passdist 4*.0
+faildist 21.0
+faildist 21*