]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-acquire-additional-files
centralize unlink checks in acquire-item
[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 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
12configcompression '.' 'gz'
13
14buildsimplenativepackage 'foo' 'amd64' '1' 'unstable'
15
16setupaptarchive --no-update
17changetowebserver
18
6c0765c0
DK
19testequal "'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
22'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
23
24testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} unstable InRelease [$(stat -c%s aptarchive/dists/unstable/InRelease) B]
25Get:2 http://localhost:${APTHTTPPORT} unstable/main Sources [$(stat -c%s aptarchive/dists/unstable/main/source/Sources.gz) B]
26Get:3 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages [$(stat -c%s aptarchive/dists/unstable/main/binary-amd64/Packages.gz) B]
27Get:4 http://localhost:${APTHTTPPORT} unstable/main Translation-en [$(stat -c%s aptarchive/dists/unstable/main/i18n/Translation-en.gz) B]
1e0f0f28
DK
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
c2a4a8dd 33Acquire::IndexTargets::deb::Contents {
d3a869e3 34 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE)";
1e0f0f28 35 ShortDescription "Contents";
c2a4a8dd 36 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents";
1e0f0f28
DK
37};
38EOF
39
6c0765c0 40testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64)" aptget indextargets --no-release-info --format '$(FILENAME)' 'Created-By: Contents'
c2a4a8dd 41testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
3fd89e62 42# lets fake the existence of a compressed Contents file
6c0765c0
DK
43touch ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz
44testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
3fd89e62 45
6c0765c0
DK
46testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
47'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
48'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
49'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0
50'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64 0 " aptget update --print-uris
59148d96 51
6c0765c0
DK
52testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
53Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
1e0f0f28
DK
54Reading package lists..." aptget update
55
6c0765c0
DK
56testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" find rootdir/var/lib/apt/lists -name '*Contents*'
57testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
58testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64" 'aptarchive/dists/unstable/main/Contents-amd64'
1e0f0f28 59
6c0765c0 60rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64
c2a4a8dd 61testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
653ef26c
DK
62
63# if we asked for keeping it compressed, keep it
c2a4a8dd 64echo 'Acquire::IndexTargets::deb::Contents::KeepCompressed "true";' >> rootdir/etc/apt/apt.conf.d/content-target.conf
6c0765c0
DK
65testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
66Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
653ef26c
DK
67Reading package lists..." aptget update
68
6c0765c0
DK
69testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" find rootdir/var/lib/apt/lists -name '*Contents*'
70testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
71testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
653ef26c 72
6c0765c0 73rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz
c2a4a8dd 74testempty aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
653ef26c
DK
75
76# and no automatic uncompress based on the name please,
1e0f0f28
DK
77# only if we downloaded a compressed file, but target was uncompressed
78cat > rootdir/etc/apt/apt.conf.d/content-target.conf <<EOF
c2a4a8dd 79Acquire::IndexTargets::deb::Contents {
d3a869e3 80 MetaKey "\$(COMPONENT)/Contents-\$(ARCHITECTURE).gz";
1e0f0f28 81 ShortDescription "Contents.gz";
c2a4a8dd 82 Description "\$(RELEASE)/\$(COMPONENT) \$(ARCHITECTURE) Contents.gz";
1e0f0f28
DK
83};
84EOF
85
59148d96 86# the last line is utter bogus of course, but how should apt know…
6c0765c0
DK
87testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
88'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
89'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
90'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0
91'http://localhost:${APTHTTPPORT}/dists/unstable/main/Contents-amd64.gz.xz' localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz 0 " aptget update --print-uris
92
93testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
94Get:2 http://localhost:${APTHTTPPORT} unstable/main amd64 Contents.gz [$(stat -c%s aptarchive/dists/unstable/main/Contents-amd64.gz) B]
1e0f0f28
DK
95Reading package lists..." aptget update
96
6c0765c0
DK
97testequal "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" find rootdir/var/lib/apt/lists -name '*Contents*'
98testequal "$(readlink -f ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz)" aptget indextargets --format '$(FILENAME)' 'Created-By: Contents'
99testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-amd64.gz" 'aptarchive/dists/unstable/main/Contents-amd64.gz'
59148d96
DK
100
101rm -f rootdir/etc/apt/apt.conf.d/content-target.conf
102
6c0765c0
DK
103testequal "'http://localhost:${APTHTTPPORT}/dists/unstable/InRelease' localhost:${APTHTTPPORT}_dists_unstable_InRelease 0
104'http://localhost:${APTHTTPPORT}/dists/unstable/main/source/Sources.xz' localhost:${APTHTTPPORT}_dists_unstable_main_source_Sources 0
105'http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-amd64/Packages.xz' localhost:${APTHTTPPORT}_dists_unstable_main_binary-amd64_Packages 0
106'http://localhost:${APTHTTPPORT}/dists/unstable/main/i18n/Translation-en.xz' localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-en 0 " aptget update --print-uris
59148d96 107
6c0765c0 108testsuccessequal "Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
59148d96
DK
109Reading package lists..." aptget update
110
111testempty find rootdir/var/lib/apt/lists -name '*Contents*'