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