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