Possible Code Changes For Tickets #41 #76
In terms of adding "tail-like" functionality to Koji "watch-logs" sub-command:*
https://fedorahosted.org/koji/ticket/41 https://fedorahosted.org/koji/ticket/76 $ ./koji-1.6.0/cli/koji watch-logs 3559606 --log=build.log --tail=10 Watching logs (this may be safely interrupted)... Wrote: /builddir/build/RPMS/calibre-0.8.29-1.fc15.i686.rpm Wrote: /builddir/build/RPMS/calibre-debuginfo-0.8.29-1.fc15.i686.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.RypJxm + umask 022 + cd /builddir/build/BUILD + cd calibre + /bin/rm -rf /builddir/build/BUILDROOT/calibre-0.8.29-1.fc15.i386 + exit 0 Child returncode was: 0 LEAVE do -->* $ diff -u /usr/bin/koji ./koji-1.6.0/cli/koji --- /usr/bin/koji 2010-12-16 16:13:17.000000000 -0500 +++ ./koji-1.6.0/cli/koji 2011-12-03 17:09:42.225650495 -0500 @@ -433,6 +433,7 @@ * * * * * * *offsets[task_id] = {} * * * * * *lastlog = None + * * * *logline = "" * * * * *while True: * * * * * * *for task_id in tasklist[:]: * * * * * * * * *if _isDone(session, task_id): @@ -458,15 +459,28 @@ * * * * * * * * * * * * * * *currlog = "%d:%s:" % (task_id, log) * * * * * * * * * * * * * * *if currlog != lastlog: * * * * * * * * * * * * * * * * *if lastlog: - * * * * * * * * * * * * * * * * * *sys.stdout.write(" ") - * * * * * * * * * * * * * * * *sys.stdout.write("==> %s <== " % currlog) + * * * * * * * * * * * * * * * * * *logline += (" ") + * * * * * * * * * * * * * * * *logline += ("==> %s <== " % currlog) * * * * * * * * * * * * * * * * *lastlog = currlog - * * * * * * * * * * * * * *sys.stdout.write(contents) + * * * * * * * * * * * * * *logline += (contents) * * * * * * * *if not tasklist: * * * * * * * * *break * * * * * * * *time.sleep(options.poll_interval) + * * * * + * * * *loglist = logline.strip(" ").split(" ") + * * * *endline = len(loglist) + * * * *try: + * * * * * *subvalue = int(opts.tail) + * * * *except: + * * * * * *subvalue = endline + * * * *if (subvalue > endline): + * * * * * *subvalue = endline + * * * *begline = (endline - subvalue) + * * * *for x in range(begline, endline): + * * * * * *print(loglist[x]) + * * * * * * *except (KeyboardInterrupt): * * * * *pass * @@ -5083,6 +5097,7 @@ * * *usage += _(" (Specify the --help global option for a list of other help options)") * * *parser = OptionParser(usage=usage) * * *parser.add_option("--log", help=_("Watch only a specific log")) + * *parser.add_option("--tail", help=_("Watch only the last N lines")) * * *(options, args) = parser.parse_args(args) * * *activate_session(session) * -- buildsys mailing list buildsys@lists.fedoraproject.org https://admin.fedoraproject.org/mailman/listinfo/buildsys |
| All times are GMT. The time now is 08:55 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.