test-ubuntu-bug-1078697-missing-source-hashes 992 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture "i386"
  7. confighashes 'MD5' 'SHA1' 'SHA256' 'SHA512'
  8. msgtest 'Test apt-ftparchive source with missing hashes in .dsc'
  9. touch aptarchive/foo_1.0.tar.gz
  10. cat > aptarchive/foo_1.0.dsc << EOF
  11. Format: 3.0 (native)
  12. Source: foo
  13. Binary: foo
  14. Architecture: all
  15. Version: 1.0
  16. Package-List:
  17. foo deb admin extra
  18. Files:
  19. d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz
  20. EOF
  21. # check for the SHA hashes
  22. testsuccess aptftparchive sources aptarchive/
  23. cp rootdir/tmp/testsuccess.output aptarchive/Sources
  24. testsuccess grep Checksums-Sha512 aptarchive/Sources
  25. for hash in sha512sum sha256sum sha1sum; do
  26. for f in foo_1.0.tar.gz foo_1.0.dsc; do
  27. SUM=$($hash aptarchive/$f | cut -d' ' -f1)
  28. NEEDLE="$SUM $(stat -c%s aptarchive/$f) $f"
  29. testsuccess test -n "$SUM"
  30. msgtest "Test $hash hash matches for $f"
  31. testsuccess --nomsg grep "$NEEDLE" aptarchive/Sources
  32. done
  33. done