mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-10 06:46:15 +01:00
add osc jobhistory
This commit is contained in:
parent
c6f70d7506
commit
c526f4ee9a
@ -1993,6 +1993,28 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
print '\n'.join(get_buildhistory(apiurl, project, package, platform, arch))
|
||||
|
||||
@cmdln.alias('jobhist')
|
||||
def do_jobhistory(self, subcmd, opts, platform, arch):
|
||||
"""${cmd_name}: Shows the job history of a project
|
||||
|
||||
The arguments PLATFORM and ARCH can be taken from first two columns
|
||||
of the 'osc repos' output.
|
||||
|
||||
${cmd_usage}
|
||||
${cmd_option_list}
|
||||
"""
|
||||
|
||||
wd = os.curdir
|
||||
project = store_read_project(wd)
|
||||
package = None
|
||||
try:
|
||||
package = store_read_package(wd)
|
||||
except:
|
||||
pass
|
||||
apiurl = store_read_apiurl(wd)
|
||||
|
||||
print_jobhistory(apiurl, project, package, platform, arch)
|
||||
|
||||
|
||||
@cmdln.option('-r', '--revision', metavar='rev',
|
||||
help='show log of the specified revision')
|
||||
|
33
osc/core.py
33
osc/core.py
@ -2820,6 +2820,39 @@ def get_buildhistory(apiurl, prj, package, platform, arch):
|
||||
|
||||
return r
|
||||
|
||||
def print_jobhistory(apiurl, prj, current_package, platform, arch):
|
||||
import time
|
||||
u = makeurl(apiurl, ['build', prj, platform, arch, '_jobhistory'])
|
||||
f = http_GET(u)
|
||||
root = ET.parse(f).getroot()
|
||||
|
||||
print "time package reason code build time"
|
||||
for node in root.findall('jobhist'):
|
||||
package = node.get('package')
|
||||
if current_package and package != current_package:
|
||||
continue
|
||||
reason = node.get('reason')
|
||||
if not reason:
|
||||
reason = "unknown"
|
||||
bcnt = node.get('bcnt')
|
||||
code = node.get('code')
|
||||
rev = int(node.get('rev'))
|
||||
srcmd5 = node.get('srcmd5')
|
||||
rt = int(node.get('readytime'))
|
||||
readyt = time.localtime(rt)
|
||||
readyt = time.strftime('%Y-%m-%d %H:%M:%S', readyt)
|
||||
st = int(node.get('starttime'))
|
||||
et = int(node.get('endtime'))
|
||||
endtime = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(et))
|
||||
waitstart = time.strftime('%H:%M:%S', time.gmtime(st-rt))
|
||||
waittm = time.gmtime(et-st)
|
||||
if waittm.tm_hour:
|
||||
waitbuild = "%2dh %2dm %2ds" % (waittm.tm_hour, waittm.tm_min, waittm.tm_sec)
|
||||
else:
|
||||
waitbuild = " %2dm %2ds" % (waittm.tm_min, waittm.tm_sec)
|
||||
|
||||
print '%s %-25s %-16s %-16s %s' % (endtime, package[0:24], reason[0:15], code[0:15], waitbuild)
|
||||
|
||||
|
||||
def get_commitlog(apiurl, prj, package, revision):
|
||||
import time, locale
|
||||
|
Loading…
Reference in New Issue
Block a user