4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'amd64'
10 # note that in --print-uri we talk about .xz because that is the default.
11 # This doesn't mean it is actually attempt to download it.
12 configcompression
'.' 'gz'
14 buildsimplenativepackage
'foo' 'amd64' '1' 'unstable'
16 setupaptarchive
--no-update
19 testequal
"'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
20 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
21 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
22 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0
23 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update
--print-uris
25 testsuccessequal
"Get:1 http://localhost:${APTHTTPPORT} unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B]
26 Get:2 http://localhost:${APTHTTPPORT} unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B]
27 Get:3 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B]
28 Get:4 http://localhost:${APTHTTPPORT} unstable/main all Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-all/Packages.gz) B]
29 Get:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
30 Reading package lists..." aptget update
32 testempty
find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'
34 cat > rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
<<EOF
35 Acquire::IndexTargets::deb::Contents {
36 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
37 ShortDescription "Contents";
38 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
44 readlink
-f "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_${1}"
49 testequal
"$(readfile Contents-amd64 Contents-all)" aptget indextargets
--no-release-info --format '$(FILENAME)' 'Created-By: Contents'
50 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
51 # lets fake the existence of a compressed Contents file
52 touch "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz"
53 testequal
"$(readfile Contents-amd64.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
54 touch "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz"
55 testequal
"$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
57 testequal
"'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
58 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
59 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
60 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0
61 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0
62 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 0
63 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all 0 " aptget update
--print-uris
65 testsuccessequal
"Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
66 Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
67 Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B]
68 Reading package lists..." aptget update
70 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-amd64*'
71 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-all*'
72 testequal
"$(readfile Contents-amd64 Contents-all)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
73 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" 'aptarchive/dists/unstable/main/Contents-amd64'
74 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all" 'aptarchive/dists/unstable/main/Contents-all'
76 rm .
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64 \
77 .
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all
78 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
80 # if we asked for keeping it compressed, keep it
81 echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true";' >> rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
82 testsuccessequal
"Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
83 Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
84 Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B]
85 Reading package lists..." aptget update
87 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-amd64*'
88 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-all*'
89 testequal
"$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
90 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
91 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" 'aptarchive/dists/unstable/main/Contents-all.gz'
93 rm .
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
94 rm .
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
95 testempty aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
97 # and no automatic uncompress based on the name please,
98 # only if we downloaded a compressed file, but target was uncompressed
99 cat > rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
<<EOF
100 Acquire::IndexTargets::deb::Contents {
101 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz";
102 ShortDescription "Contents.gz";
103 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz";
107 # the last line is utter bogus of course, but how should apt know…
108 testequal
"'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
109 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
110 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
111 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0
112 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0
113 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.gz.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz 0
114 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.gz.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz 0 " aptget update
--print-uris
116 testsuccessequal
"Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
117 Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
118 Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B]
119 Reading package lists..." aptget update
121 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-amd64*'
122 testequal
"rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" find rootdir
/var
/lib
/apt
/lists
-name '*Contents-all*'
123 testequal
"$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets
--format '$(FILENAME)' 'Created-By: Contents'
124 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
125 testsuccess
cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" 'aptarchive/dists/unstable/main/Contents-all.gz'
127 rm -f rootdir
/etc
/apt
/apt.conf.d
/content
-target.conf
129 testequal
"'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
130 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
131 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
132 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0
133 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update
--print-uris
135 testsuccessequal
"Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
136 Reading package lists..." aptget update
138 testempty
find rootdir
/var
/lib
/apt
/lists
-name '*Contents*'