summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-11-07 16:45:00 +0000
committerHolger Levsen <holger@layer-acht.org>2014-11-07 16:45:00 +0000
commit41707352ccc6867180d80ad71801942d7ded423a (patch)
tree39e54f385f646c6291749ddde752180506efae18
parent759a9b5da7a678c03f86fca7ecac57060721c53a (diff)
downloadjenkins.debian.net-41707352ccc6867180d80ad71801942d7ded423a.tar.xz
reproducible: new job to generate https://jenkins.debian.net/userContent/reproducible.json
-rwxr-xr-xbin/reproducible_json.sh41
-rw-r--r--job-cfg/reproducible.yaml9
2 files changed, 50 insertions, 0 deletions
diff --git a/bin/reproducible_json.sh b/bin/reproducible_json.sh
new file mode 100755
index 00000000..9c38d42d
--- /dev/null
+++ b/bin/reproducible_json.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# Copyright 2014 Holger Levsen <holger@layer-acht.org>
+# released under the GPLv=2
+
+DEBUG=false
+. /srv/jenkins/bin/common-functions.sh
+common_init "$@"
+
+# common code defining db access
+. /srv/jenkins/bin/reproducible_common.sh
+
+set +x
+
+write_json() {
+ echo "$1" >> $JSON
+}
+
+JSON=$(mktemp)
+RESULT=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT name,version,status FROM source_packages WHERE status != \"\"")
+COUNT_TOTAL=$(sqlite3 -init $INIT $PACKAGES_DB "SELECT COUNT(name) FROM source_packages WHERE status != \"\"")
+echo "$(date) - processing $COUNT_TOTAL packages to create .json output... this will take a while."
+
+write_json "["
+for LINE in $RESULT ; do
+ PKG=$(echo $LINE | cut -d "|" -f1)
+ VERSION=$(echo $LINE | cut -d "|" -f2)
+ STATUS=$(echo $LINE | cut -d "|" -f3)
+ write_json "{"
+ write_json "\"package\": \"$PKG\","
+ write_json "\"version\": \"$VERSION\","
+ write_json "\"status\": \"$STATUS\","
+ write_json "\"suite\": \"sid\""
+ write_json "}"
+done
+write_json "]"
+
+echo
+echo "$(date) - $JENKINS_URL/userContent/reproducible.json has been updated."
+mv $JSON /var/lib/jenkins/userContent/reproducible.json
+chmod 755 /var/lib/jenkins/userContent/reproducible.json
diff --git a/job-cfg/reproducible.yaml b/job-cfg/reproducible.yaml
index 5d727799..f04af247 100644
--- a/job-cfg/reproducible.yaml
+++ b/job-cfg/reproducible.yaml
@@ -153,6 +153,10 @@
name: '{name}_html_all_packages'
- job-template:
+ defaults: reproducible
+ name: '{name}_json'
+
+- job-template:
defaults: reproducible_builder
name: '{name}_builder_alpha'
@@ -220,6 +224,11 @@
my_timed: '12 12 30 12 *'
my_shell: '/srv/jenkins/bin/reproducible_html_all_packages.sh'
my_recipients: 'holger@layer-acht.org'
+ - '{name}_json':
+ my_description: 'Generates https://jenkins.debian.net/userContent/reproducible.json for consumption by tracker.debian.org.'
+ my_timed: '1 0 * * *'
+ my_shell: '/srv/jenkins/bin/reproducible_html_all_packages.sh'
+ my_recipients: 'holger@layer-acht.org'
- '{name}_builder_alpha':
my_description: 'Try to reproducibly build a scheduled package. This is one of several builder jobs.'
my_timed: 'H/2 * * * *'