summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Clarke <jrtc27@jrtc27.com>2016-11-11 16:33:25 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2016-11-11 23:40:39 +0100
commita658ffbf1911ae9b9838615d0a60f4613e642553 (patch)
tree714a30f2b7c343ac1bdeee3c629def1a106b99a9 /test
parent7434f15cb688f3a394accba2ce10615adcb9c48a (diff)
apt-ftparchive: Support NotAutomatic and ButAutomaticUpgrades fields
This also changes Acquire-By-Hash to be "yes" rather than "true", so it is consistent with dak's output. Closes: #272557
Diffstat (limited to 'test')
-rw-r--r--test/integration/framework14
-rwxr-xr-xtest/integration/test-apt-ftparchive-by-hash2
-rwxr-xr-xtest/integration/test-apt-ftparchive-notautomatic54
3 files changed, 65 insertions, 5 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 0222f2bc9..9a114ae69 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -1053,6 +1053,12 @@ getreleaseversionfromsuite() { true; }
getlabelfromsuite() { true; }
getoriginfromsuite() { true; }
getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; }
+getnotautomaticfromsuite() {
+ case "$1" in
+ experimental|experimental2) echo "yes";;
+ esac
+}
+getbutautomaticupgradesfromsuite() { true; }
aptftparchiverelease() {
aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference
@@ -1071,6 +1077,8 @@ generatereleasefiles() {
local VERSION="$(getreleaseversionfromsuite $SUITE)"
local LABEL="$(getlabelfromsuite $SUITE)"
local ORIGIN="$(getoriginfromsuite $SUITE)"
+ local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)"
+ local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)"
aptftparchiverelease "$dir" \
-o APT::FTPArchive::Release::Suite="${SUITE}" \
-o APT::FTPArchive::Release::Codename="${CODENAME}" \
@@ -1078,11 +1086,9 @@ generatereleasefiles() {
-o APT::FTPArchive::Release::Label="${LABEL}" \
-o APT::FTPArchive::Release::Origin="${ORIGIN}" \
-o APT::FTPArchive::Release::Version="${VERSION}" \
+ -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \
+ -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \
> "$dir/Release"
- if [ "$SUITE" = "experimental" -o "$SUITE" = "experimental2" ]; then
- sed -i '/^Date: / a\
-NotAutomatic: yes' "$dir/Release"
- fi
done
else
msgninfo "\tGenerate Release files for flat… "
diff --git a/test/integration/test-apt-ftparchive-by-hash b/test/integration/test-apt-ftparchive-by-hash
index d08b94290..75fb0cf2c 100755
--- a/test/integration/test-apt-ftparchive-by-hash
+++ b/test/integration/test-apt-ftparchive-by-hash
@@ -46,7 +46,7 @@ verify_by_hash
testsuccess stat aptarchive/dists/unstable/main/binary-i386/by-hash/SHA256/$previous_hash
# ensure we have it in the Release file
-testsuccess grep "Acquire-By-Hash: true" aptarchive/dists/unstable/*Release
+testsuccess grep "Acquire-By-Hash: yes" aptarchive/dists/unstable/*Release
# now ensure gc work
for i in $(seq 3); do
diff --git a/test/integration/test-apt-ftparchive-notautomatic b/test/integration/test-apt-ftparchive-notautomatic
new file mode 100755
index 000000000..b2f65cc18
--- /dev/null
+++ b/test/integration/test-apt-ftparchive-notautomatic
@@ -0,0 +1,54 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'i386'
+
+getnotautomaticfromsuite() {
+ case "$1" in
+ experimental|backports) echo 'yes';;
+ esac
+}
+getbutautomaticupgradesfromsuite() {
+ case "$1" in
+ backports) echo 'yes';;
+ esac
+}
+
+insertpackage 'unstable' 'foo' 'i386' '1'
+insertpackage 'backports' 'foo' 'i386' '3~bpo1'
+insertpackage 'experimental' 'foo' 'i386' '3'
+setupaptarchive
+
+# check no unstable NotAutomatic field
+testfailure grep "NotAutomatic:" aptarchive/dists/unstable/*Release
+# check backports NotAutomatic field
+testsuccess grep "NotAutomatic: yes" aptarchive/dists/backports/*Release
+# check experimental NotAutomatic field
+testsuccess grep "NotAutomatic: yes" aptarchive/dists/experimental/*Release
+
+# check no unstable ButAutomaticUpgrades field
+testfailure grep "ButAutomaticUpgrades:" aptarchive/dists/unstable/*Release
+# check backports ButAutomaticUpgrades field
+testsuccess grep "ButAutomaticUpgrades: yes" aptarchive/dists/backports/*Release
+# check no experimental ButAutomaticUpgrades field
+testfailure grep "ButAutomaticUpgrades:" aptarchive/dists/experimental/*Release
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ foo
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst foo (1 unstable [i386])
+Conf foo (1 unstable [i386])' apt install foo -s
+
+insertinstalledpackage 'foo' 'i386' '2'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following packages will be upgraded:
+ foo
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst foo [2] (3~bpo1 backports [i386])
+Conf foo (3~bpo1 backports [i386])' apt install foo -s