]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-ims
link DependencyData structs together
[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
1eb1836f 46 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then
ba6b79bd
DK
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 57msgmsg 'InRelease'
1eb1836f 58EXPECT='Hit:1 http://localhost:8080 unstable InRelease
ba6b79bd
DK
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 65msgmsg 'Release/Release.gpg'
1eb1836f 66EXPECT='Ign:1 http://localhost:8080 unstable InRelease
4dbfe436 67 404 Not Found
1eb1836f 68Hit:2 http://localhost:8080 unstable Release
ba6b79bd 69Reading package lists...'
ab25bf1f 70find aptarchive -name 'InRelease' -delete
ba6b79bd 71echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 72runtest
ba6b79bd 73echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 74runtest
f3097647 75
ba6b79bd 76msgmsg 'Release only'
1eb1836f 77EXPECT="Ign:1 http://localhost:8080 unstable InRelease
4dbfe436 78 404 Not Found
1eb1836f
DK
79Hit:2 http://localhost:8080 unstable Release
80Ign:3 http://localhost:8080 unstable Release.gpg
4dbfe436 81 404 Not Found
9d653a6d 82Reading package lists...
6bf93605 83W: The data from 'http://localhost:8080 unstable Release' is not signed. Packages from that repository can not be authenticated."
ba6b79bd
DK
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'
1eb1836f 99EXPECT='Hit:1 http://localhost:8080 unstable InRelease
ba6b79bd
DK
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'
1eb1836f 107EXPECT='Ign:1 http://localhost:8080 unstable InRelease
ba6b79bd 108 404 Not Found
1eb1836f 109Hit:2 http://localhost:8080 unstable Release
6bf93605 110E: Release file for http://localhost:8080/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied.'
ba6b79bd
DK
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'
f3097647 116
ba6b79bd 117msgmsg 'expired Release only'
1eb1836f 118EXPECT="Ign:1 http://localhost:8080 unstable InRelease
ba6b79bd 119 404 Not Found
1eb1836f
DK
120Hit:2 http://localhost:8080 unstable Release
121Ign:3 http://localhost:8080 unstable Release.gpg
ba6b79bd 122 404 Not Found
6bf93605
DK
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."
ab25bf1f 125find aptarchive -name 'Release.gpg' -delete
ba6b79bd
DK
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'
f3097647 130
f3097647 131
ba6b79bd 132msgmsg 'no Release at all'
1eb1836f 133EXPECT="Ign:1 http://localhost:8080 unstable InRelease
ba6b79bd 134 404 Not Found
1eb1836f 135Ign:2 http://localhost:8080 unstable Release
ba6b79bd 136 404 Not Found
9d2a8a73
DK
137Ign:3 http://localhost:8080 unstable/main Sources
138 404 Not Found
139Ign:4 http://localhost:8080 unstable/main amd64 Packages
140 404 Not Found
141Ign:5 http://localhost:8080 unstable/main Translation-en
142 404 Not Found
143Ign:3 http://localhost:8080 unstable/main Sources
144 404 Not Found
145Ign:4 http://localhost:8080 unstable/main amd64 Packages
146 404 Not Found
147Ign:5 http://localhost:8080 unstable/main Translation-en
148 404 Not Found
149Ign:3 http://localhost:8080 unstable/main Sources
150 404 Not Found
151Ign:4 http://localhost:8080 unstable/main amd64 Packages
152 404 Not Found
153Ign:5 http://localhost:8080 unstable/main Translation-en
154 404 Not Found
1eb1836f
DK
155Hit:3 http://localhost:8080 unstable/main Sources
156Hit:4 http://localhost:8080 unstable/main amd64 Packages
157Hit:5 http://localhost:8080 unstable/main Translation-en
ba6b79bd
DK
158Reading package lists...
159W: The repository 'http://localhost:8080 unstable Release' does not have a Release file. This is deprecated, please contact the owner of the repository."
160find aptarchive -name '*Release*' -delete
161echo 'Acquire::GzipIndexes "0";
162Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
163runtest 'warning'
164echo 'Acquire::GzipIndexes "1";
165Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
166runtest 'warning'