chiark / gitweb /
Test suite: Provide reprepro test (for aptget method)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Nov 2016 20:43:41 +0000 (20:43 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 6 Nov 2016 21:32:41 +0000 (21:32 +0000)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/tests/control
tests/lib-reprepro [new file with mode: 0644]
tests/tests/clone-reprepro [new file with mode: 0755]

index 6a6d92a65fabb10932b66faa970bb7cf6e6f659c..0aaabedbedee0710992bb5fa3a99219ea3f70f72 100644 (file)
@@ -2,6 +2,10 @@ Tests: build-modes-gbp
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, make, git-buildpackage
 
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, make, git-buildpackage
 
+Tests: clone-reprepro
+Tests-Directory: tests/tests
+Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, make, reprepro
+
 Tests: dsd-clone-drs
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, make
 Tests: dsd-clone-drs
 Tests-Directory: tests/tests
 Depends: dgit, dgit-infrastructure, devscripts, debhelper (>=8), fakeroot, make
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
+}
diff --git a/tests/tests/clone-reprepro b/tests/tests/clone-reprepro
new file mode 100755 (executable)
index 0000000..1313289
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+set -e
+. tests/lib
+. $troot/lib-reprepro
+
+t-dependencies reprepro
+t-reprepro
+
+t-archive example 1.0-1
+t-git-none
+
+t-dgit clone $p
+
+cd $p
+t-cloned-fetched-good
+
+echo ok.