]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-by-hash-update
tests: use SHA1 checksum only by default in tests
[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
11 insertpackage 'unstable' 'foo' 'all' '1.0'
12
13 setupaptarchive --no-update
14
15 # make Packages *only* accessible by-hash for this test
16 mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512
17 (cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 &&
18 mv ../../Packages* . &&
19 ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') )
20
21 # add sources
22 mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
23 (cd aptarchive/dists/unstable/main/source/by-hash/SHA512 &&
24 ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ')
25 )
26
27 # we moved the Packages file away, normal update won't work
28 testfailure aptget update
29
30 # ensure we do not know about "foo"
31 testfailureequal "Reading package lists...
32 Building dependency tree...
33 E: Unable to locate package foo" aptget install -q -s foo
34
35 # ensure we can apt-get update by hash
36 testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none
37
38 ensureitworks() {
39 testsuccessequal "Inst foo (1.0 unstable [all])
40 Conf foo (1.0 unstable [all])" aptget install -qq -s foo
41 }
42 ensureitworks
43
44 # add magic string to Release file ...
45 MAGIC="Acquire-By-Hash: true"
46 sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release
47 signreleasefiles
48 # ... and verify that it fetches by hash now
49 rm -rf rootdir/var/lib/apt/lists
50 testsuccess aptget update -o Acquire::Languages=none
51
52 ensureitworks