summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xtest/integration/test-apt-get-autoremove42
-rwxr-xr-xtest/integration/test-apt-get-mark-auto30
-rwxr-xr-xtest/integration/test-bug-549968-install-depends-of-not-installed2
-rwxr-xr-xtest/integration/test-bug-960705-propagate-protected-to-satisfied-depends2
-rwxr-xr-xtest/integration/test-dpkg-i-apt-install-fix-broken6
-rwxr-xr-xtest/integration/test-method-gpgv43
-rwxr-xr-xtest/integration/test-signed-by-option48
-rwxr-xr-xtest/integration/test-snapshot19
-rwxr-xr-xtest/integration/test-snapshot-upgrades156
-rwxr-xr-xtest/integration/test-solver3-dependencies65
-rwxr-xr-xtest/integration/test-solver3-obsoleted-by87
-rw-r--r--test/libapt/assert_pubkeyalgo_test.cc56
12 files changed, 544 insertions, 12 deletions
diff --git a/test/integration/test-apt-get-autoremove b/test/integration/test-apt-get-autoremove
index 9454df5..af47420 100755
--- a/test/integration/test-apt-get-autoremove
+++ b/test/integration/test-apt-get-autoremove
@@ -264,3 +264,45 @@ Purg foo-plus-2 [1]' apt autopurge -s
testdpkgstatus 'pi' '1' 'unrelated'
testsuccess apt purge unrelated -y
+
+insertinstalledpackage 'foo-has-update' 'all' '1'
+insertpackage 'stable' 'foo-has-update' 'all' '2'
+testsuccess aptmark auto 'foo-has-update'
+
+setupaptarchive
+
+# Test removed package version (with -V flag), when package has update
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be REMOVED:
+ foo-has-update (1)
+ foo-multi1-1 (1)
+ foo-multi1-2 (1)
+ foo-multi2-1 (1)
+ foo-multi2-2 (1)
+ foo-plus-1 (1)
+ foo-plus-2 (1)
+0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded.
+Remv foo-has-update [1]
+Remv foo-multi1-1 [1]
+Remv foo-multi1-2 [1]
+Remv foo-multi2-1 [1]
+Remv foo-multi2-2 [1]
+Remv foo-plus-1 [1]
+Remv foo-plus-2 [1]' apt autoremove -sV
+
+# Test automatic removed package version (with -V flag), when package has update
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages were automatically installed and are no longer required:
+ foo-has-update (1)
+ foo-multi1-1 (1)
+ foo-multi1-2 (1)
+ foo-multi2-1 (1)
+ foo-multi2-2 (1)
+ foo-plus-1 (1)
+ foo-plus-2 (1)
+Use 'apt autoremove' to remove them.
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded." apt remove -sV
diff --git a/test/integration/test-apt-get-mark-auto b/test/integration/test-apt-get-mark-auto
new file mode 100755
index 0000000..844412e
--- /dev/null
+++ b/test/integration/test-apt-get-mark-auto
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'package' 'all' '3'
+
+setupaptarchive
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ package
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst package (3 unstable [all])
+Conf package (3 unstable [all])" aptget install package --mark-auto -s
+
+# Specifically if we mark the package as automatically installed but also have auto-remove on,
+# the package should still be installed...
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ package
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst package (3 unstable [all])
+Conf package (3 unstable [all])" aptget install package --mark-auto --auto-remove -s
diff --git a/test/integration/test-bug-549968-install-depends-of-not-installed b/test/integration/test-bug-549968-install-depends-of-not-installed
index 39c86cc..f575f99 100755
--- a/test/integration/test-bug-549968-install-depends-of-not-installed
+++ b/test/integration/test-bug-549968-install-depends-of-not-installed
@@ -32,7 +32,7 @@ Conf coolstuff (1.0 unstable [all])" aptget install coolstuff extracoolstuff- -o
testsuccessequal "Reading package lists...
Building dependency tree...
Package 'extracoolstuff' is not installed, so not removed
-Solving dependencies...MANUAL coolstuff:i386
+Solving dependencies...Install coolstuff:i386 ()
[0] Install:coolstuff:i386=1.0 ()
Delete extracoolstuff:i386
[0] Reject:extracoolstuff:i386 ()
diff --git a/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends b/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends
index da11fc8..6ffb69b 100755
--- a/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends
+++ b/test/integration/test-bug-960705-propagate-protected-to-satisfied-depends
@@ -20,7 +20,7 @@ setupaptarchive
testsuccessequal "Reading package lists...
Building dependency tree...
-Solving dependencies...MANUAL foobar:amd64
+Solving dependencies...Install foobar:amd64 ()
[0] Install:foobar:amd64=1 ()
[0] Install:requires-foo:amd64=1 (foobar:amd64=1)
[0] Install:foo:amd64=1 (foobar:amd64=1 -> requires-foo:amd64=1)
diff --git a/test/integration/test-dpkg-i-apt-install-fix-broken b/test/integration/test-dpkg-i-apt-install-fix-broken
index 5c517aa..a4c3c66 100755
--- a/test/integration/test-dpkg-i-apt-install-fix-broken
+++ b/test/integration/test-dpkg-i-apt-install-fix-broken
@@ -14,13 +14,13 @@ setupaptarchive
testfailure dpkg -i incoming/autopkgtest-*.deb
testsuccessequal 'Reading package lists...
Building dependency tree...
-Correcting dependencies...MANUAL autopkgtest-satdep:amd64
+Correcting dependencies...Install autopkgtest-satdep:amd64 ()
[0] Install:autopkgtest-satdep:amd64 ()
[0] Install:autopkgtest-satdep:amd64=1 (autopkgtest-satdep:amd64)
[0] Install:debhelper:amd64=1 (autopkgtest-satdep:amd64 -> autopkgtest-satdep:amd64=1)
Done
-Solving dependencies...AUTOMATIC debhelper:amd64 - upgrade
-MANUAL autopkgtest-satdep:amd64
+Solving dependencies...Install debhelper:amd64 (M)
+Install autopkgtest-satdep:amd64 ()
[0] Install:autopkgtest-satdep:amd64 ()
[0] Install:autopkgtest-satdep:amd64=1 (autopkgtest-satdep:amd64)
[0] Install:debhelper:amd64=1 (autopkgtest-satdep:amd64 -> autopkgtest-satdep:amd64=1)
diff --git a/test/integration/test-method-gpgv b/test/integration/test-method-gpgv
index 0f014e3..ffaa72c 100755
--- a/test/integration/test-method-gpgv
+++ b/test/integration/test-method-gpgv
@@ -48,6 +48,14 @@ testrun() {
[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
[GNUPG:] ASSERT_PUBKEY_ALGO 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 1 rsa1024'
+ testgpgv 'Not asserted in the next level' 'SoonWorthless: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE, ' '34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE!' '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
+[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+[GNUPG:] ASSERT_PUBKEY_ALGO 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 1 brainpoolP256r1'
+
+ testgpgv 'Not asserted in the future level' 'LaterWorthless: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE, ' '34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE!' '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
+[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+[GNUPG:] ASSERT_PUBKEY_ALGO 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 1 nistp256'
+
testgpgv 'Good subkey signed with long keyid' 'Good: GOODSIG 5B6896415D44C43E' '34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE, 4281DEDBD466EAE8C1F4157E5B6896415D44C43E!' '[GNUPG:] GOODSIG 5B6896415D44C43E Sebastian Subkey <subkey@example.org>
[GNUPG:] VALIDSIG 4281DEDBD466EAE8C1F4157E5B6896415D44C43E 2018-08-16 1534459673 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE'
testgpgv 'Good subkey signed with fingerprint' 'Good: GOODSIG 4281DEDBD466EAE8C1F4157E5B6896415D44C43E' '34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE, 4281DEDBD466EAE8C1F4157E5B6896415D44C43E!' '[GNUPG:] GOODSIG 4281DEDBD466EAE8C1F4157E5B6896415D44C43E Sebastian Subkey <subkey@example.org>
@@ -108,6 +116,9 @@ gpgvmethod() {
Config-Item: Debug::Acquire::gpgv=1
Config-Item: Dir::Bin::apt-key=./faked-apt-key
Config-Item: APT::Hashes::SHA1::Weak=true
+Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1
+Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256
+Config-Item: APT::Key::Assert-Pubkey-Algo::Future=>=rsa2048
600 URI Acquire
URI: file://${TMPWORKINGDIRECTORY}/message.sig
@@ -121,6 +132,9 @@ gpgvmethod() {
Config-Item: Debug::Acquire::gpgv=1
Config-Item: Dir::Bin::apt-key=./faked-apt-key
Config-Item: APT::Hashes::SHA1::Weak=true
+Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1
+Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256
+Config-Item: APT::Key::Assert-Pubkey-Algo::Future=>=rsa2048
600 URI Acquire
URI: file://${TMPWORKINGDIRECTORY}/message.sig
@@ -135,6 +149,9 @@ gpgvmethod() {
Config-Item: Debug::Acquire::gpgv=1
Config-Item: Dir::Bin::apt-key=./faked-apt-key
Config-Item: APT::Hashes::SHA1::Weak=true
+Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1
+Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256
+Config-Item: APT::Key::Assert-Pubkey-Algo::Future=>=rsa2048
600 URI Acquire
URI: file://${TMPWORKINGDIRECTORY}/message.sig
@@ -158,6 +175,9 @@ gpgvmethod() {
Config-Item: Debug::Acquire::gpgv=1
Config-Item: Dir::Bin::apt-key=./faked-apt-key
Config-Item: APT::Hashes::SHA1::Weak=true
+Config-Item: APT::Key::Assert-Pubkey-Algo=>=rsa2048,nistp256,brainpoolP256r1
+Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=rsa2048,nistp256
+Config-Item: APT::Key::Assert-Pubkey-Algo::Future=>=rsa2048
600 URI Acquire
URI: file://${TMPWORKINGDIRECTORY}/message.sig
@@ -199,3 +219,26 @@ echo '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Sebastian Subkey <subkey@example.org>
[GNUPG:] VALIDSIG 0000000000000000000000000000000000000000 2018-08-16 1534459673 0 4 0 1 11 00 4281DEDBD466EAE8C1F4157E5B6896415D44C43E' > gpgv.output
testfailure apt update -o Dir::Bin::apt-key="./faked-apt-key" -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::gpgv=1
rm -rf rootdir/var/lib/apt/lists
+
+gpgvmethod() {
+ echo "601 Configuration
+Config-Item: Debug::Acquire::gpgv=1
+Config-Item: Dir::Bin::apt-key=./faked-apt-key
+Config-Item: APT::Hashes::SHA1::Weak=true
+Config-Item: APT::Key::Assert-Pubkey-Algo::Next=>=invalid
+
+600 URI Acquire
+URI: file://${TMPWORKINGDIRECTORY}/message.sig
+Filename: ${TMPWORKINGDIRECTORY}/message.data
+Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE!
+" | runapt "${METHODSDIR}/gpgv"
+}
+
+
+echo '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
+[GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
+[GNUPG:] ASSERT_PUBKEY_ALGO 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 1 brainpoolP256r1' > gpgv.output
+
+msgtest "Warns about invalid specification" ">=invalid"
+gpgvmethod >method.output 2>&1 || true
+testsuccess --nomsg grep "Message: Unrecognized public key specification '>=invalid' in option APT::Key::Assert-Pubkey-Algo::Next" method.output
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-snapshot b/test/integration/test-snapshot
index 26ef5a7..31a02ca 100755
--- a/test/integration/test-snapshot
+++ b/test/integration/test-snapshot
@@ -66,7 +66,7 @@ testsuccessequal "'http://localhost:${APTHTTPPORT}/dists/stable/InRelease' local
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris
-for option in -S --snapshot; do
+for option in '-S' '-S ' '--snapshot ' '--snapshot=' '-o APT::Snapshot='; do
testsuccessequal "'https://snapshot.debian.org/archive/debian/BANANA/dists/stable/InRelease' snapshot.debian.org_archive_debian_BANANA_dists_stable_InRelease 0
'https://snapshot.debian.org/archive/debian/BANANA/dists/stable/main/source/Sources.xz' snapshot.debian.org_archive_debian_BANANA_dists_stable_main_source_Sources 0
'https://snapshot.debian.org/archive/debian/BANANA/dists/stable/main/binary-amd64/Packages.xz' snapshot.debian.org_archive_debian_BANANA_dists_stable_main_binary-amd64_Packages 0
@@ -76,7 +76,7 @@ testsuccessequal "'https://snapshot.debian.org/archive/debian/BANANA/dists/stabl
'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0
-'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris $option BANANA
+'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris ${option}BANANA
done
@@ -93,6 +93,12 @@ Get:6 http://localhost:${APTHTTPPORT}/snapshot/BANANA stable/main Translation-en
Reading package lists..." \
aptget update -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/" -SBANANA
+for option in '-S' '-S ' '--snapshot ' '--snapshot=' '-o APT::Snapshot='; do
+ testsuccessequal 'Listing...' apt list --upgradable -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/" ${option}BANANA
+ testsuccessequal 'Listing...
+awesome/stable 42 amd64' apt list awesome -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/" ${option}BANANA
+done
+
msgmsg "Cache constructed without snapshot"
testsuccessequal "Package files:
500 http://localhost:${APTHTTPPORT} stable/main all Packages
@@ -102,7 +108,7 @@ testsuccessequal "Package files:
release o=Debian,a=stable,n=stable,l=Testcases,c=main,b=amd64
origin localhost
Pinned packages:" \
- aptcache policy -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/"
+ aptcache policy -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/"
testsuccessequal "'http://localhost:${APTHTTPPORT}/pool/awesome_42_amd64.deb' awesome_42_amd64.deb $(stat -c %s aptarchive/pool/awesome_42_amd64.deb) " \
aptget install --print-uris -qq awesome
@@ -121,7 +127,6 @@ Pinned packages:" \
testsuccessequal "'http://localhost:${APTHTTPPORT}/snapshot/BANANA/pool/awesome_42_amd64.deb' awesome_42_amd64.deb $(stat -c %s aptarchive/pool/awesome_42_amd64.deb) " \
aptget install --print-uris -qq awesome -o Acquire::Snapshots::URI::Label::Testcases="http://localhost:${APTHTTPPORT}/snapshot/@SNAPSHOTID@/" -SBANANA
-
msgmsg "Origin: Ubuntu"
releasechanger 'Origin' 'Ubuntu'
testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/stable/InRelease' snapshot.ubuntu.com_ubuntu_BANANA_dists_stable_InRelease 0
@@ -133,7 +138,7 @@ testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/stable/InRele
'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0
-'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris $option BANANA
+'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris -S BANANA
msgmsg "Label: Debian"
releasechanger 'Label' 'Debian'
@@ -146,7 +151,7 @@ testsuccessequal "'https://snapshot.ubuntu.com/ubuntu/BANANA/dists/stable/InRele
'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0
-'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris $option BANANA
+'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris -S BANANA
testsuccessequal "'http://localhost:${APTHTTPPORT}/dists/stable/InRelease' localhost:${APTHTTPPORT}_dists_stable_InRelease 0
'http://localhost:${APTHTTPPORT}/snapshot/BANANA/dists/stable/InRelease' localhost:${APTHTTPPORT}_snapshot_BANANA_dists_stable_InRelease 0
@@ -171,7 +176,7 @@ testsuccessequal "'https://example.org/snapshots//BANANA/dists/stable/InRelease'
'http://localhost:${APTHTTPPORT}/dists/stable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_stable_main_source_Sources 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-amd64_Packages 0
'http://localhost:${APTHTTPPORT}/dists/stable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_stable_main_binary-all_Packages 0
-'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris $option BANANA -o Acquire::Snapshots::URI::Host::localhost="https://example.org/snapshots/@PATH@/@SNAPSHOTID@/"
+'http://localhost:${APTHTTPPORT}/dists/stable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_stable_main_i18n_Translation-en 0 " aptget update --print-uris -S BANANA -o Acquire::Snapshots::URI::Host::localhost="https://example.org/snapshots/@PATH@/@SNAPSHOTID@/"
msgmsg "Snapshots: set in the InRelease file"
sed -i '/^Origin: / a\
diff --git a/test/integration/test-snapshot-upgrades b/test/integration/test-snapshot-upgrades
new file mode 100755
index 0000000..d5e8006
--- /dev/null
+++ b/test/integration/test-snapshot-upgrades
@@ -0,0 +1,156 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'amd64'
+
+for T in T1 T2; do
+ mkdir "aptarchive/${T}"
+ ln -s ../../incoming "aptarchive/${T}/pool"
+done
+
+buildsimplenativepackage 'awesome' 'amd64' '2' 'stable' 'Depends: libfoo (>= 2)'
+buildsimplenativepackage 'libfoo' 'amd64' '2' 'stable'
+setupaptarchive --no-update
+mv aptarchive/dists aptarchive/T1
+rm incoming/stable.main.pkglist incoming/stable.main.srclist
+
+buildsimplenativepackage 'awesome' 'amd64' '3' 'stable' 'Depends: libfoo (>= 2)'
+setupaptarchive --no-update
+mv aptarchive/dists aptarchive/T2
+rm incoming/stable.main.pkglist incoming/stable.main.srclist
+
+buildsimplenativepackage 'libfoo' 'amd64' '42' 'stable'
+buildsimplenativepackage 'awesome' 'amd64' '42' 'stable'
+setupaptarchive --no-update
+
+changetowebserver
+sed -i 's/http:/[snapshot=enable] http:/' rootdir/etc/apt/sources.list.d/*
+echo "Acquire::Snapshots::URI::Host::localhost \"http://localhost:${APTHTTPPORT}/@SNAPSHOTID@/\";" > rootdir/etc/apt/apt.conf.d/snapshot.conf
+testsuccess aptget update --snapshot T1
+testsuccess aptget update --snapshot T2 --no-list-cleanup
+
+insertinstalledpackage 'awesome' 'amd64' '1' 'Depends: libfoo (>= 1)'
+insertinstalledpackage 'libfoo' 'amd64' '1'
+
+msgmsg 'Snapshotting policy'
+testsuccessequal "libfoo:
+ Installed: 1
+ Candidate: 42
+ Version table:
+ 42 500
+ 500 http://localhost:${APTHTTPPORT} stable/main amd64 Packages
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+awesome:
+ Installed: 1
+ Candidate: 42
+ Version table:
+ 42 500
+ 500 http://localhost:${APTHTTPPORT} stable/main amd64 Packages
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" apt policy libfoo awesome
+testsuccessequal "libfoo:
+ Installed: 1
+ Candidate: 2
+ Version table:
+ 2 500
+ 500 http://localhost:${APTHTTPPORT}/T1 stable/main amd64 Packages
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+awesome:
+ Installed: 1
+ Candidate: 2
+ Version table:
+ 2 500
+ 500 http://localhost:${APTHTTPPORT}/T1 stable/main amd64 Packages
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" apt policy libfoo awesome -S T1
+testsuccessequal "libfoo:
+ Installed: 1
+ Candidate: 1
+ Version table:
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+awesome:
+ Installed: 1
+ Candidate: 3
+ Version table:
+ 3 500
+ 500 http://localhost:${APTHTTPPORT}/T2 stable/main amd64 Packages
+ *** 1 100
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" apt policy libfoo awesome -S T2
+
+
+msgmsg 'Snapshotting show'
+testsuccessequalgrep() {
+ local CMP="$1"
+ local GREP="$2"
+ shift 2
+ testsuccess "$@"
+ mv rootdir/tmp/testsuccess.output base.output
+ testsuccessequal "$CMP" grep "$GREP" base.output
+}
+testsuccessequalgrep 'Version: 42
+Version: 1
+Version: 42
+Version: 1' '^Version: ' aptcache show libfoo awesome
+testsuccessequalgrep 'Version: 2
+Version: 1
+Version: 2
+Version: 1' '^Version: ' aptcache show libfoo awesome -S T1
+testsuccessequalgrep 'Version: 1
+Version: 3
+Version: 1' '^Version: ' aptcache show libfoo awesome -S T2
+
+
+msgmsg 'Snapshotting list'
+testsuccessequal 'Listing...
+awesome/stable 42 amd64 [upgradable from: 1]
+libfoo/stable 42 amd64 [upgradable from: 1]' apt list --upgradeable
+testsuccessequal 'Listing...
+awesome/stable 2 amd64 [upgradable from: 1]
+libfoo/stable 2 amd64 [upgradable from: 1]' apt list --upgradeable -S T1
+testsuccessequal "Listing...
+awesome/stable 3 amd64 [upgradable from: 1]
+N: There is 1 additional version. Please use the '-a' switch to see it" apt list --upgradeable -S T2
+
+
+msgmsg 'Snapshotting upgrade'
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ awesome libfoo
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst awesome [1] (42 stable [amd64])
+Inst libfoo [1] (42 stable [amd64])
+Conf awesome (42 stable [amd64])
+Conf libfoo (42 stable [amd64])' apt upgrade -s
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ awesome libfoo
+2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst libfoo [1] (2 stable [amd64])
+Inst awesome [1] (2 stable [amd64])
+Conf libfoo (2 stable [amd64])
+Conf awesome (2 stable [amd64])' apt upgrade -s -S T1
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages have been kept back:
+ awesome
+0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.' apt upgrade -s -S T2
+
+msgmsg 'Snapshotting real installs'
+testsuccessequalgrep 'Version: 1' '^Version: ' apt show libfoo/now
+testsuccess apt install libfoo -S T1 -y
+testsuccessequalgrep 'Version: 2' '^Version: ' apt show libfoo/now
+testsuccessequalgrep 'Version: 1' '^Version: ' apt show awesome/now
+testsuccess apt upgrade -S T2 -y
+testsuccessequalgrep 'Version: 3' '^Version: ' apt show awesome/now
diff --git a/test/integration/test-solver3-dependencies b/test/integration/test-solver3-dependencies
new file mode 100755
index 0000000..330ded8
--- /dev/null
+++ b/test/integration/test-solver3-dependencies
@@ -0,0 +1,65 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'replaces' 'all' '2' 'Replaces: replaced (<< 3)'
+insertinstalledpackage 'replaced' 'all' '2'
+
+insertinstalledpackage 'enhances' 'all' '2' 'Enhances: enhanced (<< 3)'
+insertinstalledpackage 'enhanced' 'all' '2'
+
+insertpackage 'unstable' 'replaces' 'all' '3' 'Replaces: replaced (<< 3)'
+insertpackage 'unstable' 'enhances' 'all' '3' 'Enhances: enhanced (<< 3)'
+insertpackage 'unstable' 'replaced' 'all' '3'
+insertpackage 'unstable' 'enhanced' 'all' '3'
+
+setupaptarchive
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ enhanced enhances replaced replaces
+4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst enhanced [2] (3 unstable [all])
+Inst enhances [2] (3 unstable [all])
+Inst replaced [2] (3 unstable [all])
+Inst replaces [2] (3 unstable [all])
+Conf enhanced (3 unstable [all])
+Conf enhances (3 unstable [all])
+Conf replaced (3 unstable [all])
+Conf replaces (3 unstable [all])" aptget upgrade -s
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ enhanced enhances replaced replaces
+4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst enhanced [2] (3 unstable [all])
+Inst enhances [2] (3 unstable [all])
+Inst replaced [2] (3 unstable [all])
+Inst replaces [2] (3 unstable [all])
+Conf enhanced (3 unstable [all])
+Conf enhances (3 unstable [all])
+Conf replaced (3 unstable [all])
+Conf replaces (3 unstable [all])" apt upgrade -s
+
+testsuccessequal "Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be upgraded:
+ enhanced enhances replaced replaces
+4 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst enhanced [2] (3 unstable [all])
+Inst enhances [2] (3 unstable [all])
+Inst replaced [2] (3 unstable [all])
+Inst replaces [2] (3 unstable [all])
+Conf enhanced (3 unstable [all])
+Conf enhances (3 unstable [all])
+Conf replaced (3 unstable [all])
+Conf replaces (3 unstable [all])" apt dist-upgrade -s
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
+
+
diff --git a/test/libapt/assert_pubkeyalgo_test.cc b/test/libapt/assert_pubkeyalgo_test.cc
new file mode 100644
index 0000000..88a070b
--- /dev/null
+++ b/test/libapt/assert_pubkeyalgo_test.cc
@@ -0,0 +1,56 @@
+#include <config.h>
+
+#include <apt-pkg/error.h>
+#include <apt-pkg/gpgv.h>
+
+#include "common.h"
+
+TEST(AssertPubKeyAlgo_Test, test)
+{
+ EXPECT_TRUE(IsAssertedPubKeyAlgo("rsa2048", ">=rsa2048"));
+ _error->DumpErrors();
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_TRUE(IsAssertedPubKeyAlgo("rsa2048", "another,>=rsa2048"));
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("rsa2048", ">=rsa2049"));
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_TRUE(IsAssertedPubKeyAlgo("ed25519", ">=rsa2048,ed25519"));
+ EXPECT_TRUE(_error->empty());
+}
+
+TEST(AssertPubKeyAlgo_Test, CanOnlyCompareRSA)
+{
+ std::string msg;
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", ">=ed25519"));
+ EXPECT_TRUE(_error->PopMessage(msg));
+ EXPECT_EQ("Unrecognized public key specification '>=ed25519' in option >=ed25519", msg);
+ EXPECT_TRUE(_error->empty());
+}
+
+TEST(AssertPubKeyAlgo_Test, EmptyOption)
+{
+ std::string msg;
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", ""));
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", ","));
+ EXPECT_TRUE(_error->PopMessage(msg));
+ EXPECT_EQ("Empty item in public key assertion string option ,", msg);
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", "moo,"));
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", "moo,,"));
+ EXPECT_TRUE(_error->PopMessage(msg));
+ EXPECT_EQ("Empty item in public key assertion string option moo,,", msg);
+ EXPECT_TRUE(_error->empty());
+
+ EXPECT_FALSE(IsAssertedPubKeyAlgo("ed25519", ",moo"));
+ EXPECT_TRUE(_error->PopMessage(msg));
+ EXPECT_EQ("Empty item in public key assertion string option ,moo", msg);
+ EXPECT_TRUE(_error->empty());
+}