[Reproducible-commits] [misc] 01/01: review-bugs: support filtering for specific week

Reiner Herrmann reiner at reiner-h.de
Wed Apr 20 21:10:48 UTC 2016


This is an automated email from the git hooks/post-receive script.

deki-guest pushed a commit to branch master
in repository misc.

commit 6fdbe9f5b444443892e806846684245ccb277100
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Wed Apr 20 23:07:55 2016 +0200

    review-bugs: support filtering for specific week
---
 reports/bin/review-bugs | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/reports/bin/review-bugs b/reports/bin/review-bugs
index 6a1b926..228bb6c 100755
--- a/reports/bin/review-bugs
+++ b/reports/bin/review-bugs
@@ -1,11 +1,26 @@
-#!/bin/sh
+#!/bin/bash
 # review-bugs: look at bugs modified in the past week
 #
 # Copyright © 2015 Lunar <lunar at debian.org>
 # Licensed under WTFPL — http://www.wtfpl.net/txt/copying/
 
+
+week_1=1430604000 # May 3 2015, 00:00
+
+while getopts 'w:' opt; do
+	case $opt in
+		w)
+			week=$OPTARG
+			;;
+	esac
+done
+
+query_date_end=$(date +%s)
+[ -n "$week" ] && query_date_end=$((week_1 + (week - 1)*7*24*3600))
+query_date_begin=$((query_date_end - 7*24*3600))
+
 if ! [ -f bugs ]; then
-	echo "SELECT DISTINCT bugs.id FROM bugs_usertags, bugs WHERE email = 'reproducible-builds at lists.alioth.debian.org' AND bugs.id = bugs_usertags.id AND bugs.last_modified > DATE_TRUNC('DAY', NOW() - INTERVAL '7 DAY') AND bugs.last_modified < DATE_TRUNC('DAY', NOW()) ORDER BY bugs.id;" | ssh alioth.debian.org psql service=udd -t | awk '/[0-9]/ { print $1 }' > bugs
+	echo "SELECT DISTINCT bugs.id FROM bugs_usertags, bugs WHERE email = 'reproducible-builds at lists.alioth.debian.org' AND bugs.id = bugs_usertags.id AND bugs.last_modified > to_timestamp($query_date_begin) AND bugs.last_modified < to_timestamp($query_date_end) ORDER BY bugs.id;" | ssh alioth.debian.org psql service=udd -t | awk '/[0-9]/ { print $1 }' > bugs
 fi
 
 TOTAL="$(wc -l bugs | awk '{ print $1 }')"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/misc.git



More information about the Reproducible-commits mailing list