]> git.saurik.com Git - apt.git/blob - test/integration/test-dpkg-assert-multi-arch
pass-through stdin fd instead of content if not a terminal
[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 GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
20 if [ "$GIVEN" = "$2" ]; then
21 msgpass
22 else
23 echo
24 echo "$GIVEN"
25 msgfail
26 fi
27 }
28
29 msgmsg 'non-multiarch or "ubuntus" old multiarchified dpkg'
30 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
31 cat > ./dpkg-wrapper <<EOF
32 #! /bin/sh
33 if echo "\$*" | grep -q -- "--assert-multi-arch"; then
34 echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
35 echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
36 exit 2
37 fi
38 exec "\$@"
39 EOF
40 chmod +x ./dpkg-wrapper
41
42 testqualifier 'native-pkg' 'native-pkg'
43 testqualifier 'native-pkg:amd64' 'native-pkg'
44 testqualifier 'foreign-pkg' 'foreign-pkg:i386'
45 testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
46 testqualifier 'same-lib' 'same-lib'
47 testqualifier 'same-lib:amd64' 'same-lib'
48 testqualifier 'same-lib:i386' 'same-lib:i386'
49 testqualifier 'all-pkg' 'all-pkg'
50 testqualifier 'all-pkg:amd64' 'all-pkg'
51 testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
52 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
53 insertinstalledpackage 'all-pkg' 'amd64' '1.0'
54 insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
55 testqualifier 'all-pkg' 'all-pkg'
56 testqualifier 'all-pkg:amd64' 'all-pkg'
57 testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
58 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
59 insertinstalledpackage 'always-all-pkg' 'all' '1.0'
60 insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
61 testqualifier 'all-pkg-' 'all-pkg'
62 testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
63 testqualifier 'always-all-pkg-' 'always-all-pkg'
64 testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
65
66 msgmsg 'multiarch dpkg (new interface version)'
67 rm rootdir/var/lib/dpkg/status
68 touch rootdir/var/lib/dpkg/status
69 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
70 cat > ./dpkg-wrapper <<EOF
71 #! /bin/sh
72 if echo "\$*" | grep -q -- "--assert-multi-arch"; then
73 exit 0
74 fi
75 exec "\$@"
76 EOF
77 chmod +x ./dpkg-wrapper
78
79 testqualifier 'native-pkg' 'native-pkg:amd64'
80 testqualifier 'native-pkg:amd64' 'native-pkg:amd64'
81 testqualifier 'foreign-pkg' 'foreign-pkg:i386'
82 testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
83 testqualifier 'same-lib' 'same-lib:amd64'
84 testqualifier 'same-lib:amd64' 'same-lib:amd64'
85 testqualifier 'same-lib:i386' 'same-lib:i386'
86 testqualifier 'all-pkg' 'all-pkg:all'
87 testqualifier 'all-pkg:amd64' 'all-pkg:all'
88 testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
89 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
90 insertinstalledpackage 'all-pkg' 'amd64' '1.0'
91 insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
92 testqualifier 'all-pkg' 'all-pkg:all'
93 testqualifier 'all-pkg:amd64' 'all-pkg:all'
94 testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
95 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
96 insertinstalledpackage 'always-all-pkg' 'all' '1.0'
97 insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
98 testqualifier 'all-pkg-' 'all-pkg:amd64'
99 testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64'
100 testqualifier 'always-all-pkg-' 'always-all-pkg:all'
101 testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all'