[Reproducible-commits] [misc] 02/02: reports: newly-reproducible: make the autoview behaviour slightly more "auto"

Ximin Luo infinity0 at debian.org
Mon Aug 8 19:24:07 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 afadb7426b462b05d6efc3df978444592bd21717
Author: Ximin Luo <infinity0 at debian.org>
Date:   Mon Aug 8 21:23:52 2016 +0200

    reports: newly-reproducible: make the autoview behaviour slightly more "auto"
---
 reports/bin/newly-reproducible | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/reports/bin/newly-reproducible b/reports/bin/newly-reproducible
index 031072c..e144544 100755
--- a/reports/bin/newly-reproducible
+++ b/reports/bin/newly-reproducible
@@ -33,7 +33,7 @@ def trace_call(*args, **kwargs):
     except Exception:
         traceback.print_exc()
 
-def interact(name, details, fd=sys.stdin, nextname=None, prevname=None):
+def interact(name, details, autoview, fd=sys.stdin, nextname=None, prevname=None):
     oldattr = termios.tcgetattr(fd)
     newattr = read1charmode(fd)
     try:
@@ -41,7 +41,7 @@ def interact(name, details, fd=sys.stdin, nextname=None, prevname=None):
         full = []
         suite = []
         arch = []
-        autoview = True
+        autoview = bool(autoview)
         helptext = """
 h   Show this help
 v   View build logs
@@ -65,6 +65,8 @@ 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) "
+        view = lambda: trace_call(["bin/history"] + full + suite + arch + [name])
+        if autoview: view()
         while True:
             output(name, details)
             status = filter(None, [
@@ -75,7 +77,6 @@ Enter       Go to next item or quit if last item
             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 == ".":
@@ -91,12 +92,7 @@ Enter       Go to next item or quit if last item
             elif c in "a":
                 autoview = not autoview
             elif c == "r":
-                oldview = autoview
-                full = []
-                suite = []
-                arch = []
-                autoview = True
-                if oldview: view()
+                return 0
             elif c == "x":
                 full = ["-x"] if not full else []
                 if autoview: view()
@@ -120,6 +116,9 @@ parser.add_argument(
     '-i', '--interactive', action="store_true", default=False,
     help='enter an interactive REPL to examine each package in more detail')
 parser.add_argument(
+    '-a', '--autoview', action="store_true", default=False,
+    help='when in interactive mode, automatically view build logs')
+parser.add_argument(
     'package', nargs="*",
     help='only select these packages (if they became reproducible)')
 args = parser.parse_args()
@@ -195,7 +194,7 @@ if args.interactive:
         name, details = all_details[i]
         nextname = all_details[(i-1)%n][0]
         prevname = all_details[(i+1)%n][0]
-        chg = interact(name, details, sys.stdin, nextname, prevname)
+        chg = interact(name, details, args.autoview, sys.stdin, nextname, prevname)
         if chg is None:
             if i == len(all_details) - 1:
                 break

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