chiark / gitweb /
Shell bug: avoid local=$(....) as it defeats set -e
[dgit.git] / tests / lib-reprepro
1 # -*- bash -*-
2
3 t-reprepro () {
4
5  t_archive_method=reprepro
6
7  t-git-config dgit-distro.test-dummy.archive-query aptget:
8  t-git-config dgit-distro.test-dummy.mirror file://$tmp/mirror/
9
10  mkdir $tmp/etc-apt
11  cat >$tmp/etc-apt/conf <<END
12 Dir::Etc "$tmp/etc-apt";
13 END
14  export APT_CONFIG=$tmp/etc-apt/conf
15  gpg --export Hannibal >han.pgp
16  fakeroot apt-key add <han.pgp
17  mkdir $tmp/etc-apt/apt.conf.d
18 }
19
20 t-archive-none-reprepro () {
21         t-reprepro-setup
22         t-reprepro-regen
23 }
24 t-archive-query-reprepro () {
25         local suite=$1
26         local p=$2
27         local v=$3
28         local dscf=$4
29         t-run-reprepro includedsc $suite $tmp/mirror/pool/$dscf
30 }
31
32 t-reprepro-setup () {
33         local rrc=$tmp/mirror/conf
34         mkdir -p $rrc
35         mkdir -p $tmp/mirror/pool/main
36
37         exec 3>$rrc/distributions
38
39         local arch; arch=`dpkg --print-architecture`
40
41         for suitespec in $suitespecs; do
42                 local suite=${suitespec%%:*}
43                 local sname=${suitespec#*:}
44
45                 mkdir -p $tmp/mirror/dists
46                 if [ $sname != $suite ]; then
47                         rm -f $tmp/mirror/dists/$sname
48                         ln -s $suite $tmp/mirror/dists/$sname
49                 fi
50
51                 cat >&3 <<END
52 Suite: $sname
53 Codename: $suite
54 Components: main
55 Architectures: source binary-$arch
56 SignWith: Hannibal
57
58 END
59         done
60 }
61
62 t-run-reprepro () {
63         reprepro \
64                 --outdir $tmp/mirror \
65                 --basedir $tmp/mirror \
66                 "$@"
67 }
68
69 t-reprepro-regen () {
70         t-run-reprepro export
71 }