summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:04:53 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-26 08:04:53 +0000
commitfc49787d356473e9e62b0748d9deb10cc81af4f0 (patch)
treeb9aef9dbc5853a7928757f852a0860b85454dfcf /test
parentAdding upstream version 2.9.7. (diff)
downloadapt-upstream.tar.xz
apt-upstream.zip
Adding upstream version 2.9.8.upstream/2.9.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-signed-by-option48
-rwxr-xr-xtest/integration/test-solver3-obsoleted-by87
2 files changed, 135 insertions, 0 deletions
diff --git a/test/integration/test-signed-by-option b/test/integration/test-signed-by-option
index 58e4c4b..8e1e9a8 100755
--- a/test/integration/test-signed-by-option
+++ b/test/integration/test-signed-by-option
@@ -71,3 +71,51 @@ sed -i s/^xSigned-By/Signed-By/ rootdir/etc/apt/sources.list.d/deb822.sources
testsuccess apt update -o Debug::Acquire::gpgv=1
# make sure we did not leave leftover files (LP: #1995247)
testsuccessequal "" ls "${TMPDIR}"
+
+rm -f rootdir/etc/apt/sources.list.d/*
+
+msgtest 'Check that a repository with' 'only the fisrt entry has no Signed-By value works'
+cat > rootdir/etc/apt/sources.list.d/example.sources << EOF
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component
+
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component2
+Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+EOF
+testsuccess --nomsg aptcache policy
+
+msgtest 'Check that a repository with' 'only the second entry has no Signed-By value works'
+cat > rootdir/etc/apt/sources.list.d/example.sources << EOF
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component
+Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component2
+EOF
+testsuccess --nomsg aptcache policy
+
+cat > rootdir/etc/apt/sources.list.d/example.sources << EOF
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component
+Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+
+Types: deb
+URIs: http://example.org/
+Suites: suite
+Components: component2
+Signed-By: DE66AECA9151AFA1877EC31DE8525D47528144E2
+EOF
+testfailuremsg 'E: Conflicting values set for option Signed-By regarding source http://example.org/ suite: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE != DE66AECA9151AFA1877EC31DE8525D47528144E2
+E: The list of sources could not be read.' aptget update --print-uris
diff --git a/test/integration/test-solver3-obsoleted-by b/test/integration/test-solver3-obsoleted-by
new file mode 100755
index 0000000..031589b
--- /dev/null
+++ b/test/integration/test-solver3-obsoleted-by
@@ -0,0 +1,87 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+allowremovemanual
+
+# We need a canary to make it trigger obsolete detection
+insertpackage 'installed' 'canary' 'amd64' '1' 'Depends: good | not-yet-built | obsolete | obsolete-in-experimental | obsolete-reason | obsolete-in-experimental-reason | local-only | current-version | obsolete-in-downgrade | obsolete-in-downgrade-reason'
+
+# This package is good, it still exists in the candidate
+insertpackage 'installed' 'good' 'amd64' '1' 'Source: good (= 1)'
+insertpackage 'unstable' 'good' 'amd64' '2' 'Source: good (= 2)'
+
+# not-yet-built is not yet obsolete, because it has only been built on i386
+insertpackage 'installed,unstable' 'not-yet-built' 'amd64' '1' 'Source: not-yet-built (= 1)'
+insertpackage 'unstable' 'not-yet-built' 'i386' '2' 'Source: not-yet-built (= 2)'
+
+# obsolete is obsolete because obsolete-reason has been built on the same arch and is the source candidate
+insertpackage 'installed,unstable' 'obsolete' 'amd64' '1' 'Source: obsolete (= 1)'
+insertpackage 'unstable' 'obsolete-reason' 'amd64' '2' 'Source: obsolete (= 2)'
+
+# obsolete-in-experimental is only obsoleted in experimental, so it is not yet considered obsolete
+insertpackage 'installed,unstable' 'obsolete-in-experimental' 'amd64' '1' 'Source: obsolete-in-experimental (= 1)'
+insertpackage 'experimental' 'obsolete-in-experimental-reason' 'amd64' '2' 'Source: obsolete-in-experimental (= 2)'
+
+# local-only only exists in the local install
+insertpackage 'installed' 'local-only' 'amd64' '1' 'Source: local-only (= 1)'
+
+# current-version
+insertpackage 'installed,unstable' 'current-version' 'amd64' '1' 'Source: current-version (= 1)'
+
+# obsolete-in-downgrade is only obsoleted in experimental, so it is not yet considered obsolete
+insertpackage 'installed,experimental' 'obsolete-in-downgrade' 'amd64' '2' 'Source: obsolete-in-downgrade (= 2)'
+insertpackage 'unstable' 'obsolete-in-downgrade-reason' 'amd64' '1' 'Source: obsolete-in-downgrade (= 1)'
+
+setupaptarchive
+
+testobsolete() {
+ out="$1"
+ shift
+ testsuccess $@ -o Debug::APT::Solver=4 -o APT::Solver=3.0 -s
+ cp rootdir/tmp/testsuccess.output upgrade.output
+ testsuccessequal "$out" grep "Obsolete:" upgrade.output
+}
+
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade --no-strict-pinning
+
+msgmsg "Pinning the installed version down to experimental level means experimental wins"
+printf 'Package: obsolete-in-experimental\nPin: release *\nPin-Priority: 1\n' > rootdir/etc/apt/preferences
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: obsolete-in-experimental:amd64=1 due to obsolete-in-experimental-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: obsolete-in-experimental:amd64=1 due to obsolete-in-experimental-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade --no-strict-pinning
+
+msgmsg "Testing no-strict-pinning with negative pins on all packages"
+printf 'Package: *\nPin: release *\nPin-Priority: -1\n' > rootdir/etc/apt/preferences
+testobsolete "Obsolete: not-yet-built:amd64 - not installable
+Obsolete: good:amd64 - not installable
+Obsolete: obsolete:amd64 - not installable
+Obsolete: obsolete-in-experimental:amd64 - not installable
+Obsolete: current-version:amd64 - not installable
+Obsolete: local-only:amd64 - not installable
+Obsolete: obsolete-in-downgrade:amd64 - not installable" aptget dist-upgrade
+
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: obsolete-in-experimental:amd64=1 due to obsolete-in-experimental-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable
+Obsolete: obsolete-in-downgrade-reason:amd64=1 due to obsolete-in-downgrade:amd64=2" aptget dist-upgrade --no-strict-pinning
+
+
+msgmsg "Testing that pinning a downgrade does not trigger obsoletes handling"
+printf 'Package: downgrade-reason\nPin: release *\nPin-Priority: 1000\n' > rootdir/etc/apt/preferences
+
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade
+testobsolete "Obsolete: obsolete:amd64=1 due to obsolete-reason:amd64=2
+Obsolete: local-only:amd64=1 - not installable" aptget dist-upgrade --no-strict-pinning
+
+