]>
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 DK |
9 | |
10 | # note that in --print-uri we talk about .bz2 because that is the default. | |
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 | ||
59148d96 DK |
19 | testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 |
20 | 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 | |
21 | 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 | |
22 | 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris | |
23 | ||
1e0f0f28 DK |
24 | testsuccessequal "Get:1 http://localhost:8080 unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B] |
25 | Get:2 http://localhost:8080 unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B] | |
26 | Get:3 http://localhost:8080 unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B] | |
27 | Get:4 http://localhost:8080 unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B] | |
28 | Reading package lists..." aptget update | |
29 | ||
30 | testempty find rootdir/var/lib/apt/lists -name '*Contents*' | |
31 | ||
32 | cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF | |
33 | APT::Acquire::Targets::deb::Contents { | |
d3a869e3 | 34 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)"; |
1e0f0f28 DK |
35 | ShortDescription "Contents"; |
36 | Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents"; | |
37 | }; | |
38 | EOF | |
39 | ||
3fd89e62 DK |
40 | testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget files --no-release-info --format '$(FILENAME)' 'Created-By: Contents' |
41 | testempty aptget files --format '$(FILENAME)' 'Created-By: Contents' | |
42 | # lets fake the existence of a compressed Contents file | |
43 | touch ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz | |
44 | testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget files --format '$(FILENAME)' 'Created-By: Contents' | |
45 | ||
59148d96 DK |
46 | testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 |
47 | 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 | |
48 | 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 | |
49 | 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 | |
50 | 'http://localhost:8080/dists/unstable/main/Contents-amd64.bz2' localhost:8080_dists_unstable_main_Contents-amd64 0 " aptget update --print-uris | |
51 | ||
1eb1836f DK |
52 | testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease |
53 | Get:2 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] | |
1e0f0f28 DK |
54 | Reading package lists..." aptget update |
55 | ||
56 | testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' find rootdir/var/lib/apt/lists -name '*Contents*' | |
8881b11e | 57 | testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget files --format '$(FILENAME)' 'Created-By: Contents' |
1e0f0f28 DK |
58 | testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' 'aptarchive/dists/unstable/main/Contents-amd64' |
59 | ||
60 | # no automatic uncompress based on the name please, | |
61 | # only if we downloaded a compressed file, but target was uncompressed | |
62 | cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF | |
63 | APT::Acquire::Targets::deb::Contents { | |
d3a869e3 | 64 | MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz"; |
1e0f0f28 DK |
65 | ShortDescription "Contents.gz"; |
66 | Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz"; | |
67 | }; | |
68 | EOF | |
69 | ||
59148d96 DK |
70 | # the last line is utter bogus of course, but how should apt know… |
71 | testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 | |
72 | 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 | |
73 | 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 | |
74 | 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 | |
75 | 'http://localhost:8080/dists/unstable/main/Contents-amd64.gz.bz2' localhost:8080_dists_unstable_main_Contents-amd64.gz 0 " aptget update --print-uris | |
76 | ||
1eb1836f DK |
77 | testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease |
78 | Get:2 http://localhost:8080 unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B] | |
1e0f0f28 DK |
79 | Reading package lists..." aptget update |
80 | ||
81 | testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir/var/lib/apt/lists -name '*Contents*' | |
8881b11e | 82 | testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget files --format '$(FILENAME)' 'Created-By: Contents' |
1e0f0f28 | 83 | testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz' |
59148d96 DK |
84 | |
85 | rm -f rootdir/etc/apt/apt.conf.d/content-target.conf | |
86 | ||
87 | testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0 | |
88 | 'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0 | |
89 | 'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0 | |
90 | 'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris | |
91 | ||
1eb1836f | 92 | testsuccessequal "Hit:1 http://localhost:8080 unstable InRelease |
59148d96 DK |
93 | Reading package lists..." aptget update |
94 | ||
95 | testempty find rootdir/var/lib/apt/lists -name '*Contents*' |