summaryrefslogtreecommitdiff
path: root/test/integration/test-bug-612958-use-dpkg-multiarch-config
blob: 4f31c395361bdccaf3403034b3ee60190487c128 (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
#!/bin/sh
set -e

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

insertinstalledpackage 'libapt' 'i386' '1.0'
insertinstalledpackage 'libapt' 'amd64' '1.0'
insertinstalledpackage 'libapt' 'armel' '1.0'

testpass() {
	rm rootdir/var/cache/apt/*.bin
	msgtest 'Test architecture handling' "$1 with $2"
	aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail
}

testfail() {
	rm rootdir/var/cache/apt/*.bin
	msgtest 'Test architecture handling' "$1 with $2"
	aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass
}

testpass 'no config' 'i386'
testfail 'no config' 'amd64'
testfail 'no config' 'armel'

CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch
echo '#clear APT::Architectures;' >> $CONFFILE
echo 'APT::Architectures:: "i386";' >> $CONFFILE
echo 'APT::Architectures:: "amd64";' >> $CONFFILE

testpass 'apt config' 'i386'
testpass 'apt config' 'amd64'
testfail 'apt config' 'armel'

echo 'APT::Architectures:: "armel";' >> $CONFFILE

testpass 'apt config' 'armel'

rm $CONFFILE

echo '#clear APT::Architectures;' >> $CONFFILE
echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE

echo '#! /bin/sh
echo "amd64"' > ./dpkg-printer
chmod +x ./dpkg-printer

testpass 'dpkg config' 'i386'
testpass 'dpkg config' 'amd64'
testfail 'dpkg config' 'armel'

echo '#! /bin/sh
echo "amd64 armel"' > ./dpkg-printer

testpass 'dpkg config' 'armel'