test-apt-by-hash-update 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. set -e
  3. TESTDIR=$(readlink -f $(dirname $0))
  4. . $TESTDIR/framework
  5. setupenvironment
  6. configarchitecture "i386"
  7. insertpackage 'unstable' 'foo' 'all' '1.0'
  8. setupaptarchive --no-update
  9. APTARCHIVE=$(readlink -f ./aptarchive)
  10. # make Packages *only* accessable by-hash for this test
  11. mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash
  12. (cd aptarchive/dists/unstable/main/binary-i386/by-hash &&
  13. mv ../Packages* . &&
  14. ln -s Packages.gz $(sha256sum Packages.gz|cut -f1 -d' ') )
  15. # add sources
  16. mkdir -p aptarchive/dists/unstable/main/source/by-hash
  17. (cd aptarchive/dists/unstable/main/source/by-hash &&
  18. ln -s ../Sources.gz $(sha256sum ../Sources.gz|cut -f1 -d' ')
  19. )
  20. # ensure we do not know about "foo"
  21. testequal "Reading package lists...
  22. Building dependency tree...
  23. E: Unable to locate package foo" aptget install -q -s foo
  24. # ensure we can apt-get update by hash
  25. testsuccess aptget update -o APT::Acquire::By-Hash=1
  26. # ensure it keeps working
  27. testequal "Inst foo (1.0 unstable [all])
  28. Conf foo (1.0 unstable [all])" aptget install -qq -s foo