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