]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-acquire-additional-files
store Release files data in the Cache
[apt.git] / test / integration / test-apt-acquire-additional-files
CommitLineData
1e0f0f28
DK
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture '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
12configcompression '.' 'gz'
13
14buildsimplenativepackage 'foo' 'amd64' '1' 'unstable'
15
16setupaptarchive --no-update
17changetowebserver
18
59148d96
DK
19testequal "'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
24testsuccessequal "Get:1 http://localhost:8080 unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B]
25Get:2 http://localhost:8080 unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B]
26Get:3 http://localhost:8080 unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B]
27Get:4 http://localhost:8080 unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
28Reading package lists..." aptget update
29
30testempty find rootdir/var/lib/apt/lists -name '*Contents*'
31
32cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
33APT::Acquire::Targets::deb::Contents {
d3a869e3 34 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
1e0f0f28
DK
35 ShortDescription "Contents";
36 Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
37};
38EOF
39
59148d96
DK
40testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
41'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
42'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
43'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
44'http://localhost:8080/dists/unstable/main/Contents-amd64.bz2' localhost:8080_dists_unstable_main_Contents-amd64 0 " aptget update --print-uris
45
1e0f0f28
DK
46testsuccessequal "Hit http://localhost:8080 unstable InRelease
47Get:1 http://localhost:8080 unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
48Reading package lists..." aptget update
49
50testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' find rootdir/var/lib/apt/lists -name '*Contents*'
8881b11e 51testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64)" aptget files --format '$(FILENAME)' 'Created-By: Contents'
1e0f0f28
DK
52testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64' 'aptarchive/dists/unstable/main/Contents-amd64'
53
54# no automatic uncompress based on the name please,
55# only if we downloaded a compressed file, but target was uncompressed
56cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
57APT::Acquire::Targets::deb::Contents {
d3a869e3 58 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz";
1e0f0f28
DK
59 ShortDescription "Contents.gz";
60 Description "\$(SITE) \$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz";
61};
62EOF
63
59148d96
DK
64# the last line is utter bogus of course, but how should apt know…
65testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
66'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
67'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
68'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0
69'http://localhost:8080/dists/unstable/main/Contents-amd64.gz.bz2' localhost:8080_dists_unstable_main_Contents-amd64.gz 0 " aptget update --print-uris
70
1e0f0f28
DK
71testsuccessequal "Hit http://localhost:8080 unstable InRelease
72Get:1 http://localhost:8080 unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
73Reading package lists..." aptget update
74
75testequal 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' find rootdir/var/lib/apt/lists -name '*Contents*'
8881b11e 76testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz)" aptget files --format '$(FILENAME)' 'Created-By: Contents'
1e0f0f28 77testsuccess cmp 'rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_Contents-amd64.gz' 'aptarchive/dists/unstable/main/Contents-amd64.gz'
59148d96
DK
78
79rm -f rootdir/etc/apt/apt.conf.d/content-target.conf
80
81testequal "'http://localhost:8080/dists/unstable/InRelease' localhost:8080_dists_unstable_InRelease 0
82'http://localhost:8080/dists/unstable/main/source/Sources.bz2' localhost:8080_dists_unstable_main_source_Sources 0
83'http://localhost:8080/dists/unstable/main/binary-amd64/Packages.bz2' localhost:8080_dists_unstable_main_binary-amd64_Packages 0
84'http://localhost:8080/dists/unstable/main/i18n/Translation-en.bz2' localhost:8080_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
85
86testsuccessequal "Hit http://localhost:8080 unstable InRelease
87Reading package lists..." aptget update
88
89testempty find rootdir/var/lib/apt/lists -name '*Contents*'