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