]>
Commit | Line | Data |
---|---|---|
7a948ec7 DK |
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 | ||
86fdeec2 DK |
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' | |
21 | rm -rf "$BUILDDIR" | |
22 | ||
7a948ec7 DK |
23 | setupaptarchive |
24 | ||
25 | hook='pre-install-pkgs' | |
26 | ||
27 | enablehookversion() { | |
28 | echo "#!/bin/sh | |
29 | while read line; do | |
30 | if echo \"\$line\" | grep -Fq '**'; then | |
31 | echo \"\$line\" | |
32 | fi | |
33 | done > ${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\"; | |
36 | DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1 | |
37 | } | |
38 | ||
39 | enablehookversion 2 | |
40 | enablehookversion 3 | |
41 | ||
42 | observehook() { | |
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 | ||
48 | observehook install stuff -t stable | |
49 | testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE** | |
50 | toolkit - < 1 **CONFIGURE** | |
51 | stuff - < 1 **CONFIGURE**' | |
52 | testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE** | |
53 | toolkit - - none < 1 all foreign **CONFIGURE** | |
54 | stuff - - none < 1 amd64 none **CONFIGURE**' | |
55 | ||
56 | observehook install stuff -t unstable | |
57 | testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** | |
58 | toolkit 1 < 2 **CONFIGURE** | |
59 | stuff 1 < 2 **CONFIGURE**' | |
60 | testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE** | |
61 | toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** | |
62 | stuff 1 amd64 none < 2 amd64 none **CONFIGURE**' | |
63 | ||
64 | observehook install stuff:i386 -t unstable | |
65 | testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE** | |
66 | libsame - < 2 **CONFIGURE** | |
67 | stuff - < 2 **CONFIGURE**' | |
68 | testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE** | |
69 | libsame - - none < 2 i386 same **CONFIGURE** | |
70 | stuff - - none < 2 i386 none **CONFIGURE**' | |
71 | ||
72 | observehook remove libsame | |
73 | testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**' | |
74 | testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**' | |
75 | ||
76 | observehook install stuff:i386/stable libsame:i386/stable toolkit/stable | |
77 | testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE** | |
78 | toolkit 2 > 1 **CONFIGURE** | |
79 | stuff 2 > 1 **CONFIGURE**' | |
80 | testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE** | |
81 | toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE** | |
82 | stuff 2 i386 none > 1 i386 none **CONFIGURE**' | |
83 | ||
84 | observehook install 'libsame:*' | |
85 | testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** | |
86 | libsame - < 2 **CONFIGURE** | |
87 | toolkit 1 < 2 **CONFIGURE** | |
88 | stuff 1 < 2 **CONFIGURE**' | |
89 | testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE** | |
90 | libsame - - none < 2 amd64 same **CONFIGURE** | |
91 | toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** | |
92 | stuff 1 i386 none < 2 i386 none **CONFIGURE**' | |
93 | ||
94 | observehook purge stuff:i386 'libsame:*' toolkit | |
95 | testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE** | |
96 | stuff 2 > - **REMOVE** | |
97 | libsame 2 > - **REMOVE** | |
98 | toolkit 2 > - **REMOVE**' | |
99 | testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE** | |
100 | stuff 2 i386 none > - - none **REMOVE** | |
101 | libsame 2 i386 same > - - none **REMOVE** | |
102 | toolkit 2 amd64 foreign > - - none **REMOVE**' | |
86fdeec2 DK |
103 | |
104 | observehook install confpkg | |
105 | testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**' | |
106 | testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**' | |
107 | ||
108 | observehook remove confpkg | |
109 | testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' | |
110 | testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' | |
111 | ||
112 | msgtest 'Conffiles of package remained after remove' 'confpkg' | |
113 | dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail | |
114 | ||
115 | observehook purge confpkg | |
116 | testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' | |
117 | testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' | |
118 | ||
119 | msgtest 'Conffiles are gone after purge' 'confpkg' | |
120 | dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass |