From 475e31b775275ac895e21afa4143c10596b512d1 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 19 Apr 2015 15:20:49 +0100 Subject: [PATCH] Use ftpasterapi archive query method for tests --- dgit | 3 ++- tests/lib | 59 +++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 9 deletions(-) diff --git a/dgit b/dgit index be904504..e5c8eab9 100755 --- a/dgit +++ b/dgit @@ -546,7 +546,8 @@ our %defcfg = ('dgit.default.distro' => 'debian', 'dgit-distro.test-dummy.git-url' => "$td/git", 'dgit-distro.test-dummy.git-host' => "git", 'dgit-distro.test-dummy.git-path' => "$td/git", - 'dgit-distro.test-dummy.archive-query' => "dummycat:$td/aq", + 'dgit-distro.test-dummy.archive-query' => "ftpmasterapi:", + 'dgit-distro.test-dummy.archive-query-url' => "file://$td/aq/", 'dgit-distro.test-dummy.mirror' => "file://$td/mirror/", 'dgit-distro.test-dummy.upload-host' => 'test-dummy', ); diff --git a/tests/lib b/tests/lib index 5caa4c31..1516646f 100644 --- a/tests/lib +++ b/tests/lib @@ -85,30 +85,73 @@ t-has-ancestor () { t-archive-none () { p=$1 - mkdir -p $tmp/aq $tmp/mirror/main - echo sid >$tmp/aq/suite.unstable + mkdir -p $tmp/aq $tmp/mirror/pool/main + mkdir -p $tmp/aq/dsc_in_suite $tmp/aq/dsc_in_suite/sid + + local suite=sid + >$tmp/aq/package.$suite.$p + t-archive-updated $suite $p + + ln -s sid $tmp/aq/dsc_in_suite/unstable + cat <<'END' >$tmp/aq/suites +[ + { + "archive" : "ftp-master", + "codename" : "sid", + "components" : [ + "main", + "contrib", + "non-free" + ], + "name" : "unstable", + "dakname" : "unstable" + } +] +END +} + +t-archive-updated () { + local suite=$1 + local p=$2 + perl <$tmp/aq/package.$suite.$p >$tmp/aq/dsc_in_suite/$suite/$p -wne ' + use JSON; + use strict; + our @v; + m{^(\S+) (\w+) ([^ \t/]+)/(\S+)} or die; + push @v, { + "version" => "$1", + "sha256sum" => "$2", + "component" => "$3", + "filename" => "$4", + }; + END { + print to_json \@v or die $!; + } + ' } t-archive-process-incoming () { - mv incoming/${p}_${v}[._]* mirror/main/ + mv incoming/${p}_${v}[._]* mirror/pool/main/ t-archive-query } t-archive-query () { - local dscf=${p}_${v}.dsc - echo "${v} main/$dscf" >>$tmp/aq/package.sid.${p} + local dscf=main/${p}_${v}.dsc + local sha=`sha256sum >$tmp/aq/package.sid.${p} + t-archive-updated sid $p } t-archive () { t-archive-none $1 v=$2 local dscf=${p}_$2.dsc - rm -f $tmp/mirror/main/${p}_* - ln $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/main/ + rm -f $tmp/mirror/pool/main/${p}_* + ln $troot/pkg-srcs/${p}_${2%-*}* $tmp/mirror/pool/main/ t-archive-query rm -rf $tmp/extract mkdir $tmp/extract - (set -e; cd $tmp/extract; dpkg-source -x ../mirror/main/$dscf) + (set -e; cd $tmp/extract; dpkg-source -x ../mirror/pool/main/$dscf) } t-dgit () { -- 2.30.2