4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
"i386"
11 insertpackage
'unstable' 'foo' 'all' '1.0'
13 setupaptarchive
--no-update
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' ') )
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' ')
27 # we moved the Packages file away, normal update won't work
28 testfailure aptget update
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
35 # ensure we can apt-get update by hash
36 testsuccess aptget update
-o APT
::Acquire
::By
-Hash=1 -o Acquire
::Languages
=none
39 testsuccessequal
"Inst foo (1.0 unstable [all])
40 Conf foo (1.0 unstable [all])" aptget
install -qq -s foo
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
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