[Reproducible-commits] [misc] 01/01: newly-reproducible: add option -w $week to filter for this week

Reiner Herrmann reiner at reiner-h.de
Mon Apr 18 20:14:11 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 a032d26b47b743301f5b21b5846134f66068aea3
Author: Reiner Herrmann <reiner at reiner-h.de>
Date:   Mon Apr 18 22:12:51 2016 +0200

    newly-reproducible: add option -w $week to filter for this week
---
 reports/bin/newly-reproducible | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/reports/bin/newly-reproducible b/reports/bin/newly-reproducible
index 284cf77..fdca529 100755
--- a/reports/bin/newly-reproducible
+++ b/reports/bin/newly-reproducible
@@ -9,10 +9,20 @@ import re
 import sys
 import sqlite3
 import time
+import getopt
 
+week_1 = 1430604000 # May 3 2015, 00:00
+
+opts, args = getopt.getopt(sys.argv[1:], 'w:')
 query_add = ''
-if len(sys.argv) > 1:
-    query_add = "AND name IN ({})".format(', '.join(map(repr, sys.argv[1:])))
+if len(args) > 1:
+    query_add = "AND name IN ({})".format(', '.join(map(repr, args)))
+
+if len(opts) > 0:
+    query_date_end = week_1 + (int(opts[0][1]) - 1)*7*24*3600
+else:
+    query_date_end = int(time.time())
+query_date_begin = query_date_end - 7*24*3600
 
 db_path = os.environ.get('REPRODUCIBLE_DB', 'reproducible.db')
 conn = sqlite3.connect(db_path)
@@ -21,7 +31,7 @@ c = conn.cursor()
 
 now_reproducible = {}
 unreproducible_version = {}
-for name, reproducible_version, architecture, suite, reproducible_build_time in c.execute('SELECT name, version, architecture, suite, strftime("%s", build_date) FROM stats_build WHERE status = "reproducible" AND build_date > DATE("now", "-7 day") AND suite = "unstable" {} ORDER BY build_date DESC'.format(query_add)):
+for name, reproducible_version, architecture, suite, reproducible_build_time in c.execute('SELECT name, version, architecture, suite, strftime("%s", build_date) FROM stats_build WHERE status = "reproducible" AND build_date > DATETIME(?, "unixepoch") AND build_date < DATETIME(?, "unixepoch") AND suite = "unstable" {} ORDER BY build_date DESC'.format(query_add), (query_date_begin, query_date_end)):
     package_id = '%s/%s' % (name, architecture)
     if package_id in now_reproducible or package_id in unreproducible_version:
         continue
@@ -35,7 +45,7 @@ for name, reproducible_version, architecture, suite, reproducible_build_time in
                 del now_reproducible[package_id]
             if version != reproducible_version:
                 break
-            if time.time() - int(build_time) > 604800.0: # 1 week
+            if query_date_begin > int(build_time):
                 break
         elif status == 'unreproducible':
             if version == reproducible_version:

-- 
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