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