4 TESTDIR
=$(readlink -f $(dirname $0))
7 configarchitecture
'amd64' 'i386'
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)'
16 setupsimplenativepackage
'confpkg' 'amd64' '1' 'unstable'
17 BUILDDIR
='incoming/confpkg-1'
18 echo 'foo "bar";' > ${BUILDDIR}/pkg.conf
19 echo 'pkg.conf /etc/pkg.conf' >> ${BUILDDIR}/debian
/install
20 buildpackage
"$BUILDDIR" 'unstable' 'main' 'amd64'
25 hook
='pre-install-pkgs'
30 echo -n > ${hook}-v${1}.list
31 if [ -n \"${2}\" ]; then
33 if [ "\
$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi
35 while read </proc/\$\$/fd/\$FD line; do
36 if echo \"\$line\" | grep -Fq '**'; then
39 done >> ${hook}-v${1}.list" > ${hook}-v${1}.sh
40 chmod +x
${hook}-v${1}.sh
41 echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\";
42 DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir
/etc
/apt
/apt.conf.d
/hook
-v$1
44 echo "DPkg::Tools::options::\"./${hook}-v${1}.sh\"::InfoFD \"${2}\";" >> rootdir
/etc
/apt
/apt.conf.d
/hook
-v$1
49 rm -f ${hook}-v2.list
${hook}-v3.list
50 msgtest
'Observe hooks while' "$*"
51 testsuccess
--nomsg aptget
"$@" -y --allow-downgrades
55 observehook
install stuff
-t stable
56 testfileequal
"${hook}-v2.list" 'libsame - < 1 **CONFIGURE**
57 toolkit - < 1 **CONFIGURE**
58 stuff - < 1 **CONFIGURE**'
59 testfileequal
"${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE**
60 toolkit - - none < 1 all foreign **CONFIGURE**
61 stuff - - none < 1 amd64 none **CONFIGURE**'
63 observehook
install stuff
-t unstable
64 testfileequal
"${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
65 toolkit 1 < 2 **CONFIGURE**
66 stuff 1 < 2 **CONFIGURE**'
67 testfileequal
"${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE**
68 toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
69 stuff 1 amd64 none < 2 amd64 none **CONFIGURE**'
71 observehook
install stuff
:i386
-t unstable
72 testfileequal
"${hook}-v2.list" 'stuff 2 > - **REMOVE**
73 libsame - < 2 **CONFIGURE**
74 stuff - < 2 **CONFIGURE**'
75 testfileequal
"${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE**
76 libsame - - none < 2 i386 same **CONFIGURE**
77 stuff - - none < 2 i386 none **CONFIGURE**'
79 observehook remove libsame
80 testfileequal
"${hook}-v2.list" 'libsame 2 > - **REMOVE**'
81 testfileequal
"${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**'
83 observehook
install stuff
:i
386/stable libsame
:i
386/stable toolkit
/stable
84 testfileequal
"${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE**
85 toolkit 2 > 1 **CONFIGURE**
86 stuff 2 > 1 **CONFIGURE**'
87 testfileequal
"${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE**
88 toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE**
89 stuff 2 i386 none > 1 i386 none **CONFIGURE**'
91 observehook
install 'libsame:*'
92 testfileequal
"${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE**
93 libsame - < 2 **CONFIGURE**
94 toolkit 1 < 2 **CONFIGURE**
95 stuff 1 < 2 **CONFIGURE**'
96 testfileequal
"${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE**
97 libsame - - none < 2 amd64 same **CONFIGURE**
98 toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE**
99 stuff 1 i386 none < 2 i386 none **CONFIGURE**'
101 observehook purge stuff
:i386
'libsame:*' toolkit
102 testfileequal
"${hook}-v2.list" 'libsame 2 > - **REMOVE**
103 stuff 2 > - **REMOVE**
104 libsame 2 > - **REMOVE**
105 toolkit 2 > - **REMOVE**'
106 testfileequal
"${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**
107 stuff 2 i386 none > - - none **REMOVE**
108 libsame 2 i386 same > - - none **REMOVE**
109 toolkit 2 amd64 foreign > - - none **REMOVE**'
111 observehook
install confpkg
112 testfileequal
"${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**'
113 testfileequal
"${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**'
115 observehook remove confpkg
116 testfileequal
"${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
117 testfileequal
"${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
119 msgtest
'Conffiles of package remained after remove' 'confpkg'
120 dpkg
-l confpkg
| grep -q '^rc' && msgpass
|| msgfail
122 observehook purge confpkg
123 testfileequal
"${hook}-v2.list" 'confpkg 1 > - **REMOVE**'
124 testfileequal
"${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**'
126 msgtest
'Conffiles are gone after purge' 'confpkg'
127 dpkg
-l confpkg
2>/dev
/null
| grep -q '^rc' && msgfail
|| msgpass
134 enablehookversion
2 13
135 enablehookversion
3 13