From 93416f3227685c390c7ab579981efde526134181 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 29 Jan 2025 19:01:06 +0100 Subject: Add 'Include'/'Exclude' options to limit packages used from a repository 'Include' allows limiting a repository to a allowlist of packages, 'Exclude' allows removing packages from a repository. Implementation wise this is not the nicest as it goes via the IndexTarget options, so we first parse our option value into a vector, then we turn the vector into a string, and then vectorize it again. That said, we support both "," and " " as separators due to the construction (we split by "," then we join using " "). Gbp-Dch: full --- test/integration/test-sourceslist-include-exclude | 63 +++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100755 test/integration/test-sourceslist-include-exclude (limited to 'test/integration/test-sourceslist-include-exclude') diff --git a/test/integration/test-sourceslist-include-exclude b/test/integration/test-sourceslist-include-exclude new file mode 100755 index 000000000..7188b978f --- /dev/null +++ b/test/integration/test-sourceslist-include-exclude @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture 'i386' 'armel' + +insertpackage 'unstable' 'foo' 'all' '1.0' +insertpackage 'unstable' 'bar' 'all' '1.0' +insertpackage 'unstable' 'baz' 'all' '1.0' + +setupaptarchive + +rm rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.list + +cat > rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.sources << EOF +Types: deb +URIs: file://${TMPWORKINGDIRECTORY}/aptarchive +Suites: unstable +Components: main +Include: foo +EOF + +testsuccess apt update +testsuccessequal "foo/unstable 1.0 all" apt list -qq + +cat > rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.sources << EOF +Types: deb +URIs: file://${TMPWORKINGDIRECTORY}/aptarchive +Suites: unstable +Components: main +Exclude: foo bar +EOF + +testsuccess apt update +testsuccessequal "baz/unstable 1.0 all" apt list -qq + + +cat > rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.sources << EOF +Types: deb +URIs: file://${TMPWORKINGDIRECTORY}/aptarchive +Suites: unstable +Components: main +Exclude: foo , baz +EOF + +testsuccess apt update +testsuccessequal "bar/unstable 1.0 all" apt list -qq + +cat > rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.sources << EOF +Types: deb +URIs: file://${TMPWORKINGDIRECTORY}/aptarchive +Suites: unstable +Components: main +Include: foo +Exclude: foo , baz +EOF + +testfailureequal "E: Both 'Include' and 'Exclude' specified in ${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb.sources:1 +E: The list of sources could not be read." apt update + -- cgit v1.2.3-70-g09d2