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