+ mkdir -p $tmp/aq $tmp/mirror/pool/main
+
+ local suite=sid
+
+ >$tmp/aq/package.$suite.$p
+ t-archive-updated $suite $p
+
+ >$tmp/aq/package.new.$p
+ t-archive-updated new $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
+ local suitedir=$tmp/aq/dsc_in_suite/$suite
+ mkdir -p $suitedir
+ perl <$tmp/aq/package.$suite.$p >$suitedir/$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 () {
+ local suite=$1
+ mv $tmp/incoming/${p}_${v}[._]* $tmp/mirror/pool/main/
+ t-archive-query "$suite"
+}
+
+t-archive-query () {
+ local suite=${1-sid}
+ local dscf=main/${p}_${v}.dsc
+ local sha=`sha256sum <$tmp/mirror/pool/$dscf`
+ echo "${v} ${sha% -} $dscf" >>$tmp/aq/package.$suite.${p}
+ t-archive-updated $suite $p