4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'amd64'
10 # apt-extracttemplates needs this
11 insertinstalledpackage
'pkg-with-template' 'amd64' '1.0'
13 # build a simple package that contains a config and a tempalte
18 echo "$CONFIG_STR" > DEBIAN
/config
21 local TEMPLATE_STR
='Template: foo/bar
23 Description: Some bar var
25 echo "$TEMPLATE_STR" > DEBIAN
/templates
26 buildsimplenativepackage
"$1" 'amd64' '0.8.15' 'stable' "$2" 'pkg with template' '' '' './DEBIAN'
28 cp dpkg.status rootdir
/var
/lib
/dpkg
/status
29 insertinstalledpackage
'debconf' 'amd64' '3'
31 # ensure we get the right stuff out of the file
32 rm -rf extracttemplates
-out rootdir
/var
/cache
/apt
33 mkdir extracttemplates
-out
34 testsuccess aptextracttemplates
-t .
/extracttemplates
-out incoming
/${1}*.deb
35 OUT
='rootdir/tmp/testsuccess.output'
36 testequal
"$1" cut
-f1 -d' ' $OUT
38 testequal
'' cut
-s -f2 -d' ' $OUT
40 testequal
'1.0' cut
-f2 -d' ' $OUT
42 TEMPLATE
=$(cut -f3 -d' ' $OUT)
43 testfileequal
"$TEMPLATE" "$TEMPLATE_STR"
44 CONFIG
=$(cut -f4 -d' ' $OUT)
45 testfileequal
"$CONFIG" "$CONFIG_STR"
47 # ensure that the format of the output string has the right number of dots
48 for s
in "$CONFIG" "$TEMPLATE"; do
49 NR_DOTS
=$(basename "$s" | tr -c -d '.')
50 testequal
'..' echo $NR_DOTS
54 rm -rf extracttemplates
-out rootdir
/var
/cache
/apt
55 mkdir extracttemplates
-out
56 cp dpkg.status rootdir
/var
/lib
/dpkg
/status
57 insertinstalledpackage
'debconf' 'amd64' '1'
58 testempty aptextracttemplates
-t .
/extracttemplates
-out incoming
/${1}*.deb
62 cp rootdir
/var
/lib
/dpkg
/status dpkg.status
63 testrun
'pkg-with-template' ''
64 testrun
'pkg-with-template-depends' 'Depends: debconf (>= 2)'
65 testrun
'pkg-with-template-predepends' 'Pre-Depends: debconf (>= 2)'
67 # test with no debconf installed
68 cp dpkg.status rootdir
/var
/lib
/dpkg
/status
69 testfailure aptextracttemplates
-t .
/extracttemplates
-out incoming
/pkg
-with-template-depends*.deb
70 testfileequal
'rootdir/tmp/testfailure.output' 'E: Cannot get debconf version. Is debconf installed?'