]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-by-hash-update
reenable gcc warnings for deprecated functions
[apt.git] / test / integration / test-apt-by-hash-update
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture 'i386'
9 confighashes 'SHA512'
10 configcompression '.' 'gz'
11
12 insertpackage 'unstable' 'foo' 'all' '1.0'
13
14 setupaptarchive --no-update
15
16 # make Packages *only* accessible by-hash for this test
17 makebyhashonly() {
18 local NORMAL="$(readlink -f "./aptarchive/dists/unstable/main/${1}")"
19 local BYHASH="${NORMAL}/by-hash/SHA512"
20 mkdir -p "${BYHASH}"
21 find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \;
22 ln -s "${BYHASH}/${2}.gz" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')"
23 }
24 makebyhashonly 'binary-i386' 'Packages'
25 makebyhashonly 'source' 'Sources'
26
27 ensureitsbroken() {
28 rm -rf rootdir/var/lib/apt/lists
29 # we moved the Packages file away, normal update won't work
30 testfailure aptget update "$@"
31 # ensure we do not know about "foo"
32 testfailureequal "Reading package lists...
33 Building dependency tree...
34 E: Unable to locate package foo" aptget install -q -s foo
35 }
36 ensureitsbroken
37 ensureitsbroken -o Acquire::By-Hash=1
38
39 ensureitworks() {
40 rm -rf rootdir/var/lib/apt/lists
41 testsuccess aptget update "$@" -o Acquire::Languages=none
42 testfailure grep '^Ign' rootdir/tmp/testsuccess.output
43 rm -rf rootdir/var/lib/apt/lists
44 testsuccess aptget update "$@"
45 cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
46 testsuccess grep '^Ign' rootdir/tmp/aptupdate.output
47 testsuccessequal "Inst foo (1.0 unstable [all])
48 Conf foo (1.0 unstable [all])" aptget install -qq -s foo
49 }
50 msgmsg 'Test by-hash via' 'config option'
51 ensureitworks -o Acquire::By-Hash=force
52
53 msgmsg 'Test by-hash via' 'release option'
54 cp -a aptarchive/dists aptarchive/dists.bak
55 # add magic string to Release file ...
56 sed -i '/^Suite: / a \
57 Acquire-By-Hash: yes' aptarchive/dists/unstable/Release
58 signreleasefiles
59 ensureitworks
60 ensureitsbroken -o Acquire::By-Hash=0
61
62 msgmsg 'Test by-hash via' 'sources option'
63 sed -i "s#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir/etc/apt/sources.list.d/*
64 ensureitworks
65 #ensureitsbroken -o Acquire::By-Hash=0
66
67 rm -rf aptarchive/dists
68 cp -a aptarchive/dists.bak aptarchive/dists
69 #ensureitworks -o Acquire::By-Hash=force
70 ensureitsbroken -o Acquire::By-Hash=1
71 ensureitsbroken -o Acquire::By-Hash=0
72
73 sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/*
74 ensureitworks
75 #ensureitsbroken -o Acquire::By-Hash=0