From a628ca5256b4a2f3ae300697b17adf150b6e17b0 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 27 Dec 2015 17:04:33 +0100 Subject: allow repositories to forbid arch:all for specific index targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Debian has a Packages file for arch:all already, but the arch:any files contain arch:all packages as well, so downloading it would be a total waste of resources. Getting this solved is on the list of things to do, but it is also the hardest part – for index targets like Contents the situation is much easier and less server/client implementations are involved so we might not want to stall them. A repository can now declare via: No-Support-for-Architecture-all: Packages that even if an arch:all Packages exists, it shouldn't be downloaded, so that support for Contents files can be added now. See also 1dd20368486820efb6ef4476ad739e967174bec4 for the implementation of downloading arch:all index targets, which this is limiting. The field uses the name of the target from the apt configuration for simplicity and is negative by design as this field is intended to be supported/needed only for a "short" time (one or two Debian releases). While this commit theoretically supports any target, its expected to only see "Packages" as a value in reality. --- test/integration/test-acquire-binary-all | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test') diff --git a/test/integration/test-acquire-binary-all b/test/integration/test-acquire-binary-all index 49bbc714e..d428c106d 100755 --- a/test/integration/test-acquire-binary-all +++ b/test/integration/test-acquire-binary-all @@ -10,15 +10,26 @@ buildsimplenativepackage 'foo-1' 'all' '2' 'unstable' buildsimplenativepackage 'foo-2' 'amd64' '2' 'unstable' setupaptarchive --no-update +cat >rootdir/etc/apt/apt.conf.d/get-contents < lists.before testsuccess grep '_binary-all_Packages' lists.before +testsuccess grep '_Contents-all\.' lists.before configarchitecture 'amd64' 'i386' testsuccessequal "All packages are up to date. @@ -27,20 +38,35 @@ testfileequal lists.before "$(listcurrentlistsdirectory)" testequal 'foo-1 foo-2' aptcache pkgnames foo- +rm -rf rootdir/var/lib/apt/lists +msgmsg 'Releasefile has all, but forbids its usage' +configarchitecture 'amd64' +sed -i '/^Architectures: / a\ +No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') +signreleasefiles +testsuccess apt update +cp rootdir/tmp/testsuccess.output aptupdate.output +testfailure grep '^Get.* all Packages ' aptupdate.output +testsuccess grep '^Get.* all Contents ' aptupdate.output +sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') + rm -rf rootdir/var/lib/apt/lists msgmsg 'Releasefile with Architectures field but without all' +configarchitecture 'amd64' 'i386' getarchitecturesfromreleasefile() { echo "$(getarchitectures)"; } generatereleasefiles signreleasefiles testsuccessequal 'All packages are up to date.' apt update -o quiet::NoProgress=1 cp rootdir/tmp/testsuccess.output aptupdate.output testfailure grep '^Get.* all Packages ' aptupdate.output +testfailure grep '^Get.* all Contents ' aptupdate.output testequal 'foo-2' aptcache pkgnames foo- configarchitecture 'amd64' testsuccess apt update cp rootdir/tmp/testsuccess.output aptupdate.output testfailure grep '^Get.* all Packages ' aptupdate.output +testfailure grep '^Get.* all Contents ' aptupdate.output testequal 'foo-2' aptcache pkgnames foo- rm -rf rootdir/var/lib/apt/lists @@ -48,9 +74,11 @@ msgmsg 'Releasefile without Architectures field' getarchitecturesfromreleasefile() { echo -n ''; } generatereleasefiles signreleasefiles +testfailure grep '^Architectures: ' $(find ./aptarchive -name 'Release') testsuccess apt update cp rootdir/tmp/testsuccess.output aptupdate.output testsuccess grep '^Get.* all Packages ' aptupdate.output +testsuccess grep '^Get.* all Contents ' aptupdate.output testequal 'foo-1 foo-2' aptcache pkgnames foo- @@ -60,6 +88,18 @@ testfailure apt update testequal 'foo-1 foo-2' aptcache pkgnames foo- +rm -rf rootdir/var/lib/apt/lists +msgmsg 'Releasefile no Architectures all, but forbids its usage' +configarchitecture 'amd64' +sed -i '/^Date: / a\ +No-Support-for-Architecture-all: Packages' $(find ./aptarchive -name 'Release') +signreleasefiles +testsuccess apt update +cp rootdir/tmp/testsuccess.output aptupdate.output +testfailure grep '^Get.* all Packages ' aptupdate.output +testsuccess grep '^Get.* all Contents ' aptupdate.output +sed -i '/^No-Support-for-Architecture-all: / d' $(find ./aptarchive -name 'Release') + msgmsg 'No Releasefile' rm -rf rootdir/var/lib/apt/lists find aptarchive -name '*Release*' -delete -- cgit v1.2.3