+ 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/pool/main/
+ t-archive-query
+}
+
+t-archive-query () {
+ 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