summaryrefslogtreecommitdiff
path: root/test/integration
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-05-28 19:18:30 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-06-26 23:31:15 +0200
commitd7c92411dc1f4c6be098d1425f9c1c075e0c2154 (patch)
tree39913a1c7c7d18639057cdbab2cc8fe2f025465b /test/integration
parent07815d4edc99585967b9f267e6f37c37008dcba5 (diff)
warn if an expected file can't be acquired
If we couldn't find an entry for a Sources file we would generate an error while for a Packages file we would silently skip it due to assuming it is missing because it is empty. We can do better by checking if the repository declares that it supports a component we want to get the file from and if not say so and hint at the user making a typo. An example were this helps is mozilla.debian.net which dropped the firefox-aurora component (as upstream did) meaning no upgrades until the user notices manually that the repository doesn't provide packages anymore. With this commit warnings are raised hopefully causing the user to investigate what is wrong (sooner).
Diffstat (limited to 'test/integration')
-rwxr-xr-xtest/integration/test-acquire-binary-all4
-rwxr-xr-xtest/integration/test-apt-update-disappeared-component39
2 files changed, 41 insertions, 2 deletions
diff --git a/test/integration/test-acquire-binary-all b/test/integration/test-acquire-binary-all
index ba47eddc2..379348e3f 100755
--- a/test/integration/test-acquire-binary-all
+++ b/test/integration/test-acquire-binary-all
@@ -114,9 +114,9 @@ testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1
foo-2' aptcache pkgnames foo-
-# apt doesn't know supported archs, so missing a configured arch is a failure
+# apt doesn't know supported archs, so missing a configured arch is a problem
configarchitecture 'amd64' 'i386'
-testfailure apt update
+testwarningmsg "W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' does not seem to provide it (sources.list entry misspelt?)" apt update
testequal 'foo-1
foo-2' aptcache pkgnames foo-
diff --git a/test/integration/test-apt-update-disappeared-component b/test/integration/test-apt-update-disappeared-component
new file mode 100755
index 000000000..d38405bc2
--- /dev/null
+++ b/test/integration/test-apt-update-disappeared-component
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'foobar' 'all' '1'
+
+APTARCHIVE="file:$(readlink -f ./aptarchive) unstable InRelease"
+setupaptarchive --no-update
+sed -i -e 's#main\s*$#main contrib non-free#' rootdir/etc/apt/sources.list.d/*
+
+# if no Component info is available we assume all are supported, which means
+# that non-existent Packages files are assumed to be missing because they are
+# empty (as the repository is declaring support for them via Architectures)
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)" apt update
+
+sed -i -e '/^Codename: / a\
+Components: main contrib' $(find ./aptarchive -name 'Release')
+signreleasefiles
+
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-amd64/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-all/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/i18n/Translation-en' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)" apt update
+
+# the field looks like this e.g. for security.debian.org sources
+sed -i -e 's#^Components:.*$#Components: updates/main updates/contrib#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-amd64/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-all/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/i18n/Translation-en' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)" apt update