]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
add chronic-like testsuccess/testfailure helpers
[apt.git] / test / integration / test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
CommitLineData
7a948ec7
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9buildsimplenativepackage 'toolkit' 'all' '1' 'stable' 'Multi-Arch: foreign'
10buildsimplenativepackage 'toolkit' 'amd64' '2' 'unstable' 'Multi-Arch: foreign'
11buildsimplenativepackage 'libsame' 'i386,amd64' '1' 'stable' 'Multi-Arch: same'
12buildsimplenativepackage 'libsame' 'i386,amd64' '2' 'unstable' 'Multi-Arch: same'
13buildsimplenativepackage 'stuff' 'i386,amd64' '1' 'stable' 'Depends: libsame (= 1), toolkit (= 1)'
14buildsimplenativepackage 'stuff' 'i386,amd64' '2' 'unstable' 'Depends: libsame (= 2), toolkit (= 2)'
15
86fdeec2
DK
16setupsimplenativepackage 'confpkg' 'amd64' '1' 'unstable'
17BUILDDIR='incoming/confpkg-1'
18echo 'foo "bar";' > ${BUILDDIR}/pkg.conf
19echo 'pkg.conf /etc/pkg.conf' >> ${BUILDDIR}/debian/install
20buildpackage "$BUILDDIR" 'unstable' 'main' 'amd64'
21rm -rf "$BUILDDIR"
22
7a948ec7
DK
23setupaptarchive
24
25hook='pre-install-pkgs'
26
27enablehookversion() {
28 echo "#!/bin/sh
29while read line; do
30 if echo \"\$line\" | grep -Fq '**'; then
31 echo \"\$line\"
32 fi
33done > ${hook}-v${1}.list" > ${hook}-v${1}.sh
34 chmod +x ${hook}-v${1}.sh
35 echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
36DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1
37}
38
39enablehookversion 2
40enablehookversion 3
41
42observehook() {
43 rm -f ${hook}-v2.list ${hook}-v3.list
44 msgtest 'Observe hooks while' "$*"
0440d936 45 testsuccess --nomsg aptget "$@" -y --force-yes
7a948ec7
DK
46}
47
48observehook install stuff -t stable
49testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
50toolkit - < 1 **CONFIGURE**
51stuff - < 1 **CONFIGURE**'
52testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
53toolkit - - none < 1 all foreign **CONFIGURE**
54stuff - - none < 1 amd64 none **CONFIGURE**'
55
56observehook install stuff -t unstable
57testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
58toolkit 1 < 2 **CONFIGURE**
59stuff 1 < 2 **CONFIGURE**'
60testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
61toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
62stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
63
64observehook install stuff:i386 -t unstable
65testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE**
66libsame - < 2 **CONFIGURE**
67stuff - < 2 **CONFIGURE**'
68testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
69libsame - - none < 2 i386 same **CONFIGURE**
70stuff - - none < 2 i386 none **CONFIGURE**'
71
72observehook remove libsame
73testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**'
74testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
75
76observehook install stuff:i386/stable libsame:i386/stable toolkit/stable
77testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
78toolkit 2 > 1 **CONFIGURE**
79stuff 2 > 1 **CONFIGURE**'
80testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
81toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
82stuff 2 i386 none > 1 i386 none **CONFIGURE**'
83
84observehook install 'libsame:*'
85testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
86libsame - < 2 **CONFIGURE**
87toolkit 1 < 2 **CONFIGURE**
88stuff 1 < 2 **CONFIGURE**'
89testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
90libsame - - none < 2 amd64 same **CONFIGURE**
91toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
92stuff 1 i386 none < 2 i386 none **CONFIGURE**'
93
94observehook purge stuff:i386 'libsame:*' toolkit
95testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**
96stuff 2 > - **REMOVE**
97libsame 2 > - **REMOVE**
98toolkit 2 > - **REMOVE**'
99testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
100stuff 2 i386 none > - - none **REMOVE**
101libsame 2 i386 same > - - none **REMOVE**
102toolkit 2 amd64 foreign > - - none **REMOVE**'
86fdeec2
DK
103
104observehook install confpkg
105testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**'
106testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**'
107
108observehook remove confpkg
109testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
110testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
111
112msgtest 'Conffiles of package remained after remove' 'confpkg'
113dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail
114
115observehook purge confpkg
116testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
117testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
118
119msgtest 'Conffiles are gone after purge' 'confpkg'
120dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass