]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-ims
sync TFRewrite*Order arrays with dpkg and dak
[apt.git] / test / integration / test-apt-update-ims
CommitLineData
63d0f853
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture 'amd64'
8
ba6b79bd
DK
9insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
10insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
63d0f853 11
846bc058 12setupaptarchive --no-update
63d0f853
MV
13changetowebserver
14
47450dea 15runtest() {
ba6b79bd
DK
16 if [ -n "$1" ]; then
17 configallowinsecurerepositories 'true'
18 else
19 configallowinsecurerepositories 'false'
20 fi
4fa34122 21
ba6b79bd 22 rm -rf rootdir/var/lib/apt/lists/
63d0f853 23
ba6b79bd
DK
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
4fa34122 29 fi
ba6b79bd
DK
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
47450dea
MV
34
35 # ensure no leftovers in partial
ba6b79bd 36 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
37
38 # check that I-M-S header is kept in redirections
ba6b79bd
DK
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\|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
47450dea
MV
52
53 # ensure no leftovers in partial
ba6b79bd 54 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
55}
56
ba6b79bd
DK
57msgmsg 'InRelease'
58EXPECT='Hit http://localhost:8080 unstable InRelease
59Reading package lists...'
60echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318 61runtest
ba6b79bd 62echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318
MV
63runtest
64
ba6b79bd
DK
65msgmsg 'Release/Release.gpg'
66EXPECT='Ign http://localhost:8080 unstable InRelease
4dbfe436 67 404 Not Found
1ce24318
MV
68Hit http://localhost:8080 unstable Release
69Hit http://localhost:8080 unstable Release.gpg
ba6b79bd 70Reading package lists...'
ab25bf1f 71find aptarchive -name 'InRelease' -delete
ba6b79bd 72echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 73runtest
ba6b79bd 74echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 75runtest
f3097647 76
ba6b79bd 77msgmsg 'Release only'
f3097647 78EXPECT="Ign http://localhost:8080 unstable InRelease
4dbfe436 79 404 Not Found
f3097647
MV
80Hit http://localhost:8080 unstable Release
81Ign http://localhost:8080 unstable Release.gpg
4dbfe436 82 404 Not Found
9d653a6d
DK
83Reading package lists...
84W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated."
ba6b79bd
DK
85find aptarchive -name 'Release.gpg' -delete
86echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
87runtest 'warning'
88echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
89runtest 'warning'
90
91
92# make the release file old
93find aptarchive -name '*Release' -exec sed -i \
94 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
95 -e '/^Valid-Until: / d' -e "/^Date: / a\
96Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
97signreleasefiles
98
99msgmsg 'expired InRelease'
100EXPECT='Hit http://localhost:8080 unstable InRelease
101E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied.'
102echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
103runtest 'failure'
104echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
105runtest 'failure'
106
107msgmsg 'expired Release/Release.gpg'
108EXPECT='Ign http://localhost:8080 unstable InRelease
109 404 Not Found
110Hit http://localhost:8080 unstable Release
111Hit http://localhost:8080 unstable Release.gpg
112E: Release file for http://localhost:8080/dists/unstable/Release.gpg is expired (invalid since). Updates for this repository will not be applied.'
113find aptarchive -name 'InRelease' -delete
114echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
115runtest 'failure'
116echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
117runtest 'failure'
f3097647 118
ba6b79bd
DK
119msgmsg 'expired Release only'
120EXPECT="Ign http://localhost:8080 unstable InRelease
121 404 Not Found
122Hit http://localhost:8080 unstable Release
123Ign http://localhost:8080 unstable Release.gpg
124 404 Not Found
125W: The data from 'http://localhost:8080 unstable Release.gpg' is not signed. Packages from that repository can not be authenticated.
126E: Release file for http://localhost:8080/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
ab25bf1f 127find aptarchive -name 'Release.gpg' -delete
ba6b79bd
DK
128echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
129runtest 'failure' 'warning'
130echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
131runtest 'failure' 'warning'
f3097647 132
f3097647 133
ba6b79bd
DK
134msgmsg 'no Release at all'
135EXPECT="Ign http://localhost:8080 unstable InRelease
136 404 Not Found
137Ign http://localhost:8080 unstable Release
138 404 Not Found
139Hit http://localhost:8080 unstable/main Sources
140Hit http://localhost:8080 unstable/main amd64 Packages
141Hit http://localhost:8080 unstable/main Translation-en
142Reading package lists...
143W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository."
144find aptarchive -name '*Release*' -delete
145echo 'Acquire::GzipIndexes "0";
146Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
147runtest 'warning'
148echo 'Acquire::GzipIndexes "1";
149Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
150runtest 'warning'