]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-1078697-missing-source-hashes
merged lp:~mvo/apt/source-hashes
[apt.git] / test / integration / test-bug-1078697-missing-source-hashes
CommitLineData
0f2def05
MV
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6setupenvironment
7configarchitecture "i386"
8
9msgtest 'Test apt-ftparchive source with missing hashes in .dsc'
10
11touch aptarchive/foo_1.0.tar.gz
12cat > aptarchive/foo_1.0.dsc << EOF
13Format: 3.0 (native)
14Source: foo
15Binary: foo
16Architecture: all
17Version: 1.0
18Package-List:
19 foo deb admin extra
20Files:
21 d41d8cd98f00b204e9800998ecf8427e 0 foo_1.0.tar.gz
22EOF
23
24# check for the SHA hashes
25aptftparchive sources aptarchive/ > aptarchive/Sources 2>/dev/null || msgfail
26test -n "$(grep Checksums-Sha512 aptarchive/Sources)" && msgpass || msgfail
27
28for 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
35done