From 29fa2b08106b09384f9d8d3bf32ee4a5aa09e55a Mon Sep 17 00:00:00 2001 From: "Dr. Peter Poeml" Date: Fri, 16 Jun 2006 12:40:26 +0000 Subject: [PATCH] - add support for streaming build log, while it is being written (patch by Christoph Thiel) --- osc/commandline.py | 8 +++++++- osc/core.py | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index f827d7f0..7e62d31e 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -558,7 +558,13 @@ usage: log platform = args[0] arch = args[1] - print ''.join(get_log(project, package, platform, arch)) + offset = 0 + while True: + log_chunk = get_log(project, package, platform, arch, offset) + if len(log_chunk) == 0: + break + offset += len(log_chunk) + print log_chunk.strip() def history(args): diff --git a/osc/core.py b/osc/core.py index b6f9edac..9c46ef46 100755 --- a/osc/core.py +++ b/osc/core.py @@ -1004,10 +1004,10 @@ def get_results(prj, package, platform): return r -def get_log(prj, package, platform, arch): - u = makeurl(['result', prj, platform, package, arch, 'log']) +def get_log(prj, package, platform, arch, offset): + u = makeurl(['result', prj, platform, package, arch, 'log?nostream=1&start=%s' % offset]) f = urllib2.urlopen(u) - return f.readlines() + return f.read() def get_history(prj, package):