You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
2.2 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture 'i386'
  7. confighashes 'SHA512'
  8. configcompression '.' 'gz'
  9. insertpackage 'unstable' 'foo' 'all' '1.0'
  10. setupaptarchive --no-update
  11. # make Packages *only* accessible by-hash for this test
  12. mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512
  13. (cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 &&
  14. mv ../../Packages* . &&
  15. ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') )
  16. # add sources
  17. mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
  18. (cd aptarchive/dists/unstable/main/source/by-hash/SHA512 &&
  19. ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ')
  20. )
  21. ensureitsbroken() {
  22. rm -rf rootdir/var/lib/apt/lists
  23. # we moved the Packages file away, normal update won't work
  24. testfailure aptget update "$@"
  25. # ensure we do not know about "foo"
  26. testfailureequal "Reading package lists...
  27. Building dependency tree...
  28. E: Unable to locate package foo" aptget install -q -s foo
  29. }
  30. ensureitsbroken
  31. ensureitsbroken -o Acquire::By-Hash=1
  32. ensureitworks() {
  33. rm -rf rootdir/var/lib/apt/lists
  34. testsuccess aptget update -o Acquire::Languages=none "$@"
  35. testsuccessequal "Inst foo (1.0 unstable [all])
  36. Conf foo (1.0 unstable [all])" aptget install -qq -s foo
  37. }
  38. msgmsg 'Test by-hash via' 'config option'
  39. ensureitworks -o Acquire::By-Hash=force
  40. msgmsg 'Test by-hash via' 'release option'
  41. cp -a aptarchive/dists aptarchive/dists.bak
  42. # add magic string to Release file ...
  43. sed -i '/^Suite: / a \
  44. Acquire-By-Hash: yes' aptarchive/dists/unstable/Release
  45. signreleasefiles
  46. ensureitworks
  47. ensureitsbroken -o Acquire::By-Hash=0
  48. msgmsg 'Test by-hash via' 'sources option'
  49. sed -i "s#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir/etc/apt/sources.list.d/*
  50. ensureitworks
  51. #ensureitsbroken -o Acquire::By-Hash=0
  52. rm -rf aptarchive/dists
  53. cp -a aptarchive/dists.bak aptarchive/dists
  54. #ensureitworks -o Acquire::By-Hash=force
  55. ensureitsbroken -o Acquire::By-Hash=1
  56. ensureitsbroken -o Acquire::By-Hash=0
  57. sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/*
  58. ensureitworks
  59. #ensureitsbroken -o Acquire::By-Hash=0