summaryrefslogtreecommitdiff
path: root/test/integration/test-dpkg-assert-multi-arch
blob: 8be7e0d7651fe72a1ea9e2ef5e576247c16c1e30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'amd64' 'i386'

buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable'
buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign'
buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same'

setupaptarchive

testqualifier() {
	msgtest 'Test for correct qualifier mode' $2
	GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -e '--configure' -e '^dpkg:' | sed -e 's/^.*--configure \([^ ]*\).*$/\1/')"
	if [ "$GIVEN" = "$2" ]; then
		msgpass
	else
		echo
		echo "$GIVEN"
		msgfail
	fi
}

# non-multiarch or "ubuntus" old multiarchified dpkg
echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
echo '#! /bin/sh
if echo "$*" | grep -q -- "--assert-multi-arch"; then
	echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
	echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
	return 2;
fi
return $*' > ./dpkg-wrapper
chmod +x ./dpkg-wrapper

testqualifier 'native-pkg' 'native-pkg'
testqualifier 'native-pkg:amd64' 'native-pkg'
testqualifier 'foreign-pkg' 'foreign-pkg:i386'
testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
testqualifier 'same-lib' 'same-lib'
testqualifier 'same-lib:amd64' 'same-lib'
testqualifier 'same-lib:i386' 'same-lib:i386'

# multiarch dpkg (new interface version)

echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
echo '#! /bin/sh
if echo "$*" | grep -q -- "--assert-multi-arch"; then
	return 0;
fi
return $*' > ./dpkg-wrapper

testqualifier 'native-pkg' 'native-pkg:amd64'
testqualifier 'native-pkg:amd64' 'native-pkg:amd64'
testqualifier 'foreign-pkg' 'foreign-pkg:i386'
testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
testqualifier 'same-lib' 'same-lib:amd64'
testqualifier 'same-lib:amd64' 'same-lib:amd64'
testqualifier 'same-lib:i386' 'same-lib:i386'