From 76cbbc78a07e44b4c917bbaa93bf7cd602387082 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 28 Jun 2015 23:54:13 +0100 Subject: [PATCH] Infra: Add get-suites --- Makefile | 2 +- infra/get-suites | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100755 infra/get-suites diff --git a/Makefile b/Makefile index 8f9a84f4..3d9319a7 100644 --- 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 index 00000000..c5a4c569 --- /dev/null +++ b/infra/get-suites @@ -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 = ; + 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 -- 2.30.2