chiark / gitweb /
test suite: debpolicy-taintrm: Drop some xxx's
[dgit.git] / tests / lib-reprepro
1 # -*- bash -*-
2
3 t-reprepro () {
4
5  t_archive_method=reprepro
6
7  t-reprepro-cfg
8 }
9
10 t-reprepro-cfg () {
11  local rrinst=$1
12  local rrdistro=${2:-test-dummy}
13
14  local etcapt=$tmp/${rrinst}etc-apt
15  local mir=$tmp/${rrinst}mirror
16
17  t-git-config dgit-distro.$rrdistro.archive-query aptget:
18  t-git-config dgit-distro.$rrdistro.mirror file://$mir/
19
20  mkdir $etcapt
21  cat >$etcapt/conf <<END
22 Dir::Etc "$etcapt";
23 END
24  export APT_CONFIG=$etcapt/conf
25  gpg --export Hannibal >han.pgp
26  fakeroot apt-key add <han.pgp
27  mkdir $etcapt/apt.conf.d
28 }
29
30 t-archive-none-reprepro () { # hook called by t-archive-none
31         t-reprepro-setup
32         t-reprepro-regen
33         local rrinst=
34 }
35 t-archive-query-reprepro () { # hook called by t-archive-query
36         local suite=$1
37         local p=$2
38         local v=$3
39         local dscf=$4
40         local rrinst=
41         t-reprepro-includedsc $suite $tmp/mirror/pool/$dscf "$rrinst"
42 }
43
44 t-reprepro-setup () {
45         local rrinst=$1
46
47         local mir=$tmp/${rrinst}mirror
48         local rrc=$mir/conf
49         mkdir -p $rrc
50         mkdir -p $mir/pool/main
51
52         exec 3>$rrc/distributions
53
54         local arch; arch=`dpkg --print-architecture`
55
56         for suitespec in $suitespecs; do
57                 local suite=${suitespec%%:*}
58                 local sname=${suitespec#*:}
59
60                 mkdir -p $mir/dists
61                 if [ $sname != $suite ]; then
62                         rm -f $mir/dists/$sname
63                         ln -s $suite $mir/dists/$sname
64                 fi
65
66                 cat >&3 <<END
67 Suite: $sname
68 Codename: $suite
69 Components: main
70 Architectures: source binary-$arch
71 SignWith: Hannibal
72
73 END
74         done
75 }
76
77 t-reprepro-includedsc () {
78         local suite=$1
79         local dscf=$2
80         local rrinst=$3
81         t-reprepro--run includedsc $suite $dscf
82 }
83
84 t-reprepro--run () {
85         # caller is supposed to have set rrinst
86         local mir=$tmp/${rrinst}mirror
87         reprepro \
88                 --outdir $mir \
89                 --basedir $mir \
90                 "$@"
91 }
92
93 t-reprepro-regen () {
94         local rrinst=$1
95
96         t-reprepro--run export
97 }