]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-by-hash-update
Merge remote-tracking branch 'upstream/debian/experimental' into feature/no-more...
[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
8configarchitecture "i386"
9
10insertpackage 'unstable' 'foo' 'all' '1.0'
11
12setupaptarchive --no-update
13
14APTARCHIVE=$(readlink -f ./aptarchive)
15
16# make Packages *only* accessable by-hash for this test
a2fdb57f
MV
17mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512
18(cd aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512 &&
19 mv ../../Packages* . &&
20 ln -s Packages.gz $(sha512sum Packages.gz|cut -f1 -d' ') )
50d98a1b
MV
21
22# add sources
a2fdb57f
MV
23mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
24(cd aptarchive/dists/unstable/main/source/by-hash/SHA512 &&
25 ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ')
50d98a1b
MV
26)
27
a2fdb57f
MV
28# we moved the Packages file away, normal update won't work
29testfailure aptget upate
50d98a1b
MV
30
31# ensure we do not know about "foo"
32testequal "Reading package lists...
33Building dependency tree...
34E: Unable to locate package foo" aptget install -q -s foo
35
36# ensure we can apt-get update by hash
4fa34122 37testsuccess aptget update -o APT::Acquire::By-Hash=1 -o Acquire::Languages=none
50d98a1b 38
a2fdb57f 39# ensure it works
50d98a1b 40testequal "Inst foo (1.0 unstable [all])
a2fdb57f
MV
41Conf foo (1.0 unstable [all])" aptget install -qq -s foo
42
43# add magic string to Release file ...
44MAGIC="Acquire-By-Hash: true"
45sed -i "s#Suite: unstable#Suite: unstable\n$MAGIC#" aptarchive/dists/unstable/Release
46signreleasefiles
47# ... and verify that it fetches by hash now
4fa34122 48testsuccess aptget update -o Acquire::Languages=none
a2fdb57f 49