chiark / gitweb /
Infra: Add get-suites
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Jun 2015 22:54:13 +0000 (23:54 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 28 Jun 2015 22:54:13 +0000 (23:54 +0100)
Makefile
infra/get-suites [new file with mode: 0755]

index 8f9a84f46be56470fb59e691b7b9cf75bdc21d6a..3d9319a75bcbed28bbfd78decbdf8b0f9182cf1d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,7 @@ PERLMODULES=Debian/Dgit.pm
 INFRA_PROGRAMS=dgit-repos-server dgit-ssh-dispatch \
        dgit-repos-policy-debian dgit-repos-admin-debian \
        dgit-repos-policy-trusting
-INFRA_EXAMPLES=get-dm-txt ssh-wrap drs-cron-wrap
+INFRA_EXAMPLES=get-dm-txt ssh-wrap drs-cron-wrap get-suites
 INFRA_PERLMODULES=Debian/Dgit/Policy/Debian.pm
 
 all:
diff --git a/infra/get-suites b/infra/get-suites
new file mode 100755 (executable)
index 0000000..c5a4c56
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/bash
+set -e
+set -o pipefail
+
+srvdir=/srv/dgit.debian.org
+dgitlive=${DGIT_TEST_INTREE-$srvdir/dgit-live}
+output=${DGIT_GETSUITES_OUTPUT-$srvdir/data/suites}
+
+export PERLLIB="$dgitlive${PERLLIB+:}${PERLLIB}"
+
+$dgitlive/dgit archive-api-query /suites | perl -we '
+       use strict;
+       use JSON;
+       undef $/;
+       my $json = <STDIN>;
+       die $! if STDIN->error;
+       my $items = decode_json $json;
+       foreach my $item (@$items) {
+               next unless ($item->{archive}//"") eq "ftp-master";
+               next unless ($item->{codename});
+               print $item->{codename}, "\n" or die $!;
+       }
+       flush STDOUT or die $!;
+' >$output.new
+
+mv -f $output.new $output