[Reproducible-commits] [misc] 01/01: Update report scripts and documentation

Jérémy Bobbio lunar at moszumanska.debian.org
Mon Oct 19 09:32:00 UTC 2015


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

lunar pushed a commit to branch master
in repository misc.

commit 31248d468bc57c8dc61e04e046b183721aef8986
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Mon Oct 19 11:28:00 2015 +0200

    Update report scripts and documentation
---
 reports/README                 |  2 +-
 reports/bin/history            | 20 ++++++++++++++----
 reports/bin/newly-reproducible | 48 ++++++++++++++++++++++++------------------
 3 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/reports/README b/reports/README
index 9832a29..cc629eb 100644
--- a/reports/README
+++ b/reports/README
@@ -34,7 +34,7 @@ Process
    To download all the changelogs, one can do:
 
        $ mkdir changelogs
-       $ for url in $(bin/newly-reproducible | sed -n -e 's,.*<,,;s,>,,p'); do
+       $ for url in $(bin/newly-reproducible | sed -n -e 's,.*<,,;s,>.*,,p') | sort -u; do
              p=${url%/*}; p=${p##*/};
              torsocks wget -O changelogs/$p $url;
          done
diff --git a/reports/bin/history b/reports/bin/history
index f480fd9..5d531c6 100755
--- a/reports/bin/history
+++ b/reports/bin/history
@@ -5,6 +5,8 @@
 #           © 2015 Mattia Rizzolo <mattia at mapreri.org>
 # Licensed under WTFPL — http://www.wtfpl.net/txt/copying/
 
+# Set `FULL=yes` in the environment to get full output.
+
 if [ -n "$1" ]; then
     PACKAGE=$1
 else
@@ -16,17 +18,27 @@ if [ -n "$2" ]; then
     SUITE=" AND suite='$2' "
 fi
 
+if [ -n "$3" ]; then
+    SUITE="$SUITE AND architecture='$3' "
+fi
+
 DB="${DB:-reproducible.db}"
 SQLITE_OPTS="${SQLITE_OPTS:--column -header}"
 
-QUERY="SELECT * FROM stats_build WHERE name='$PACKAGE' $SUITE ORDER BY build_date"
-WIDTH="5 0 0 0 0 15 0 0 13"
+if [ "$FULL" ]; then
+    QUERY="SELECT * FROM stats_build WHERE name='$PACKAGE' $SUITE ORDER BY build_date"
+    WIDTH="5 0 0 0 0 15 0 0 13"
+else
+    QUERY="SELECT name, version, suite, architecture AS arch, status, build_date FROM stats_build WHERE name='$PACKAGE' $SUITE ORDER BY build_date"
+    WIDTH="0 25 0 7 6 13"
+fi
 sqlite3 $SQLITE_OPTS -cmd ".width $WIDTH" "$DB" "$QUERY"
 
+test "$FULL" || exit 0
 
 printf "\n\n@@@@@ RESULTS @@@@@@\n"
-QUERY="SELECT s.id as 'pkg id', s.name, s.version, s.suite, s.architecture as arch, s.notify_maintainer, r.version as 'tested version', r.status, r.build_date, r.build_duration as duration, r.builder
+QUERY="SELECT s.id as 'pkg id', s.name, s.version, s.suite, s.architecture as arch, s.notify_maintainer as notify, r.version as 'tested version', r.status, r.build_date, r.build_duration as duration, r.builder
 FROM sources AS s JOIN results AS r ON r.package_id=s.id WHERE s.name='$PACKAGE'"
-WIDTH="6 0 0 0 5 0 0 0 16 0 13"
+WIDTH="6 0 0 0 5 6 0 0 16 0 13"
 RESULT="$(sqlite3 $SQLITE_OPTS -cmd ".width $WIDTH" "$DB" "$QUERY" 2> /dev/null)"
 if [ ! -z "$RESULT" ] ; then echo "$RESULT" ; else echo "$PACKAGE has not been built yet" ; fi
diff --git a/reports/bin/newly-reproducible b/reports/bin/newly-reproducible
index 86705bc..616036b 100755
--- a/reports/bin/newly-reproducible
+++ b/reports/bin/newly-reproducible
@@ -5,42 +5,50 @@
 # Licensed under WTFPL — http://www.wtfpl.net/txt/copying/
 
 import re
+import sys
 import sqlite3
+import time
+
+query_add = ''
+if len(sys.argv) > 1:
+    query_add = "AND name IN ({})".format(', '.join(map(repr, sys.argv[1:])))
 
 conn = sqlite3.connect('reproducible.db')
 
 c = conn.cursor()
 
 now_reproducible = {}
-for name, reproducible_version, suite, reproducible_build_time in c.execute('SELECT name, version, 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'):
-    if name in 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)):
+    package_id = '%s/%s' % (name, architecture)
+    if package_id in now_reproducible or package_id in unreproducible_version:
         continue
     c2 = conn.cursor()
-    res = c2.execute('SELECT status FROM stats_build WHERE name = ? AND suite = ? AND build_date < DATETIME(?, "unixepoch") ORDER BY build_date DESC LIMIT 1', (name, suite, int(reproducible_build_time) - 1)).fetchone()
-    if res and res[0] == 'reproducible':
-        continue
-    res = c2.execute('SELECT status FROM stats_build WHERE name = ? AND suite = ? AND version = ? AND status = "reproducible" AND build_date < DATETIME(?, "unixepoch")', (name, suite, reproducible_version, int(reproducible_build_time) - 1)).fetchone()
-    if res:
-        continue
-    for version, status, build_time in c2.execute('SELECT version, status, strftime("%s", build_date) FROM stats_build WHERE name = ? AND suite = ? AND build_date < DATETIME(?, "unixepoch") ORDER BY build_date DESC', (name, suite, int(reproducible_build_time) - 1)):
-        if status in ('reproducible', 'FTBFS', 'depwait'):
-            if name in now_reproducible and 'toolchain' in now_reproducible[name]:
-                del now_reproducible[name]
-                continue
+    for version, status, build_time in c2.execute('SELECT version, status, strftime("%s", build_date) FROM stats_build WHERE name = ? AND architecture = ? AND suite = ? AND build_date < DATETIME(?, "unixepoch") ORDER BY build_date DESC', (name, architecture, suite, int(reproducible_build_time) - 1)):
+        if status in ('FTBFS', 'depwait'):
+            continue
+        elif status == 'reproducible':
+            if package_id in now_reproducible:
+                del now_reproducible[package_id]
+            if version != reproducible_version:
+                break
+            if time.time() - int(build_time) > 604800.0: # 1 week
+                break
         elif status == 'unreproducible':
-            if name in now_reproducible:
-                continue
             if version == reproducible_version:
-                now_reproducible[name] = 'likely due to toolchain fixes'
-            else:
+                now_reproducible[package_id] = 'likely due to toolchain fixes'
+            elif package_id not in unreproducible_version:
                 if name.startswith('lib'):
                     prefix = name[0:4]
                 else:
                     prefix = name[0]
                 changelog_url = 'http://metadata.ftp-master.debian.org/changelogs/main/%(prefix)s/%(name)s/%(name)s_%(version)s_changelog' % { 'prefix':prefix, 'name': name, 'version': re.sub(r'^[0-9]+:', '', reproducible_version) }
-                now_reproducible[name] = 'since %s over %s <%s>' % (reproducible_version, version, changelog_url)
+                now_reproducible[package_id] = 'since %s over %s <%s>' % (reproducible_version, version, changelog_url)
+                break
+            unreproducible_version[package_id] = version
         else:
             print('UNKNOWN STATUS %s' % status)
 
-for name in sorted(now_reproducible.keys()):
-    print("[%s](https://tracker.debian.org/%s) is reproducible %s" % (name, name, now_reproducible[name]))
+for package_id in sorted(now_reproducible.keys()):
+    name, architecture = package_id.split('/')
+    print("[%s](https://tracker.debian.org/%s) is reproducible %s on %s" % (name, name, now_reproducible[package_id], architecture))

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