6 TESTDIR
="$(readlink -f "$(dirname "$0")")"
10 configarchitecture 'amd64'
12 # note that in --print-uri we talk about .xz because that is the default.
13 # This doesn't mean it is actually attempt to download it.
14 configcompression '.' 'gz'
17 buildsimplenativepackage 'foo' 'amd64' '1' 'unstable'
18 buildsimplenativepackage 'bar' 'all' '1' 'unstable'
20 setupaptarchive --no-update
23 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
24 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
25 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
26 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
27 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0 " aptget update --print-uris
29 testsuccessequal "Get
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
[$(stat -c%s aptarchive/dists/unstable/InRelease) B
]
30 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
[$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B
]
31 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
[$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B
]
32 Get
:4 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
[$(stat -c%s aptarchive/dists/unstable/main/binary-all/Packages.gz) B
]
33 Get
:5 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B
]
34 Reading package lists...
" aptget update
36 testempty find rootdir/var/lib/apt/lists -name '*Contents*'
38 msgmsg "Normal Contents
file"
39 cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
40 Acquire::IndexTargets::deb::Contents {
41 MetaKey "\
$(COMPONENT)/Contents
-\
$(ARCHITECTURE)";
42 ShortDescription "Contents
";
43 Description "\
$(RELEASE)/\
$(COMPONENT) \
$(ARCHITECTURE) Contents
";
49 readlink -f ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_
${1}"
54 testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --no-release-info --format '$(FILENAME)' 'Created-By: Contents'
55 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
56 # lets fake the existence of a compressed Contents file
57 touch ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
"
58 chmod 644 ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
"
59 testequal "$(readfile Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
60 touch ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
"
61 chmod 644 ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
"
62 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
64 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
65 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
66 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
67 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
68 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
69 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64 0
70 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all 0 " aptget update --print-uris
72 # apt believes the Contents files we faked are good
73 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
74 Reading package lists...
" aptget update
75 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
77 find rootdir/var/lib/apt/lists -name '*Contents*' -delete
79 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
80 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
81 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
82 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
83 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
84 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64 0
85 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all 0 " aptget update --print-uris
87 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
88 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B
]
89 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main all Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B
]
90 Reading package lists...
" aptget update
92 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
93 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all" find rootdir/var/lib/apt/lists -name '*Contents-all*'
94 testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
95 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64" 'aptarchive/dists/unstable/main/Contents-amd64'
96 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all" 'aptarchive/dists/unstable/main/Contents-all'
98 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 \
99 ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all
100 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
102 # if we asked for keeping it compressed, keep it
103 msgmsg "Normal Contents
file with KeepCompressed
"
104 echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true
";' >> rootdir/etc/apt/apt.conf.d/content-target.conf
105 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
106 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B
]
107 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main all Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B
]
108 Reading package lists...
" aptget update
110 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.
$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
111 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.
$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-all*'
112 testequal "$(readfile Contents-amd64.$LOWCOSTEXT Contents-all.$LOWCOSTEXT)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
113 testequal "$(apthelper cat-file rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.$LOWCOSTEXT)" apthelper cat-file 'aptarchive/dists/unstable/main/Contents-amd64.gz'
114 testequal "$(apthelper cat-file rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT)" apthelper cat-file 'aptarchive/dists/unstable/main/Contents-all.gz'
116 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.$LOWCOSTEXT
117 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT
118 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
120 msgmsg "Compressed Contents
file"
121 # and no automatic uncompress based on the name please,
122 # only if we downloaded a compressed file, but target was uncompressed
123 cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
124 Acquire::IndexTargets::deb::Contents {
125 MetaKey "\
$(COMPONENT)/Contents
-\
$(ARCHITECTURE).gz
";
126 ShortDescription "Contents.gz
";
127 Description "\
$(RELEASE)/\
$(COMPONENT) \
$(ARCHITECTURE) Contents.gz
";
131 # the last line is utter bogus of course, but how should apt know…
132 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
133 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
134 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
135 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
136 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
137 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.gz.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
0
138 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.gz.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
0 " aptget update --print-uris
140 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
141 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Contents.gz
[$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B
]
142 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main all Contents.gz
[$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B
]
143 Reading package lists...
" aptget update
145 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
146 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
" find rootdir/var/lib/apt/lists -name '*Contents-all*'
147 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
148 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
149 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
" 'aptarchive/dists/unstable/main/Contents-all.gz'
151 rm -f rootdir/etc/apt/apt.conf.d/content-target.conf
152 msgmsg "No Contents
file"
154 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
155 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
156 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
157 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
158 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0 " aptget update --print-uris
160 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
161 Reading package lists...
" aptget update
163 testempty find rootdir/var/lib/apt/lists -name '*Contents*'