summaryrefslogtreecommitdiff
path: root/tests/lib-reprepro
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib-reprepro')
-rw-r--r--tests/lib-reprepro69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/lib-reprepro b/tests/lib-reprepro
new file mode 100644
index 0000000..8702044
--- /dev/null
+++ b/tests/lib-reprepro
@@ -0,0 +1,69 @@
+# -*- bash -*-
+
+t-reprepro () {
+
+ t_archive_method=reprepro
+
+ t-git-config dgit-distro.test-dummy.archive-query aptget:
+ t-git-config dgit-distro.test-dummy.mirror file://$tmp/mirror/
+
+ mkdir $tmp/etc-apt
+ cat >$tmp/etc-apt/conf <<END
+Dir::Etc "$tmp/etc-apt";
+END
+ export APT_CONFIG=$tmp/etc-apt/conf
+ gpg --export Hannibal >han.pgp
+ fakeroot apt-key add <han.pgp
+ mkdir $tmp/etc-apt/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 rrc=$tmp/mirror/conf
+ mkdir -p $rrc
+ mkdir -p $tmp/mirror/pool/main
+
+ exec 3>$rrc/distributions
+
+ local arch=`dpkg --print-architecture`
+
+ for suitespec in $suitespecs; do
+ local suite=${suitespec%%:*}
+ local sname=${suitespec#*:}
+
+ mkdir $tmp/mirror/dists
+ rm -f $tmp/mirror/dists/$sname
+ ln -s $suite $tmp/mirror/dists/$sname
+
+ cat >&3 <<END
+Suite: $sname
+Codename: $suite
+Components: main
+Architectures: source binary-$arch
+SignWith: Hannibal
+
+END
+ done
+}
+
+t-run-reprepro () {
+ reprepro \
+ --outdir $tmp/mirror \
+ --basedir $tmp/mirror \
+ "$@"
+}
+
+t-reprepro-regen () {
+ t-run-reprepro export
+}