4 TESTDIR
=$(readlink -f $(dirname $0))
8 configarchitecture
'i386'
10 configcompression
'.' 'gz'
12 insertpackage
'unstable' 'foo' 'all' '1.0'
14 setupaptarchive
--no-update
16 # make Packages *only* accessible by-hash for this test
18 local NORMAL
="$(readlink -f "./aptarchive/dists/unstable/main/${1}")"
19 local BYHASH
="${NORMAL}/by-hash/SHA512"
21 find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \
;
22 ln -s "${BYHASH}/${2}.gz" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')"
24 makebyhashonly
'binary-i386' 'Packages'
25 makebyhashonly
'source' 'Sources'
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
37 ensureitsbroken
-o Acquire
::By
-Hash=1
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
50 msgmsg
'Test by-hash via' 'config option'
51 ensureitworks
-o Acquire
::By
-Hash=force
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
60 ensureitsbroken
-o Acquire
::By
-Hash=0
62 msgmsg
'Test by-hash via' 'sources option'
63 sed -i "s#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir
/etc
/apt
/sources.list.d
/*
65 #ensureitsbroken -o Acquire::By-Hash=0
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
73 sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir
/etc
/apt
/sources.list.d
/*
75 #ensureitsbroken -o Acquire::By-Hash=0