]> git.saurik.com Git - apt.git/blob - test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
implement arch+= and arch-= for sources.list
[apt.git] / test / integration / test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
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 'toolkit' 'all' '1' 'stable' 'Multi-Arch: foreign'
10 buildsimplenativepackage 'toolkit' 'amd64' '2' 'unstable' 'Multi-Arch: foreign'
11 buildsimplenativepackage 'libsame' 'i386,amd64' '1' 'stable' 'Multi-Arch: same'
12 buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same'
13 buildsimplenativepackage 'stuff' 'i386,amd64' '1' 'stable' 'Depends: libsame (= 1), toolkit (= 1)'
14 buildsimplenativepackage 'stuff' 'i386,amd64' '2' 'unstable' 'Depends: libsame (= 2), toolkit (= 2)'
15
16 setupaptarchive
17
18 hook='pre-install-pkgs'
19
20 enablehookversion() {
21 echo "#!/bin/sh
22 while read line; do
23 if echo \"\$line\" | grep -Fq '**'; then
24 echo \"\$line\"
25 fi
26 done > ${hook}-v${1}.list" > ${hook}-v${1}.sh
27 chmod +x ${hook}-v${1}.sh
28 echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
29 DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1
30 }
31
32 enablehookversion 2
33 enablehookversion 3
34
35 observehook() {
36 rm -f ${hook}-v2.list ${hook}-v3.list
37 msgtest 'Observe hooks while' "$*"
38 aptget "$@" -y --force-yes >/dev/null 2>&1 && msgpass || msgfail
39 }
40
41 observehook install stuff -t stable
42 testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
43 toolkit - < 1 **CONFIGURE**
44 stuff - < 1 **CONFIGURE**'
45 testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
46 toolkit - - none < 1 all foreign **CONFIGURE**
47 stuff - - none < 1 amd64 none **CONFIGURE**'
48
49 observehook install stuff -t unstable
50 testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
51 toolkit 1 < 2 **CONFIGURE**
52 stuff 1 < 2 **CONFIGURE**'
53 testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
54 toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
55 stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
56
57 observehook install stuff:i386 -t unstable
58 testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE**
59 libsame - < 2 **CONFIGURE**
60 stuff - < 2 **CONFIGURE**'
61 testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
62 libsame - - none < 2 i386 same **CONFIGURE**
63 stuff - - none < 2 i386 none **CONFIGURE**'
64
65 observehook remove libsame
66 testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**'
67 testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
68
69 observehook install stuff:i386/stable libsame:i386/stable toolkit/stable
70 testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
71 toolkit 2 > 1 **CONFIGURE**
72 stuff 2 > 1 **CONFIGURE**'
73 testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
74 toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
75 stuff 2 i386 none > 1 i386 none **CONFIGURE**'
76
77 observehook install 'libsame:*'
78 testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
79 libsame - < 2 **CONFIGURE**
80 toolkit 1 < 2 **CONFIGURE**
81 stuff 1 < 2 **CONFIGURE**'
82 testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
83 libsame - - none < 2 amd64 same **CONFIGURE**
84 toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
85 stuff 1 i386 none < 2 i386 none **CONFIGURE**'
86
87 observehook purge stuff:i386 'libsame:*' toolkit
88 testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**
89 stuff 2 > - **REMOVE**
90 libsame 2 > - **REMOVE**
91 toolkit 2 > - **REMOVE**'
92 testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
93 stuff 2 i386 none > - - none **REMOVE**
94 libsame 2 i386 same > - - none **REMOVE**
95 toolkit 2 amd64 foreign > - - none **REMOVE**'