summaryrefslogtreecommitdiff
path: root/tests/lib-reprepro
blob: 88102c89741f310b0b97730794b40cb2a16e61df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# -*- bash -*-

t-reprepro () {

 t_archive_method=reprepro

 t-reprepro-cfg
}

t-reprepro-cfg () {
 local etcapt=$tmp/etc-apt
 local mir=$tmp/mirror

 t-git-config dgit-distro.test-dummy.archive-query aptget:
 t-git-config dgit-distro.test-dummy.mirror file://$mir/

 mkdir $etcapt
 cat >$etcapt/conf <<END
Dir::Etc "$etcapt";
END
 export APT_CONFIG=$etcapt/conf
 gpg --export Hannibal >han.pgp
 fakeroot apt-key add <han.pgp
 mkdir $etcapt/apt.conf.d
}

t-archive-none-reprepro () {
	t-reprepro-setup
	t-reprepro-regen
}
t-archive-query-reprepro () {
	local suite=$1
	local p=$2
	local v=$3
	local dscf=$4
	t-run-reprepro includedsc $suite $tmp/mirror/pool/$dscf
}

t-reprepro-setup () {
	local mir=$tmp/mirror
	local rrc=$mir/conf
	mkdir -p $rrc
	mkdir -p $mir/pool/main

	exec 3>$rrc/distributions

	local arch; arch=`dpkg --print-architecture`

	for suitespec in $suitespecs; do
		local suite=${suitespec%%:*}
		local sname=${suitespec#*:}

		mkdir -p $mir/dists
		if [ $sname != $suite ]; then
			rm -f $mir/dists/$sname
			ln -s $suite $mir/dists/$sname
		fi

		cat >&3 <<END
Suite: $sname
Codename: $suite
Components: main
Architectures: source binary-$arch
SignWith: Hannibal

END
	done
}

t-run-reprepro () {
	local mir=$tmp/mirror
	reprepro \
		--outdir $mir \
		--basedir $mir \
		"$@"
}

t-reprepro-regen () {
	t-run-reprepro export
}