]>
Commit | Line | Data |
---|---|---|
1e0f0f28 DK |
1 | #!/bin/sh |
2 | set -e | |
7d2794a2 JAK |
3 | # Cause umask failures |
4 | umask 000 | |
1e0f0f28 | 5 | |
3abb6a6a DK |
6 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
7 | . "$TESTDIR/framework" | |
1e0f0f28 DK |
8 | |
9 | setupenvironment | |
10 | configarchitecture 'amd64' | |
59148d96 | 11 | |
e93b4028 | 12 | # note that in --print-uri we talk about .xz because that is the default. |
59148d96 | 13 | # This doesn't mean it is actually attempt to download it. |
1e0f0f28 | 14 | configcompression '.' 'gz' |
0179cfa8 | 15 | LOWCOSTEXT='lz4' |
1e0f0f28 DK |
16 | |
17 | buildsimplenativepackage 'foo' 'amd64' '1' 'unstable' | |
18 | ||
19 | setupaptarchive --no-update | |
20 | changetowebserver | |
21 | ||
6c0765c0 DK |
22 | testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0 |
23 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0 | |
24 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0 | |
1dd20368 | 25 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0 |
6c0765c0 DK |
26 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris |
27 | ||
28 | testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B] | |
29 | Get:2 http://localhost:${APTHTTPPORT} unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B] | |
30 | Get:3 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B] | |
1dd20368 DK |
31 | Get:4 http://localhost:${APTHTTPPORT} unstable/main all Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-all/Packages.gz) B] |
32 | Get:5 http://localhost:${APTHTTPPORT} unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] | |
1e0f0f28 DK |
33 | Reading package lists..." aptget update |
34 | ||
35 | testempty find rootdir/var/lib/apt/lists -name '*Contents*' | |
36 | ||
cd46d4eb | 37 | msgmsg "Normal Contents file" |
1e0f0f28 | 38 | cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF |
c2a4a8dd | 39 | Acquire::IndexTargets::deb::Contents { |
d3a869e3 | 40 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; |
1e0f0f28 | 41 | ShortDescription "Contents"; |
c2a4a8dd | 42 | Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; |
1e0f0f28 DK |
43 | }; |
44 | EOF | |
45 | ||
1dd20368 DK |
46 | readfile() { |
47 | while [ -n "$1" ]; do | |
48 | readlink -f "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_${1}" | |
49 | shift | |
50 | done | |
51 | } | |
52 | ||
53 | testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --no-release-info --format '$(FILENAME)' 'Created-By: Contents' | |
c2a4a8dd | 54 | testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' |
3fd89e62 | 55 | # lets fake the existence of a compressed Contents file |
1dd20368 | 56 | touch "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" |
7d2794a2 | 57 | chmod 644 "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" |
1dd20368 DK |
58 | testequal "$(readfile Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' |
59 | touch "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" | |
7d2794a2 | 60 | chmod 644 "./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" |
1dd20368 | 61 | testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' |
3fd89e62 | 62 | |
6c0765c0 DK |
63 | testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0 |
64 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0 | |
65 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0 | |
4e3c5633 DK |
66 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0 |
67 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 | |
68 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 0 | |
69 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all 0 " aptget update --print-uris | |
70 | ||
71 | # apt believes the Contents files we faked are good | |
72 | testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease | |
73 | Reading package lists..." aptget update | |
74 | testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' | |
75 | ||
76 | find rootdir/var/lib/apt/lists -name '*Contents*' -delete | |
77 | ||
78 | testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0 | |
79 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0 | |
80 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0 | |
1dd20368 | 81 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0 |
6c0765c0 | 82 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 |
1dd20368 DK |
83 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 0 |
84 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all 0 " aptget update --print-uris | |
59148d96 | 85 | |
6c0765c0 DK |
86 | testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease |
87 | Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] | |
1dd20368 | 88 | Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B] |
1e0f0f28 DK |
89 | Reading package lists..." aptget update |
90 | ||
1dd20368 DK |
91 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" find rootdir/var/lib/apt/lists -name '*Contents-amd64*' |
92 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all" find rootdir/var/lib/apt/lists -name '*Contents-all*' | |
93 | testequal "$(readfile Contents-amd64 Contents-all)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' | |
6c0765c0 | 94 | testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" 'aptarchive/dists/unstable/main/Contents-amd64' |
1dd20368 | 95 | testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all" 'aptarchive/dists/unstable/main/Contents-all' |
1e0f0f28 | 96 | |
1dd20368 DK |
97 | rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 \ |
98 | ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all | |
c2a4a8dd | 99 | testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' |
653ef26c DK |
100 | |
101 | # if we asked for keeping it compressed, keep it | |
cd46d4eb | 102 | msgmsg "Normal Contents file with KeepCompressed" |
c2a4a8dd | 103 | echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true";' >> rootdir/etc/apt/apt.conf.d/content-target.conf |
6c0765c0 DK |
104 | testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease |
105 | Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] | |
1dd20368 | 106 | Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B] |
653ef26c DK |
107 | Reading package lists..." aptget update |
108 | ||
0179cfa8 DK |
109 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-amd64*' |
110 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT" find rootdir/var/lib/apt/lists -name '*Contents-all*' | |
111 | testequal "$(readfile Contents-amd64.$LOWCOSTEXT Contents-all.$LOWCOSTEXT)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' | |
112 | 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' | |
113 | testempty apthelper cat-file rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT | |
653ef26c | 114 | |
0179cfa8 DK |
115 | rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.$LOWCOSTEXT |
116 | rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.$LOWCOSTEXT | |
c2a4a8dd | 117 | testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' |
653ef26c | 118 | |
cd46d4eb | 119 | msgmsg "Compressed Contents file" |
653ef26c | 120 | # and no automatic uncompress based on the name please, |
1e0f0f28 DK |
121 | # only if we downloaded a compressed file, but target was uncompressed |
122 | cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF | |
c2a4a8dd | 123 | Acquire::IndexTargets::deb::Contents { |
d3a869e3 | 124 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz"; |
1e0f0f28 | 125 | ShortDescription "Contents.gz"; |
c2a4a8dd | 126 | Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz"; |
1e0f0f28 DK |
127 | }; |
128 | EOF | |
129 | ||
59148d96 | 130 | # the last line is utter bogus of course, but how should apt know… |
6c0765c0 DK |
131 | testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0 |
132 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0 | |
133 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0 | |
1dd20368 | 134 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0 |
6c0765c0 | 135 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 |
1dd20368 DK |
136 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.gz.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz 0 |
137 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-all.gz.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz 0 " aptget update --print-uris | |
6c0765c0 DK |
138 | |
139 | testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease | |
140 | Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] | |
1dd20368 | 141 | Get:3 http://localhost:${APTHTTPPORT} unstable/main all Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-all.gz) B] |
1e0f0f28 DK |
142 | Reading package lists..." aptget update |
143 | ||
1dd20368 DK |
144 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" find rootdir/var/lib/apt/lists -name '*Contents-amd64*' |
145 | testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" find rootdir/var/lib/apt/lists -name '*Contents-all*' | |
146 | testequal "$(readfile Contents-amd64.gz Contents-all.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents' | |
6c0765c0 | 147 | testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" 'aptarchive/dists/unstable/main/Contents-amd64.gz' |
1dd20368 | 148 | testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all.gz" 'aptarchive/dists/unstable/main/Contents-all.gz' |
59148d96 DK |
149 | |
150 | rm -f rootdir/etc/apt/apt.conf.d/content-target.conf | |
cd46d4eb | 151 | msgmsg "No Contents file" |
59148d96 | 152 | |
6c0765c0 DK |
153 | testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0 |
154 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0 | |
155 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0 | |
1dd20368 | 156 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-all/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-all_Packages 0 |
6c0765c0 | 157 | 'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris |
59148d96 | 158 | |
6c0765c0 | 159 | testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease |
59148d96 DK |
160 | Reading package lists..." aptget update |
161 | ||
162 | testempty find rootdir/var/lib/apt/lists -name '*Contents*' |