[Blends-commit] [SCM] website branch, master, updated. abd685adb8acde2a5917a6e72d2c6ba003b4e12e

Andreas Tille tille at debian.org
Fri Feb 5 09:29:59 UTC 2016


The following commit has been merged in the master branch:
commit abd685adb8acde2a5917a6e72d2c6ba003b4e12e
Author: Andreas Tille <tille at debian.org>
Date:   Fri Feb 5 10:29:50 2016 +0100

    Enable json output

diff --git a/misc/sql/edam.sh b/misc/sql/edam.sh
index baa0d29..65b3188 100755
--- a/misc/sql/edam.sh
+++ b/misc/sql/edam.sh
@@ -11,9 +11,18 @@ if psql $PORT -l 2>/dev/null | grep -qw udd ; then
     SERVICE=udd
 fi
 
+EXT=txt
+if [ "$1" = "-j" ] ; then
+  JSONBEGIN="SELECT array_to_json(array_agg(t)) FROM ("
+  JSONEND=") t"
+  EXT=json
+  OUTPUTFORMAT=--tuples-only
+fi
+
 team="'debian-med-packaging at lists.alioth.debian.org'"
 
-psql $PORT $SERVICE >edam.out <<EOT
+psql $PORT $OUTPUTFORMAT $SERVICE >edam.$EXT <<EOT
+$JSONBEGIN
   SELECT DISTINCT
          p.package, p.distribution, p.release, p.component, p.version,
          p.source, p.homepage
@@ -55,6 +64,7 @@ psql $PORT $SERVICE >edam.out <<EOT
         GROUP BY px.package, px.version
        ) pvar ON pvar.package = p.package AND pvar.version = p.version AND pvar.release = p.release
 
-   ORDER BY p.source, p.package;
-
+   ORDER BY p.source, p.package
+$JSONEND
+;
 EOT

-- 
Static and dynamic websites for Debian Pure Blends



More information about the Blends-commit mailing list