]> git.saurik.com Git - apt.git/blame - test/integration/test-dpkg-assert-multi-arch
test-apt-cdrom: Fix for gnupg 2.1.15
[apt.git] / test / integration / test-dpkg-assert-multi-arch
CommitLineData
86fc2ca8
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
86fc2ca8
DK
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable'
10buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign'
11buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same'
3a5ec305 12buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable'
2a2a7ef4 13buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign'
86fc2ca8
DK
14
15setupaptarchive
16
17testqualifier() {
2a2a7ef4 18 msgtest 'Test with' $1 'for correct qualifier mode' $2
b4450f1d 19 #aptget install $1 -qq -o Debug::pkgDPkgPM=1 || true
28557f94 20 aptget install $1 -qq -o Debug::pkgDPkgPM=1 -o Dpkg::ExplicitLastConfigure=1 -o PackageManager::Configure=all > testqualifier.output 2>&1 || true
27f38567 21 GIVEN="$(grep -v -- '--unpack' testqualifier.output | sed -ne 's/^.*--[rpc][^ ]* \([^ ]*\).*$/\1/p')"
67b5d3dc
DK
22 if [ "$GIVEN" = "$2" ]; then
23 msgpass
24 else
b4450f1d
DK
25 cat >&2 testqualifier.output
26 echo >&2
27 echo >&2 "$GIVEN"
67b5d3dc
DK
28 msgfail
29 fi
86fc2ca8
DK
30}
31
eb191ca3 32msgmsg 'non-multiarch or "ubuntus" old multiarchified dpkg'
86fc2ca8 33echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
eb191ca3
DK
34cat > ./dpkg-wrapper <<EOF
35#! /bin/sh
36if echo "\$*" | grep -q -- "--assert-multi-arch"; then
67b5d3dc
DK
37 echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
38 echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
eb191ca3 39 exit 2
86fc2ca8 40fi
eb191ca3
DK
41exec "\$@"
42EOF
86fc2ca8
DK
43chmod +x ./dpkg-wrapper
44
45testqualifier 'native-pkg' 'native-pkg'
46testqualifier 'native-pkg:amd64' 'native-pkg'
47testqualifier 'foreign-pkg' 'foreign-pkg:i386'
48testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
49testqualifier 'same-lib' 'same-lib'
50testqualifier 'same-lib:amd64' 'same-lib'
51testqualifier 'same-lib:i386' 'same-lib:i386'
3a5ec305
DK
52testqualifier 'all-pkg' 'all-pkg'
53testqualifier 'all-pkg:amd64' 'all-pkg'
54testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
55testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
56insertinstalledpackage 'all-pkg' 'amd64' '1.0'
2a2a7ef4 57insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
3a5ec305
DK
58testqualifier 'all-pkg' 'all-pkg'
59testqualifier 'all-pkg:amd64' 'all-pkg'
60testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
61testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
2a2a7ef4
DK
62insertinstalledpackage 'always-all-pkg' 'all' '1.0'
63insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
64testqualifier 'all-pkg-' 'all-pkg'
65testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
66testqualifier 'always-all-pkg-' 'always-all-pkg'
67testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
86fc2ca8 68
eb191ca3 69msgmsg 'multiarch dpkg (new interface version)'
3a5ec305
DK
70rm rootdir/var/lib/dpkg/status
71touch rootdir/var/lib/dpkg/status
86fc2ca8 72echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
eb191ca3
DK
73cat > ./dpkg-wrapper <<EOF
74#! /bin/sh
75if echo "\$*" | grep -q -- "--assert-multi-arch"; then
76 exit 0
77fi
78exec "\$@"
79EOF
80chmod +x ./dpkg-wrapper
86fc2ca8
DK
81
82testqualifier 'native-pkg' 'native-pkg:amd64'
83testqualifier 'native-pkg:amd64' 'native-pkg:amd64'
84testqualifier 'foreign-pkg' 'foreign-pkg:i386'
85testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
86testqualifier 'same-lib' 'same-lib:amd64'
87testqualifier 'same-lib:amd64' 'same-lib:amd64'
88testqualifier 'same-lib:i386' 'same-lib:i386'
3a5ec305
DK
89testqualifier 'all-pkg' 'all-pkg:all'
90testqualifier 'all-pkg:amd64' 'all-pkg:all'
91testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
92testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
93insertinstalledpackage 'all-pkg' 'amd64' '1.0'
2a2a7ef4 94insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
3a5ec305
DK
95testqualifier 'all-pkg' 'all-pkg:all'
96testqualifier 'all-pkg:amd64' 'all-pkg:all'
97testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
98testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
2a2a7ef4
DK
99insertinstalledpackage 'always-all-pkg' 'all' '1.0'
100insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
101testqualifier 'all-pkg-' 'all-pkg:amd64'
102testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64'
103testqualifier 'always-all-pkg-' 'always-all-pkg:all'
104testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all'