chiark / gitweb /
Use ftpasterapi archive query method for tests
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Apr 2015 14:20:49 +0000 (15:20 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 May 2015 10:54:05 +0000 (11:54 +0100)
dgit
tests/lib

diff --git a/dgit b/dgit
index be90450..e5c8eab 100755 (executable)
--- 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',
                );
index 5caa4c3..1516646 100644 (file)
--- 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 <mirror/pool/$dscf`
+       echo "${v} ${sha%  -} $dscf" >>$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 () {