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