chiark / gitweb /
Test suite: Provide reprepro test (for aptget method)
[dgit.git] / tests / lib-reprepro
diff --git a/tests/lib-reprepro b/tests/lib-reprepro
new file mode 100644 (file)
index 0000000..8702044
--- /dev/null
@@ -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
+}