test-bug-1078697-missing-source-hashes 964 B

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