4 TESTDIR
="$(readlink -f "$(dirname "$0")")" 
   8 configarchitecture 'i386' 
  10 configcompression '.' 'gz' 
  12 insertpackage 'unstable' 'foo' 'all' '1.0' 
  13 insertpackage 'unstable' 'bar' 'i386' '1.0' 
  15 setupaptarchive --no-update 
  17 # make Packages *only* accessible by-hash for this test 
  19         local NORMAL="$(readlink -f "./aptarchive/dists/unstable/main/${1}")" 
  20         local BYHASH="${NORMAL}/by
-hash/SHA512
" 
  22         find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \; 
  23         ln -s "${BYHASH}/${2}.gz
" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')" 
  25 makebyhashonly 'binary-i386' 'Packages' 
  26 makebyhashonly 'binary-all' 'Packages' 
  27 makebyhashonly 'source' 'Sources' 
  30         rm -rf rootdir/var/lib/apt/lists 
  31         # we moved the Packages file away, normal update won't work 
  32         testfailure aptget update "$@
" 
  33         # ensure we do not know about "foo
" 
  34         testfailureequal "Reading package lists...
 
  35 Building dependency tree...
 
  36 E
: Unable to 
locate package foo
" aptget install -q -s foo 
  39 ensureitsbroken -o Acquire::By-Hash=1 
  42         rm -rf rootdir/var/lib/apt/lists 
  43         testsuccess aptget update "$@
" -o Acquire::Languages=none 
  44         testfailure grep '^Ign' rootdir/tmp/testsuccess.output 
  45         rm -rf rootdir/var/lib/apt/lists 
  46         testsuccess aptget update "$@
" 
  47         cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output 
  48         testsuccess grep '^Ign' rootdir/tmp/aptupdate.output 
  49         testsuccessequal "Inst foo 
(1.0 unstable 
[all
]) 
  50 Conf foo 
(1.0 unstable 
[all
])" aptget install -qq -s foo 
  51         testsuccessequal "Inst bar 
(1.0 unstable 
[i386
]) 
  52 Conf bar 
(1.0 unstable 
[i386
])" aptget install -qq -s bar 
  54 msgmsg 'Test by-hash via' 'config option' 
  55 ensureitworks -o Acquire::By-Hash=force 
  57 msgmsg 'Test by-hash via' 'release option' 
  58 cp -a aptarchive/dists aptarchive/dists.bak 
  59 # add magic string to Release file ... 
  60 sed -i '/^Suite: / a \ 
  61 Acquire-By-Hash: yes' aptarchive/dists/unstable/Release 
  64 ensureitsbroken -o Acquire::By-Hash=0 
  66 msgmsg 'Test by-hash via' 'sources option' 
  67 sed -i "s
#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir/etc/apt/sources.list.d/* 
  69 #ensureitsbroken -o Acquire::By-Hash=0 
  71 rm -rf aptarchive
/dists
 
  72 cp -a aptarchive
/dists.bak aptarchive
/dists
 
  73 #ensureitworks -o Acquire::By-Hash=force 
  74 ensureitsbroken 
-o Acquire
::By
-Hash=1 
  75 ensureitsbroken 
-o Acquire
::By
-Hash=0 
  77 sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir
/etc
/apt
/sources.list.d
/* 
  79 #ensureitsbroken -o Acquire::By-Hash=0