]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-ims
don't show NO_PUBKEY warning if repo is signed by another key
[apt.git] / test / integration / test-apt-update-ims
CommitLineData
63d0f853
MV
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
63d0f853
MV
6setupenvironment
7configarchitecture 'amd64'
8
ba6b79bd 9insertpackage 'unstable' 'unrelated' 'all' '0.5~squeeze1'
1dd20368 10insertpackage 'unstable' 'unrelated2' 'amd64' '0.5~squeeze1'
ba6b79bd 11insertsource 'unstable' 'unrelated' 'all' '0.5~squeeze1'
63d0f853 12
846bc058 13setupaptarchive --no-update
63d0f853
MV
14changetowebserver
15
47450dea 16runtest() {
995a4bf6 17 local APTOPT=""
ba6b79bd 18 if [ -n "$1" ]; then
995a4bf6 19 APTOPT='--allow-insecure-repositories'
ba6b79bd 20 else
995a4bf6 21 APTOPT='--no-allow-insecure-repositories'
ba6b79bd 22 fi
4fa34122 23
ba6b79bd 24 rm -rf rootdir/var/lib/apt/lists/
63d0f853 25
ba6b79bd 26 local TEST="test${1:-success}"
0179cfa8 27 $TEST aptget update $APTOPT -o Debug::pkgAcquire::Worker=1
ba6b79bd
DK
28 if [ "$1" = 'failure' ]; then
29 # accept the outdated Release file so we can check Hit behaviour
995a4bf6 30 "test${2:-success}" aptget update -o Acquire::Min-ValidTime=9999999 $APTOPT
4fa34122 31 fi
ba6b79bd 32 listcurrentlistsdirectory > listsdir.lst
0179cfa8
DK
33 testsuccess grep '_Packages\(\.[0-9a-z]\+\)\?$' listsdir.lst
34 testsuccess grep '_Sources\(\.[0-9a-z]\+\)\?$' listsdir.lst
35 testsuccess grep '_Translation-en\(\.[0-9a-z]\+\)\?$' listsdir.lst
47450dea
MV
36
37 # ensure no leftovers in partial
ba6b79bd 38 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
39
40 # check that I-M-S header is kept in redirections
ba6b79bd 41 echo "$EXPECT" | sed -e 's#(invalid since [^)]\+)#(invalid since)#' > expected.output
87d6947d 42 $TEST aptget update -o Debug::pkgAcquire::Worker=0 -o Debug::Acquire::http=0 $APTOPT
ba6b79bd
DK
43 sed -i -e 's#(invalid since [^)]\+)#(invalid since)#' rootdir/tmp/${TEST}.output
44 testequal "$(cat expected.output)" cat rootdir/tmp/${TEST}.output
45 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
46
47 # ensure that we still do a hash check for other files on ims hit of Release
1eb1836f 48 if grep -q '^Hit:[0-9]\+ .* InRelease$' expected.output || ! grep -q '^Ign:[0-9]\+ .* Release\(\.gpg\)\?$' expected.output; then
995a4bf6 49 $TEST aptget update -o Debug::Acquire::gpgv=1 $APTOPT
ba6b79bd
DK
50 cp rootdir/tmp/${TEST}.output goodsign.output
51 testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
fb7b11eb 52 testsuccess grep '^Got GOODSIG, key ID:' goodsign.output
ba6b79bd 53 fi
47450dea
MV
54
55 # ensure no leftovers in partial
ba6b79bd 56 testfailure ls 'rootdir/var/lib/apt/lists/partial/*'
47450dea
MV
57}
58
ba6b79bd 59msgmsg 'InRelease'
6c0765c0
DK
60EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
61Reading package lists..."
ba6b79bd 62echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318 63runtest
ba6b79bd 64echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
1ce24318
MV
65runtest
66
ba6b79bd 67msgmsg 'Release/Release.gpg'
6c0765c0 68EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
4dbfe436 69 404 Not Found
6c0765c0
DK
70Hit:2 http://localhost:${APTHTTPPORT} unstable Release
71Reading package lists..."
ab25bf1f 72find aptarchive -name 'InRelease' -delete
ba6b79bd 73echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 74runtest
ba6b79bd 75echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
47450dea 76runtest
f3097647 77
ba6b79bd 78msgmsg 'Release only'
6c0765c0 79EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
4dbfe436 80 404 Not Found
6c0765c0
DK
81Hit:2 http://localhost:${APTHTTPPORT} unstable Release
82Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
4dbfe436 83 404 Not Found
9d653a6d 84Reading package lists...
f18f2338 85W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
d04e44ac 86N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 87N: See apt-secure(8) manpage for repository creation and user configuration details."
ba6b79bd
DK
88find aptarchive -name 'Release.gpg' -delete
89echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
90runtest 'warning'
91echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
92runtest 'warning'
93
94
95# make the release file old
96find aptarchive -name '*Release' -exec sed -i \
97 -e "s#^Date: .*\$#Date: $(date -d '-2 weeks' '+%a, %d %b %Y %H:%M:%S %Z')#" \
98 -e '/^Valid-Until: / d' -e "/^Date: / a\
99Valid-Until: $(date -d '-1 weeks' '+%a, %d %b %Y %H:%M:%S %Z')" '{}' \;
100signreleasefiles
101
102msgmsg 'expired InRelease'
6c0765c0 103EXPECT="Hit:1 http://localhost:${APTHTTPPORT} unstable InRelease
95278287 104Reading package lists...
6c0765c0 105E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/InRelease is expired (invalid since). Updates for this repository will not be applied."
ba6b79bd
DK
106echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
107runtest 'failure'
108echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
109runtest 'failure'
110
111msgmsg 'expired Release/Release.gpg'
6c0765c0 112EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 113 404 Not Found
6c0765c0 114Hit:2 http://localhost:${APTHTTPPORT} unstable Release
95278287 115Reading package lists...
6c0765c0 116E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
ba6b79bd
DK
117find aptarchive -name 'InRelease' -delete
118echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
119runtest 'failure'
120echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
121runtest 'failure'
f3097647 122
ba6b79bd 123msgmsg 'expired Release only'
6c0765c0 124EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 125 404 Not Found
6c0765c0
DK
126Hit:2 http://localhost:${APTHTTPPORT} unstable Release
127Ign:3 http://localhost:${APTHTTPPORT} unstable Release.gpg
ba6b79bd 128 404 Not Found
95278287 129Reading package lists...
f18f2338 130W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' is not signed.
d04e44ac 131N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 132N: See apt-secure(8) manpage for repository creation and user configuration details.
6c0765c0 133E: Release file for http://localhost:${APTHTTPPORT}/dists/unstable/Release is expired (invalid since). Updates for this repository will not be applied."
ab25bf1f 134find aptarchive -name 'Release.gpg' -delete
ba6b79bd
DK
135echo 'Acquire::GzipIndexes "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
136runtest 'failure' 'warning'
137echo 'Acquire::GzipIndexes "1";' > rootdir/etc/apt/apt.conf.d/02compressindex
138runtest 'failure' 'warning'
f3097647 139
f3097647 140
ba6b79bd 141msgmsg 'no Release at all'
6c0765c0 142EXPECT="Ign:1 http://localhost:${APTHTTPPORT} unstable InRelease
ba6b79bd 143 404 Not Found
6c0765c0 144Ign:2 http://localhost:${APTHTTPPORT} unstable Release
ba6b79bd 145 404 Not Found
6c0765c0 146Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 147 404 Not Found
6c0765c0 148Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 149 404 Not Found
1dd20368
DK
150Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
151 404 Not Found
152Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 153 404 Not Found
6c0765c0 154Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 155 404 Not Found
6c0765c0 156Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 157 404 Not Found
1dd20368
DK
158Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
159 404 Not Found
160Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 161 404 Not Found
6c0765c0 162Ign:3 http://localhost:${APTHTTPPORT} unstable/main Sources
9d2a8a73 163 404 Not Found
6c0765c0 164Ign:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
9d2a8a73 165 404 Not Found
1dd20368
DK
166Ign:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
167 404 Not Found
168Ign:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
9d2a8a73 169 404 Not Found
6c0765c0
DK
170Hit:3 http://localhost:${APTHTTPPORT} unstable/main Sources
171Hit:4 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
1dd20368
DK
172Hit:5 http://localhost:${APTHTTPPORT} unstable/main all Packages
173Hit:6 http://localhost:${APTHTTPPORT} unstable/main Translation-en
ba6b79bd 174Reading package lists...
f18f2338 175W: The repository 'http://localhost:${APTHTTPPORT} unstable Release' does not have a Release file.
d04e44ac 176N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
002b1bc4 177N: See apt-secure(8) manpage for repository creation and user configuration details."
ba6b79bd
DK
178find aptarchive -name '*Release*' -delete
179echo 'Acquire::GzipIndexes "0";
180Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
181runtest 'warning'
182echo 'Acquire::GzipIndexes "1";
183Acquire::PDiffs "0";' > rootdir/etc/apt/apt.conf.d/02compressindex
184runtest 'warning'