]>
Commit | Line | Data |
---|---|---|
50d98a1b MV |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
4 | TESTDIR=$(readlink -f $(dirname $0)) | |
5 | . $TESTDIR/framework | |
6 | ||
7 | setupenvironment | |
24e8f24e | 8 | configarchitecture 'i386' |
c5ede4ca | 9 | confighashes 'SHA512' |
24e8f24e | 10 | configcompression '.' 'gz' |
50d98a1b MV |
11 | |
12 | insertpackage 'unstable' 'foo' 'all' '1.0' | |
13 | ||
14 | setupaptarchive --no-update | |
15 | ||
3a8776a3 | 16 | # make Packages *only* accessible by-hash for this test |
af81ab90 DK |
17 | makebyhashonly() { |
18 | local NORMAL="$(readlink -f "./aptarchive/dists/unstable/main/${1}")" | |
19 | local BYHASH="${NORMAL}/by-hash/SHA512" | |
20 | mkdir -p "${BYHASH}" | |
21 | find "${NORMAL}/" -maxdepth 1 -name "${2}*" -exec mv '{}' "$BYHASH" \; | |
22 | ln -s "${BYHASH}/${2}.gz" "${BYHASH}/$(sha512sum "${BYHASH}/${2}.gz" | cut -f1 -d' ')" | |
23 | } | |
24 | makebyhashonly 'binary-i386' 'Packages' | |
25 | makebyhashonly 'source' 'Sources' | |
50d98a1b | 26 | |
24e8f24e DK |
27 | ensureitsbroken() { |
28 | rm -rf rootdir/var/lib/apt/lists | |
29 | # we moved the Packages file away, normal update won't work | |
30 | testfailure aptget update "$@" | |
31 | # ensure we do not know about "foo" | |
32 | testfailureequal "Reading package lists... | |
50d98a1b MV |
33 | Building dependency tree... |
34 | E: Unable to locate package foo" aptget install -q -s foo | |
24e8f24e DK |
35 | } |
36 | ensureitsbroken | |
37 | ensureitsbroken -o Acquire::By-Hash=1 | |
50d98a1b | 38 | |
1e0f0f28 | 39 | ensureitworks() { |
24e8f24e | 40 | rm -rf rootdir/var/lib/apt/lists |
af81ab90 DK |
41 | testsuccess aptget update "$@" -o Acquire::Languages=none |
42 | testfailure grep '^Ign' rootdir/tmp/testsuccess.output | |
43 | rm -rf rootdir/var/lib/apt/lists | |
44 | testsuccess aptget update "$@" | |
45 | cp -f rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output | |
46 | testsuccess grep '^Ign' rootdir/tmp/aptupdate.output | |
1e0f0f28 | 47 | testsuccessequal "Inst foo (1.0 unstable [all]) |
a2fdb57f | 48 | Conf foo (1.0 unstable [all])" aptget install -qq -s foo |
1e0f0f28 | 49 | } |
24e8f24e DK |
50 | msgmsg 'Test by-hash via' 'config option' |
51 | ensureitworks -o Acquire::By-Hash=force | |
a2fdb57f | 52 | |
24e8f24e DK |
53 | msgmsg 'Test by-hash via' 'release option' |
54 | cp -a aptarchive/dists aptarchive/dists.bak | |
a2fdb57f | 55 | # add magic string to Release file ... |
24e8f24e DK |
56 | sed -i '/^Suite: / a \ |
57 | Acquire-By-Hash: yes' aptarchive/dists/unstable/Release | |
a2fdb57f | 58 | signreleasefiles |
24e8f24e DK |
59 | ensureitworks |
60 | ensureitsbroken -o Acquire::By-Hash=0 | |
61 | ||
62 | msgmsg 'Test by-hash via' 'sources option' | |
63 | sed -i "s#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir/etc/apt/sources.list.d/* | |
64 | ensureitworks | |
65 | #ensureitsbroken -o Acquire::By-Hash=0 | |
66 | ||
67 | rm -rf aptarchive/dists | |
68 | cp -a aptarchive/dists.bak aptarchive/dists | |
69 | #ensureitworks -o Acquire::By-Hash=force | |
70 | ensureitsbroken -o Acquire::By-Hash=1 | |
71 | ensureitsbroken -o Acquire::By-Hash=0 | |
a2fdb57f | 72 | |
24e8f24e | 73 | sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/* |
1e0f0f28 | 74 | ensureitworks |
24e8f24e | 75 | #ensureitsbroken -o Acquire::By-Hash=0 |