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