]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-update-ims
show URI.Path in all acquire item descriptions
[apt.git] / test / integration / test-apt-update-ims
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64'
8
9insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
10insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
11
12setupaptarchive --no-update
13changetowebserver
14
15runtest() {
16 if [ -n "$1" ]; then
17 configallowinsecurerepositories 'true'
18 else
19 configallowinsecurerepositories 'false'
20 fi
21
22 rm -rf rootdir/var/lib/apt/lists/
23
24 local TEST="test${1:-success}"
25 $TEST aptget update
26 if [ "$1" = 'failure' ]; then
27 # accept the outdated Release file so we can check Hit behaviour
28 "test${2:-success}" aptget update -o Acquire::Min-ValidTime=99999999999
29 fi
30 listcurrentlistsdirectory > listsdir.lst
31 testsuccess grep '_Packages\(\.gz\)\?$' listsdir.lst
32 testsuccess grep '_Sources\(\.gz\)\?$' listsdir.lst
33 testsuccess grep '_Translation-en\(\.gz\)\?$' listsdir.lst
34
35 # ensure no leftovers in partial
36 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
37
38 # check that I-M-S header is kept in redirections
39 echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
40 $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0
41 sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output
42 testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output
43 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
44
45 # ensure that we still do a hash check for other files on ims hit of Release
46 if grep -q '^Hit .* InRelease$' expected.output || ! grep -q '^Ign .* Release\(\.gpg\)\?$' expected.output; then
47 $TEST aptget update -o Debug::Acquire::gpgv=1
48 cp rootdir/tmp/${TEST}.output goodsign.output
49 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
50 testsuccess grep '^Got GOODSIG, key ID:GOODSIG' goodsign.output
51 fi
52
53 # ensure no leftovers in partial
54 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
55}
56
57msgmsg 'InRelease'
58EXPECT='Hit http://localhost:8080 unstable InRelease
59Reading package lists...'
60echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
61runtest
62echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
63runtest
64
65msgmsg 'Release/Release.gpg'
66EXPECT='Ign http://localhost:8080 unstable InRelease
67 404 Not Found
68Hit http://localhost:8080 unstable Release
69Reading package lists...'
70find aptarchive -name 'InRelease' -delete
71echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
72runtest
73echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
74runtest
75
76msgmsg 'Release only'
77EXPECT="Ign http://localhost:8080 unstable InRelease
78 404 Not Found
79Hit http://localhost:8080 unstable Release
80Ign http://localhost:8080 unstable Release.gpg
81 404 Not Found
82Reading package lists...
83W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated."
84find aptarchive -name 'Release.gpg' -delete
85echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
86runtest 'warning'
87echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
88runtest 'warning'
89
90
91# make the release file old
92find aptarchive -name '*Release' -exec sed -i \
93 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
94 -e '/^Valid-Until: / d' -e "/^Date: / a\
95Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
96signreleasefiles
97
98msgmsg 'expired InRelease'
99EXPECT='Hit http://localhost:8080 unstable InRelease
100E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied.'
101echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
102runtest 'failure'
103echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
104runtest 'failure'
105
106msgmsg 'expired Release/Release.gpg'
107EXPECT='Ign http://localhost:8080 unstable InRelease
108 404 Not Found
109Hit http://localhost:8080 unstable Release
110E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied.'
111find aptarchive -name 'InRelease' -delete
112echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
113runtest 'failure'
114echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
115runtest 'failure'
116
117msgmsg 'expired Release only'
118EXPECT="Ign http://localhost:8080 unstable InRelease
119 404 Not Found
120Hit http://localhost:8080 unstable Release
121Ign http://localhost:8080 unstable Release.gpg
122 404 Not Found
123W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated.
124E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
125find aptarchive -name 'Release.gpg' -delete
126echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
127runtest 'failure' 'warning'
128echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
129runtest 'failure' 'warning'
130
131
132msgmsg 'no Release at all'
133EXPECT="Ign http://localhost:8080 unstable InRelease
134 404 Not Found
135Ign http://localhost:8080 unstable Release
136 404 Not Found
137Hit http://localhost:8080 unstable/main Sources
138Hit http://localhost:8080 unstable/main amd64 Packages
139Hit http://localhost:8080 unstable/main Translation-en
140Reading package lists...
141W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository."
142find aptarchive -name '*Release*' -delete
143echo 'Acquire::GzipIndexes "0";
144Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
145runtest 'warning'
146echo 'Acquire::GzipIndexes "1";
147Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
148runtest 'warning'