diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2011-07-22 16:01:00 +0200 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2011-07-22 16:01:00 +0200 |
commit | 555a487afb510c561d094f27bb08119694e7388f (patch) | |
tree | 8b911f2ece6122e70b812628e598c9cccbf0e989 | |
parent | ce2de59157d5ac584005c76f58b277adcaf8e1ab (diff) | |
parent | a3bbbab7ca5f94391b2158cfe9deb85eb335e29a (diff) |
merged from donkult
-rw-r--r-- | apt-pkg/acquire.h | 2 | ||||
-rw-r--r-- | apt-pkg/policy.cc | 18 | ||||
-rw-r--r-- | cmdline/apt-get.cc | 3 | ||||
-rwxr-xr-x | cmdline/apt-key | 5 | ||||
-rw-r--r-- | debian/apt.postinst | 5 | ||||
-rw-r--r-- | debian/changelog | 11 | ||||
-rw-r--r-- | doc/apt-cache.8.xml | 2 | ||||
-rw-r--r-- | doc/po/apt-doc.pot | 2 | ||||
-rw-r--r-- | doc/po/de.po | 4 | ||||
-rw-r--r-- | doc/po/es.po | 2 | ||||
-rw-r--r-- | doc/po/fr.po | 2 | ||||
-rw-r--r-- | doc/po/ja.po | 4 | ||||
-rw-r--r-- | doc/po/pl.po | 4 | ||||
-rw-r--r-- | doc/po/pt.po | 4 | ||||
-rw-r--r-- | test/integration/framework | 23 | ||||
-rwxr-xr-x | test/integration/test-bug-407511-fail-invalid-default-release | 47 |
16 files changed, 117 insertions, 21 deletions
diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index e3a4435b8..9fe0e8a87 100644 --- a/apt-pkg/acquire.h +++ b/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(); diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index bd213e0ce..c5028d822 100644 --- a/apt-pkg/policy.cc +++ b/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(); } /*}}}*/ diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc index 99ee4f228..1e7fee96b 100644 --- a/cmdline/apt-get.cc +++ b/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()]; diff --git a/cmdline/apt-key b/cmdline/apt-key index 843163f82..8a995dadd 100755 --- a/cmdline/apt-key +++ b/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 diff --git a/debian/apt.postinst b/debian/apt.postinst index cc0d8b1fe..4d87c4e25 100644 --- a/debian/apt.postinst +++ b/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 ;; diff --git a/debian/changelog b/debian/changelog index c9d917407..1ceeebfc5 100644 --- a/debian/changelog +++ b/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 diff --git a/doc/apt-cache.8.xml b/doc/apt-cache.8.xml index 431ef8704..1393de015 100644 --- a/doc/apt-cache.8.xml +++ b/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 diff --git a/doc/po/apt-doc.pot b/doc/po/apt-doc.pot index 47a7c38d7..2a4eef558 100644 --- a/doc/po/apt-doc.pot +++ b/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> diff --git a/doc/po/de.po b/doc/po/de.po index dc4d34b81..196305bf9 100644 --- a/doc/po/de.po +++ b/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 diff --git a/doc/po/es.po b/doc/po/es.po index c8fdc9fed..ad7d02109 100644 --- a/doc/po/es.po +++ b/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> diff --git a/doc/po/fr.po b/doc/po/fr.po index 6e3977c43..f5273f639 100644 --- a/doc/po/fr.po +++ b/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> diff --git a/doc/po/ja.po b/doc/po/ja.po index 8a75af980..d27bc1b64 100644 --- a/doc/po/ja.po +++ b/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> diff --git a/doc/po/pl.po b/doc/po/pl.po index b74746ffc..6afced6cf 100644 --- a/doc/po/pl.po +++ b/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> diff --git a/doc/po/pt.po b/doc/po/pt.po index 6fd27a5c3..f0bfea56d 100644 --- a/doc/po/pt.po +++ b/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 diff --git a/test/integration/framework b/test/integration/framework index 96cdb5f5e..702e352a3 100644 --- a/test/integration/framework +++ b/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 diff --git a/test/integration/test-bug-407511-fail-invalid-default-release b/test/integration/test-bug-407511-fail-invalid-default-release new file mode 100755 index 000000000..d0a73af7d --- /dev/null +++ b/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* |