From 285feb3cedca3cccff971155099adef8d902223d Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 16 Jul 2011 14:21:51 +0200 Subject: * 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 --- cmdline/apt-key | 5 ++++- debian/apt.postinst | 5 +++++ debian/changelog | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) 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 2e22e64d8..914c53801 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,8 +21,12 @@ apt (0.8.15.3) UNRELEASED; urgency=low - 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 - -- David Kalnischkies Fri, 15 Jul 2011 09:29:37 +0200 + -- David Kalnischkies Sat, 16 Jul 2011 14:19:51 +0200 apt (0.8.15.2) unstable; urgency=high -- cgit v1.2.3 From 22eeef1809dae0594eca961783b1f809f4d539f7 Mon Sep 17 00:00:00 2001 From: John Feuerstein Date: Sat, 16 Jul 2011 14:37:52 +0200 Subject: * doc/apt-cache.8.xml: - apply madison typofix from John Feuerstein, thanks! (Closes: #633455) --- debian/changelog | 4 +++- doc/apt-cache.8.xml | 2 +- doc/po/apt-doc.pot | 2 +- doc/po/de.po | 4 ++-- doc/po/es.po | 2 +- doc/po/fr.po | 2 +- doc/po/ja.po | 4 ++-- doc/po/pl.po | 4 ++-- doc/po/pt.po | 4 ++-- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/debian/changelog b/debian/changelog index 914c53801..a51a90b90 100644 --- a/debian/changelog +++ b/debian/changelog @@ -25,8 +25,10 @@ apt (0.8.15.3) UNRELEASED; urgency=low - 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) - -- David Kalnischkies Sat, 16 Jul 2011 14:19:51 +0200 + -- David Kalnischkies Sat, 16 Jul 2011 14:28:53 +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. - madison /[ pkg(s) ] + madison [ pkg(s) ] apt-cache's madison command attempts to mimic the output format and a subset of the functionality of the Debian archive management tool, madison. 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" +msgid "madison [ pkg(s) ]" msgstr "" #. type: Content of: 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" -msgstr "madison /[ Paket(e) ]" +msgid "madison [ pkg(s) ]" +msgstr "madison [ Paket(e) ]" #. type: Content of: #: 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" +msgid "madison [ pkg(s) ]" msgstr "madison [ paquete(s) ]" #. type: Content of: 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" +msgid "madison [ pkg(s) ]" msgstr "madison [ paquet(s) ]" #. type: Content of: 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: #. type: Content of: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" -msgstr "madison /[ pkg(s) ]" +msgid "madison [ pkg(s) ]" +msgstr "madison [ pkg(s) ]" # type: Content of: #. type: Content of: 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" -msgstr "madison /[ pakiet(y) ]" +msgid "madison [ pkg(s) ]" +msgstr "madison [ pakiet(y) ]" # #. type: Content of: 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: #: apt-cache.8.xml:266 -msgid "madison /[ pkg(s) ]" -msgstr "madison /[ pacote(s) ]" +msgid "madison [ pkg(s) ]" +msgstr "madison [ pacote(s) ]" #. type: Content of: #: apt-cache.8.xml:267 -- cgit v1.2.3 From 4a53151acad0c4ccfbcf4ce11c5c2d7cffd05de3 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 16 Jul 2011 14:57:37 +0200 Subject: do not require unused partial dirs in 'source' (Closes: #633510) --- apt-pkg/acquire.h | 2 ++ cmdline/apt-get.cc | 3 +-- debian/changelog | 3 ++- 3 files changed, 5 insertions(+), 3 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/cmdline/apt-get.cc b/cmdline/apt-get.cc index 3292ae745..748ebe6ab 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/debian/changelog b/debian/changelog index a51a90b90..a834bca91 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,7 @@ 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: @@ -28,7 +29,7 @@ apt (0.8.15.3) UNRELEASED; urgency=low * doc/apt-cache.8.xml: - apply madison typofix from John Feuerstein, thanks! (Closes: #633455) - -- David Kalnischkies Sat, 16 Jul 2011 14:28:53 +0200 + -- David Kalnischkies Sat, 16 Jul 2011 14:55:03 +0200 apt (0.8.15.2) unstable; urgency=high -- cgit v1.2.3 From a3bbbab7ca5f94391b2158cfe9deb85eb335e29a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 16 Jul 2011 16:48:03 +0200 Subject: * apt-pkg/policy.cc: - emit an error on unknown APT::Default-Release value (Closes: #407511) --- apt-pkg/policy.cc | 18 ++++++++- debian/changelog | 4 +- test/integration/framework | 23 +++++++++-- .../test-bug-407511-fail-invalid-default-release | 47 ++++++++++++++++++++++ 4 files changed, 86 insertions(+), 6 deletions(-) create mode 100755 test/integration/test-bug-407511-fail-invalid-default-release 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/debian/changelog b/debian/changelog index a834bca91..607f7c64a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -28,8 +28,10 @@ apt (0.8.15.3) UNRELEASED; urgency=low - 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 Sat, 16 Jul 2011 14:55:03 +0200 + -- David Kalnischkies Sat, 16 Jul 2011 16:43:37 +0200 apt (0.8.15.2) unstable; urgency=high 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* -- cgit v1.2.3