File: test-apt-update-hooks

package info (click to toggle)
apt 3.1.13
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,764 kB
  • sloc: cpp: 71,085; sh: 31,750; xml: 5,553; perl: 217; python: 197; ansic: 191; makefile: 41
file content (49 lines) | stat: -rwxr-xr-x 1,712 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
set -e

TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"

setupenvironment
configarchitecture 'i386'
confighashes 'SHA512'

insertpackage 'unstable' 'foo' 'i386' '1.0'
insertpackage 'testing' 'foo' 'i386' '1.0'

setupaptarchive --no-update
APTARCHIVE="$(readlink -f ./aptarchive)"

signreleasefiles 'Joe Sixpack'

echo 'APT::Update::Post-Invoke-Success { "echo SUCCESS"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf
echo 'APT::Update::Post-Invoke { "echo RUN"; };' >> rootdir/etc/apt/apt.conf.d/display-success.conf


msgmsg "All sources OK => run Post-Invoke-Success and Post-Invoke"
testsuccess aptget update
cp rootdir/tmp/testsuccess.output aptupdate.output
testsuccess grep "RUN" aptupdate.output
testsuccess grep "SUCCESS" aptupdate.output

msgmsg "Some sources broken => run Post-Invoke-Success and Post-Invoke"
sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/unstable/Release"
testsuccess rm "$(aptget indextargets 'Created-By: Packages' 'Suite: testing' --format '$(FILENAME)')"
signreleasefiles
listcurrentlistsdirectory > lists.before
testfailure apt update
cp rootdir/tmp/testfailure.output aptupdate.output
listcurrentlistsdirectory > lists.after
testfailure cmp lists.before lists.after
testsuccess grep "RUN" aptupdate.output
testsuccess grep "SUCCESS" aptupdate.output

msgmsg "All sources broken => run Post-Invoke"
sed -i -e '/^ / d' -e '/^SHA512:/ d' "$APTARCHIVE/dists/testing/Release"
signreleasefiles
mv lists.after lists.before
testfailure apt update
cp rootdir/tmp/testfailure.output aptupdate.output
testfileequal lists.before "$(listcurrentlistsdirectory)"
testsuccess grep "RUN" aptupdate.output
testfailure grep "SUCCESS" aptupdate.output