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'
15 buildsimplenativepackage 'foo' 'amd64' '1' 'unstable'
17 setupaptarchive --no-update
20 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
21 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
22 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
23 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
24 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0 " aptget update --print-uris
26 testsuccessequal "Get
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
[$(stat -c%s aptarchive/dists/unstable/InRelease) B
]
27 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main Sources
[$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B
]
28 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Packages
[$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B
]
29 Get
:4 http
://localhost
:${APTHTTPPORT} unstable
/main all Packages
[$(stat -c%s aptarchive/dists/unstable/main/binary-all/Packages.gz) B
]
30 Get
:5 http
://localhost
:${APTHTTPPORT} unstable
/main Translation
-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B
]
31 Reading package lists...
" aptget update
33 testempty find rootdir/var/lib/apt/lists -name '*Contents*'
35 msgmsg "Normal Contents
file"
36 cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
37 Acquire::IndexTargets::deb::Contents {
38 MetaKey "\
$(COMPONENT)/Contents
-\
$(ARCHITECTURE)";
39 ShortDescription "Contents
";
40 Description "\
$(RELEASE)/\
$(COMPONENT) \
$(ARCHITECTURE) Contents
";
46 readlink -f ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_
${1}"
51 testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --no-release-info --format '$(FILENAME)' 'Created-By: Contents'
52 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
53 # lets fake the existence of a compressed Contents file
54 touch ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
"
55 testequal "$(readfile Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
56 touch ".
/rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
"
57 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
59 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
60 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
61 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
62 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
63 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
64 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64 0
65 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all 0 " aptget update --print-uris
67 # apt believes the Contents files we faked are good
68 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
69 Reading package lists...
" aptget update
70 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
72 find rootdir/var/lib/apt/lists -name '*Contents*' -delete
74 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
75 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
76 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
77 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
78 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
79 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64 0
80 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all 0 " aptget update --print-uris
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" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
88 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all" find rootdir/var/lib/apt/lists -name '*Contents-all*'
89 testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
90 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64" 'aptarchive/dists/unstable/main/Contents-amd64'
91 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all" 'aptarchive/dists/unstable/main/Contents-all'
93 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 \
94 ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all
95 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
97 # if we asked for keeping it compressed, keep it
98 msgmsg "Normal Contents
file with KeepCompressed
"
99 echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true
";' >> rootdir/etc/apt/apt.conf.d/content-target.conf
100 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
101 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B
]
102 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main all Contents
[$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B
]
103 Reading package lists...
" aptget update
105 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.
$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
106 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.
$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-all*'
107 testequal "$(readfile Contents-amd64.$LOWCOSTEXT Contents-all.$LOWCOSTEXT)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
108 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'
109 testempty apthelper cat-file rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT
111 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.$LOWCOSTEXT
112 rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT
113 testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
115 msgmsg "Compressed Contents
file"
116 # and no automatic uncompress based on the name please,
117 # only if we downloaded a compressed file, but target was uncompressed
118 cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
119 Acquire::IndexTargets::deb::Contents {
120 MetaKey "\
$(COMPONENT)/Contents
-\
$(ARCHITECTURE).gz
";
121 ShortDescription "Contents.gz
";
122 Description "\
$(RELEASE)/\
$(COMPONENT) \
$(ARCHITECTURE) Contents.gz
";
126 # the last line is utter bogus of course, but how should apt know…
127 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
128 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
129 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
130 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
131 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0
132 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.gz.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
0
133 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.gz.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
0 " aptget update --print-uris
135 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
136 Get
:2 http
://localhost
:${APTHTTPPORT} unstable
/main amd64 Contents.gz
[$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B
]
137 Get
:3 http
://localhost
:${APTHTTPPORT} unstable
/main all Contents.gz
[$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B
]
138 Reading package lists...
" aptget update
140 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
" find rootdir/var/lib/apt/lists -name '*Contents-amd64*'
141 testequal "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
" find rootdir/var/lib/apt/lists -name '*Contents-all*'
142 testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
143 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-amd64.gz
" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
144 testsuccess cmp "rootdir
/var
/lib
/apt
/lists
/localhost
:${APTHTTPPORT}_dists_unstable_main_Contents
-all.gz
" 'aptarchive/dists/unstable/main/Contents-all.gz'
146 rm -f rootdir/etc/apt/apt.conf.d/content-target.conf
147 msgmsg "No Contents
file"
149 testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost
:${APTHTTPPORT}_dists_unstable_InRelease
0
150 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_source_Sources
0
151 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-amd64_Packages 0
152 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_binary
-all_Packages 0
153 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost
:${APTHTTPPORT}_dists_unstable_main_i18n_Translation
-en 0 " aptget update --print-uris
155 testsuccessequal "Hit
:1 http
://localhost
:${APTHTTPPORT} unstable InRelease
156 Reading package lists...
" aptget update
158 testempty find rootdir/var/lib/apt/lists -name '*Contents*'