1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 16:26:13 +01:00

- --state , means "any state"

- fix streaming support in osc buildlog. do not download all of the
  buildlog into memory before printing it (it could be very big), just
  print as the log comes in
This commit is contained in:
Dirk Mueller 2008-08-04 13:21:49 +00:00
parent 65e9011f00
commit 45e944efbf

View File

@ -1942,7 +1942,7 @@ def get_submit_request_list(apiurl, project, package, req_state=('new')):
for root in collection.findall('request'): for root in collection.findall('request'):
r = SubmitReq() r = SubmitReq()
r.read(root) r.read(root)
if r.state.name in req_state: if (r.state.name in req_state) or ('' in req_state):
requests.append(r) requests.append(r)
return requests return requests
@ -2665,18 +2665,12 @@ def get_prj_results(apiurl, prj, hide_legend=False, csv=False, status_filter=Non
return r return r
def get_buildlog(apiurl, prj, package, platform, arch, offset):
u = makeurl(apiurl, ['build', prj, platform, arch, package, '_log?nostream=1&start=%s' % offset])
f = http_GET(u)
return f.read()
def print_buildlog(apiurl, prj, package, platform, arch, offset = 0): def print_buildlog(apiurl, prj, package, platform, arch, offset = 0):
"""prints out the buildlog on stdout""" """prints out the buildlog on stdout"""
try: try:
while True: u = makeurl(apiurl, ['build', prj, platform, arch, package, '_log?start=%s' % offset])
log_chunk = get_buildlog(apiurl, prj, package, platform, arch, offset) f = http_GET(u)
if len(log_chunk) == 0: for log_chunk in f:
break
offset += len(log_chunk) offset += len(log_chunk)
print log_chunk.strip() print log_chunk.strip()
except urllib2.HTTPError, e: except urllib2.HTTPError, e: