[Reproducible-commits] [misc] 01/01: reports: newly-reproducible: filter by arch, automatically view after changing settings

Ximin Luo infinity0 at debian.org
Mon Aug 8 18:50:41 UTC 2016


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

infinity0 pushed a commit to branch master
in repository misc.

commit d6f1612c1f6c9b753ae49397024eeddb2a2272a4
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Aug 8 20:50:31 2016 +0200

    reports: newly-reproducible: filter by arch, automatically view after changing settings
---
 reports/README                 |  3 ++-
 reports/bin/history            | 23 ++++++++++++++------
 reports/bin/newly-reproducible | 48 ++++++++++++++++++++++++++++++++++--------
 3 files changed, 57 insertions(+), 17 deletions(-)

diff --git a/reports/README b/reports/README
index 6aab4dc..16641f5 100644
--- a/reports/README
+++ b/reports/README
@@ -44,7 +44,8 @@ Process
    Look at each package individually:
 
        $ bin/history ghc                # defaults to unstable
-       $ bin/history ghc experimental
+       $ bin/history -s unstable ghc    # filter to suite unstable
+       $ bin/history -a armhf ghc       # filter to arch armhf
        $ bin/history -x ghc             # more details
        $ bin/history -c ghc             # also show changelogs
 
diff --git a/reports/bin/history b/reports/bin/history
index 80684e3..d5be590 100755
--- a/reports/bin/history
+++ b/reports/bin/history
@@ -8,7 +8,9 @@
 changelog=false
 less=false
 full=false
-while getopts 'xlc' opt; do
+suite=
+arch=
+while getopts 'xlcs:a:' opt; do
     case $opt in
         x)
             full=true
@@ -20,6 +22,12 @@ while getopts 'xlc' opt; do
         l)
             less=true
             ;;
+        s)
+            suite=$OPTARG
+            ;;
+        a)
+            arch=$OPTARG
+            ;;
     esac
 done
 shift `expr $OPTIND - 1`
@@ -31,12 +39,13 @@ else
     exit 1
 fi
 
-if [ -n "$2" ]; then
-    SUITE=" AND suite='$2' "
+FILTER=
+if [ -n "$suite" ]; then
+    FILTER="${FILTER} AND suite='$suite'"
 fi
 
-if [ -n "$3" ]; then
-    SUITE="$SUITE AND architecture='$3' "
+if [ -n "$arch" ]; then
+    FILTER="${FILTER} AND architecture='$arch'"
 fi
 
 DB="${DB:-latest/reproducible.db}"
@@ -46,10 +55,10 @@ SQLITE_OPTS="${SQLITE_OPTS:--column -header}"
 main() {
 
 if $full; then
-    QUERY="SELECT * FROM stats_build WHERE name='$PACKAGE' $SUITE ORDER BY build_date"
+    QUERY="SELECT * FROM stats_build WHERE name='$PACKAGE' $FILTER 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"
+    QUERY="SELECT name, version, suite, architecture AS arch, status, build_date FROM stats_build WHERE name='$PACKAGE' $FILTER ORDER BY build_date"
     WIDTH="0 25 0 7 6 13"
 fi
 sqlite3 $SQLITE_OPTS -cmd ".width $WIDTH" "$DB" "$QUERY"
diff --git a/reports/bin/newly-reproducible b/reports/bin/newly-reproducible
index 2cb8b4d..031072c 100755
--- a/reports/bin/newly-reproducible
+++ b/reports/bin/newly-reproducible
@@ -40,27 +40,42 @@ def interact(name, details, fd=sys.stdin, nextname=None, prevname=None):
         termios.tcsetattr(fd, termios.TCSANOW, newattr)
         full = []
         suite = []
+        arch = []
+        autoview = True
         helptext = """
 h   Show this help
 v   View build logs
 c   View Debian changelog for the latest version
+a   Do/don't automatically view build logs after changing settings
+
+r   Reset all settings
 x   Show/hide full details for "view build logs"
-t   Filter "view build logs" to testing
-u   Filter "view build logs" to testing
-e   Filter "view build logs" to testing
+
+t   Filter/unfilter "view build logs" to suite testing
+u   Filter/unfilter "view build logs" to suite unstable
+e   Filter/unfilter "view build logs" to suite experimental
+
+1   Filter/unfilter "view build logs" to arch amd64
+2   Filter/unfilter "view build logs" to arch i386
+3   Filter/unfilter "view build logs" to arch armhf
+
 .   Go to next item (%s)
 ,   Go to prev item (%s)
 Ctrl-C      Quit
 Enter       Go to next item or quit if last item
 """ % (nextname, prevname)
+        promptstr = "What do you want to do? [h]elp or [vcarxtue123.,] (status: %s) "
         while True:
             output(name, details)
-            print("What do you want to do? [h]elp or [vcftue.,] (will %s build log details%s) " % (
-                      "show" if full else "hide",
-                      ", filtered to %s" % suite[0] if suite else ""),
-                  end='', flush=True)
+            status = filter(None, [
+              "autoview" if autoview else None,
+              "details" if full else None,
+              "suite=%s" % suite[0][2:] if suite else None,
+              "arch=%s" % arch[0][2:] if arch else None])
+            print(promptstr % ", ".join(status), end='', flush=True)
             c = fd.read(1)
             print()
+            view = lambda: trace_call(["bin/history"] + full + suite + arch + [name])
             if c == "\n":
                 return None
             elif c == ".":
@@ -70,14 +85,29 @@ Enter       Go to next item or quit if last item
             elif c == "h":
                 print(helptext)
             elif c == "v":
-                trace_call(["bin/history", "-l"] + full + [name] + suite)
+                view()
             elif c == "c":
                 trace_call(["less", os.path.join(os.path.dirname(db_path), "changelogs", name)])
+            elif c in "a":
+                autoview = not autoview
+            elif c == "r":
+                oldview = autoview
+                full = []
+                suite = []
+                arch = []
+                autoview = True
+                if oldview: view()
             elif c == "x":
                 full = ["-x"] if not full else []
+                if autoview: view()
             elif c in "tue":
-                selected = dict((k[0], k) for k in ["testing", "unstable", "experimental"])[c]
+                selected = dict((k[0], "-s"+k) for k in ["testing", "unstable", "experimental"])[c]
                 suite = [selected] if suite != [selected] else []
+                if autoview: view()
+            elif c in "123":
+                selected = dict((k[0], "-a"+k[1:]) for k in ["1amd64", "2i386", "3armhf"])[c]
+                arch = [selected] if arch != [selected] else []
+                if autoview: view()
             else:
                 print(helptext)
         return 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