]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-apt-by-hash-update
show StateCache flags in Pkg debug prettyprint
[apt.git] / test / integration / test-apt-by-hash-update
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6
7setupenvironment
8configarchitecture 'i386'
9confighashes 'SHA512'
10configcompression '.' 'gz'
11
12insertpackage 'unstable' 'foo' 'all' '1.0'
13insertpackage 'unstable' 'bar' 'i386' '1.0'
14
15setupaptarchive --no-update
16
17# make Packages *only* accessible by-hash for this test
18makebyhashonly() {
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}
25makebyhashonly 'binary-i386' 'Packages'
26makebyhashonly 'binary-all' 'Packages'
27makebyhashonly 'source' 'Sources'
28
29ensureitsbroken() {
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...
35Building dependency tree...
36E: Unable to locate package foo" aptget install -q -s foo
37}
38ensureitsbroken
39ensureitsbroken -o Acquire::By-Hash=1
40
41ensureitworks() {
42 rm -rf rootdir/var/lib/apt/lists
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
49 testsuccessequal "Inst foo (1.0 unstable [all])
50Conf foo (1.0 unstable [all])" aptget install -qq -s foo
51 testsuccessequal "Inst bar (1.0 unstable [i386])
52Conf bar (1.0 unstable [i386])" aptget install -qq -s bar
53}
54msgmsg 'Test by-hash via' 'config option'
55ensureitworks -o Acquire::By-Hash=force
56
57msgmsg 'Test by-hash via' 'release option'
58cp -a aptarchive/dists aptarchive/dists.bak
59# add magic string to Release file ...
60sed -i '/^Suite: / a \
61Acquire-By-Hash: yes' aptarchive/dists/unstable/Release
62signreleasefiles
63ensureitworks
64ensureitsbroken -o Acquire::By-Hash=0
65
66msgmsg 'Test by-hash via' 'sources option'
67sed -i "s#^\(deb\(-src\)\?\) #\1 [by-hash=yes] #" rootdir/etc/apt/sources.list.d/*
68ensureitworks
69#ensureitsbroken -o Acquire::By-Hash=0
70
71rm -rf aptarchive/dists
72cp -a aptarchive/dists.bak aptarchive/dists
73#ensureitworks -o Acquire::By-Hash=force
74ensureitsbroken -o Acquire::By-Hash=1
75ensureitsbroken -o Acquire::By-Hash=0
76
77sed -i "s#^\(deb\(-src\)\?\) \[by-hash=yes\] #\1 [by-hash=force] #" rootdir/etc/apt/sources.list.d/*
78ensureitworks
79#ensureitsbroken -o Acquire::By-Hash=0