From dd81b736095f244454c7f179e67f21c08f3fbce9 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 9 Nov 2021 20:37:18 +0100 Subject: Support more than exact release matches in 'source' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Debian 11 release notes elevate matching with regex to a documented and much used feature, which it previously wasn't. For binary packages this is not a problem, but source packages are special and it turns out that matching by release is here an exact string match only. A bit of refactoring later we can reuse the code we use for Packages files also for Release files, which is what we have for Sources files as those files itself have no representation in the cache. This means that we do not support matching based on components (c=main) in source, but we didn't before and we can cross that bridge if anyone notices… Closes: #998444 --- .../test-bug-998444-regex-as-target-release | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 test/integration/test-bug-998444-regex-as-target-release (limited to 'test/integration') diff --git a/test/integration/test-bug-998444-regex-as-target-release b/test/integration/test-bug-998444-regex-as-target-release new file mode 100755 index 000000000..97970bccd --- /dev/null +++ b/test/integration/test-bug-998444-regex-as-target-release @@ -0,0 +1,65 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' + +addpackage() { + insertpackage "$@" + insertsource "$@" +} + +addpackage 'stable' 'foo' 'all' '1' +addpackage 'stable-security' 'foo' 'all' '1.1~security.1' +addpackage 'stable-updates' 'foo' 'all' '2~stable.1' +addpackage 'unstable' 'foo' 'all' '2' +addpackage 'experimental' 'foo' 'all' '3' +addpackage 'external' 'foo' 'all' '4' + +cat > rootdir/etc/apt/preferences < aptsource.output + testfileequal 'aptsource.output' "foo_${9:-$1}.dsc +foo_${9:-$1}.tar.gz" +} +testfoo '2' '-10' '1' '500' '500' '500' '500' '' '4' +testfoo '2' '-10' '1' '990' '500' '500' '500' 'unstable' '2' +testfoo '1' '-10' '1' '500' '500' '500' '990' 'stable' +testfoo '2~stable.1' '-10' '1' '500' '990' '500' '500' 'stable-updates' +testfoo '1.1~security.1' '-10' '1' '500' '500' '990' '500' 'stable-security' +testfoo '4' '990' '1' '500' '500' '500' '500' 'a=external' +testfoo '2' '-10' '1' '990' '990' '990' '990' '/stable/' +testfoo '2~stable.1' '-10' '1' '500' '990' '990' '990' '/^stable/' +testfoo '1.1~security.1' '-10' '1' '500' '500' '990' '990' '/^stable(|-security)$/' +testfoo '2~stable.1' '-10' '1' '500' '990' '990' '500' '/^stable(-security|-updates)$/' +testfoo '2~stable.1' '-10' '1' '500' '990' '990' '990' '/^stable(|-security|-updates)$/' +testfoo '4' '990' '990' '990' '990' '990' '990' '/./' -- cgit v1.2.3-70-g09d2