]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
allow ':' in GetListOfFilesInDir
[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
48498443
DK
29FD=0
30echo -n > ${hook}-v${1}.list
31if [ -n \"${2}\" ]; then
32 FD=\$APT_HOOK_INFO_FD
33 if [ "\$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi
34fi
35while read </proc/\$\$/fd/\$FD line; do
7a948ec7
DK
36 if echo \"\$line\" | grep -Fq '**'; then
37 echo \"\$line\"
38 fi
48498443 39done >> ${hook}-v${1}.list" > ${hook}-v${1}.sh
7a948ec7
DK
40 chmod +x ${hook}-v${1}.sh
41 echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
42DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1
48498443
DK
43 if [ -n "$2" ]; then
44 echo "DPkg::Tools::options::\"./${hook}-v${1}.sh\"::InfoFD \"${2}\";" >> rootdir/etc/apt/apt.conf.d/hook-v$1
45 fi
7a948ec7
DK
46}
47
7a948ec7
DK
48observehook() {
49 rm -f ${hook}-v2.list ${hook}-v3.list
50 msgtest 'Observe hooks while' "$*"
0440d936 51 testsuccess --nomsg aptget "$@" -y --force-yes
7a948ec7
DK
52}
53
48498443
DK
54testrun() {
55 observehook install stuff -t stable
56 testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
7a948ec7
DK
57toolkit - < 1 **CONFIGURE**
58stuff - < 1 **CONFIGURE**'
48498443 59 testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
7a948ec7
DK
60toolkit - - none < 1 all foreign **CONFIGURE**
61stuff - - none < 1 amd64 none **CONFIGURE**'
62
48498443
DK
63 observehook install stuff -t unstable
64 testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
7a948ec7
DK
65toolkit 1 < 2 **CONFIGURE**
66stuff 1 < 2 **CONFIGURE**'
48498443 67 testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
7a948ec7
DK
68toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
69stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
70
48498443
DK
71 observehook install stuff:i386 -t unstable
72 testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE**
7a948ec7
DK
73libsame - < 2 **CONFIGURE**
74stuff - < 2 **CONFIGURE**'
48498443 75 testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
7a948ec7
DK
76libsame - - none < 2 i386 same **CONFIGURE**
77stuff - - none < 2 i386 none **CONFIGURE**'
78
48498443
DK
79 observehook remove libsame
80 testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**'
81 testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
7a948ec7 82
48498443
DK
83 observehook install stuff:i386/stable libsame:i386/stable toolkit/stable
84 testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
7a948ec7
DK
85toolkit 2 > 1 **CONFIGURE**
86stuff 2 > 1 **CONFIGURE**'
48498443 87 testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
7a948ec7
DK
88toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
89stuff 2 i386 none > 1 i386 none **CONFIGURE**'
90
48498443
DK
91 observehook install 'libsame:*'
92 testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
7a948ec7
DK
93libsame - < 2 **CONFIGURE**
94toolkit 1 < 2 **CONFIGURE**
95stuff 1 < 2 **CONFIGURE**'
48498443 96 testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
7a948ec7
DK
97libsame - - none < 2 amd64 same **CONFIGURE**
98toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
99stuff 1 i386 none < 2 i386 none **CONFIGURE**'
100
48498443
DK
101 observehook purge stuff:i386 'libsame:*' toolkit
102 testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**
7a948ec7
DK
103stuff 2 > - **REMOVE**
104libsame 2 > - **REMOVE**
105toolkit 2 > - **REMOVE**'
48498443 106 testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
7a948ec7
DK
107stuff 2 i386 none > - - none **REMOVE**
108libsame 2 i386 same > - - none **REMOVE**
109toolkit 2 amd64 foreign > - - none **REMOVE**'
86fdeec2 110
48498443
DK
111 observehook install confpkg
112 testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**'
113 testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**'
114
115 observehook remove confpkg
116 testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
117 testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
86fdeec2 118
48498443
DK
119 msgtest 'Conffiles of package remained after remove' 'confpkg'
120 dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail
86fdeec2 121
48498443
DK
122 observehook purge confpkg
123 testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
124 testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
86fdeec2 125
48498443
DK
126 msgtest 'Conffiles are gone after purge' 'confpkg'
127 dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass
128}
129
130enablehookversion 2
131enablehookversion 3
132testrun
86fdeec2 133
48498443
DK
134enablehookversion 2 13
135enablehookversion 3 13
136testrun