diff options
author | Valerie R Young <spectranaut@riseup.net> | 2016-09-16 21:09:49 -0400 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2016-11-08 16:53:29 +0100 |
commit | 21ce98cd746a35df07891084baea6bbde1876166 (patch) | |
tree | 8e27f66673e78ba9d573d417f4953e66af7b9d19 /bin/reproducible_nodes_info.sh | |
parent | 464d96e0aea8158077777ddd42cd2cc3d6bbd01a (diff) | |
download | jenkins.debian.net-21ce98cd746a35df07891084baea6bbde1876166.tar.xz |
reproducible debian: make bash sql sqlite/postgres agnostic
This commit does the following for all bash scripts:
- remove sqlite specfic datetime functions in sql queries
- remove double quotes from sql queries
- replace the "REPLACE INTO" sql queries
Signed-off-by: Mattia Rizzolo <mattia@debian.org>
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/reproducible_nodes_info.sh')
-rwxr-xr-x | bin/reproducible_nodes_info.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/bin/reproducible_nodes_info.sh b/bin/reproducible_nodes_info.sh index f7ab93fd..034b0b02 100755 --- a/bin/reproducible_nodes_info.sh +++ b/bin/reproducible_nodes_info.sh @@ -57,13 +57,14 @@ TMPFILE2=$(mktemp) TMPFILE3=$(mktemp) NOW=$(date -u '+%Y-%m-%d %H:%m') for i in $BUILD_NODES ; do - query_db "SELECT build_date FROM stats_build AS r WHERE ( r.node1=\"$i\" OR r.node2=\"$i\" )" > $TMPFILE1 2>/dev/null + query_db "SELECT build_date FROM stats_build AS r WHERE ( r.node1='$i' OR r.node2='$i' )" > $TMPFILE1 2>/dev/null j=$(wc -l $TMPFILE1|cut -d " " -f1) k=$(cat $TMPFILE1|cut -d " " -f1|sort -u|wc -l) l=$(echo "scale=1 ; ($j/$k)" | bc) echo "$l builds/day ($j/$k) on $i" >> $TMPFILE2 - m=$(query_db "SELECT count(build_date) FROM stats_build AS r WHERE ( r.node1=\"$i\" OR r.node2=\"$i\" ) AND r.build_date > datetime('$NOW', '-24 hours') " 2>/dev/null) - echo "$m builds in the last 24h on $i" >> $TMPFILE3 + DATE=$(date '+%Y-%m-%d %H:%M' -d "-1 days") + m=$(query_db "SELECT count(build_date) FROM stats_build AS r WHERE ( r.node1='$i' OR r.node2='$i' ) AND r.build_date > '$DATE' " 2>/dev/null) + echo "$m builds in the last 24h on $i" >> $TMPFILE3 done rm $TMPFILE1 >/dev/null sort -g -r $TMPFILE2 |