rework web build log display

This commit is contained in:
Mike McLean 2017-06-20 15:02:04 -04:00
parent da89f61401
commit 3b0861446b
2 changed files with 34 additions and 41 deletions

View file

@ -132,15 +132,6 @@
#end if
<tr>
<th>$arch</th>
<td>
#if $task
#if $arch == 'noarch'
(<a href="$nvrpath/data/logs/$noarch_log_dest/">build logs</a>)
#else
(<a href="$nvrpath/data/logs/$arch/">build logs</a>)
#end if
#end if
</td>
</tr>
#for $rpm in $rpmsByArch[$arch]
<tr>
@ -172,19 +163,6 @@
#for ext in $exts
<tr>
<th>$ext</th>
<td>
#if $task and $ext == $exts[0]
#if $btype == 'maven'
(<a href="$nvrpath/data/logs/maven/">build logs</a>)
#elif $btype == 'win'
(<a href="$nvrpath/data/logs/win/">build logs</a>)
#elif $btype == 'image'
(<a href="$nvrpath/data/logs/image">build logs</a>)
#else
(<a href="$nvrpath/data/logs">build logs</a>)
#end if
#end if
</td>
</tr>
#for $archive in $archivesByExt[$ext]
<tr>
@ -203,6 +181,29 @@
</td>
</tr>
#end for
#if $logs_by_dir
<tr>
<th>Logs</th>
<td class="container">
<table class="nested">
#set $logdirs = $logs_by_dir.keys()
#for logdir in $logdirs
<tr>
<th>$logdir</th>
</tr>
#for loginfo in $logs_by_dir[$logdir]
<tr>
<td/>
<td>
<a href="$loginfo.dl_url">$loginfo.name</a>
</td>
</tr>
#end for
#end for
</table>
</td>
</tr>
#end if
#if $changelog
<tr>
<th>Changelog</th>

View file

@ -1145,26 +1145,8 @@ def buildinfo(environ, buildID):
values['description'] = koji.fixEncoding(headers.get('description'))
values['changelog'] = server.getChangelogEntries(build['id'])
noarch_log_dest = 'noarch'
if build['task_id']:
task = server.getTaskInfo(build['task_id'], request=True)
if 'noarch' in rpmsByArch and \
[a for a in rpmsByArch.keys() if a not in ('noarch', 'src')]:
# This build has noarch and other-arch packages, indicating either
# noarch in extra-arches (kernel) or noarch subpackages.
# Point the log link to the arch of the buildArch task that the first
# noarch package came from. This will be correct in both the
# extra-arches case (noarch) and the subpackage case (one of the other
# arches). If noarch extra-arches and noarch subpackages are mixed in
# same build, this will become incorrect.
noarch_rpm = rpmsByArch['noarch'][0]
if noarch_rpm['buildroot_id']:
noarch_buildroot = server.getBuildroot(noarch_rpm['buildroot_id'])
if noarch_buildroot:
noarch_task = server.getTaskInfo(noarch_buildroot['task_id'], request=True)
if noarch_task:
noarch_log_dest = noarch_task['request'][2]
# get the summary, description, and changelogs from the built srpm
# if the build is not yet complete
if build['state'] != koji.BUILD_STATES['COMPLETE']:
@ -1189,6 +1171,17 @@ def buildinfo(environ, buildID):
else:
task = None
# get logs
logs = server.getBuildLogs(buildID)
logs_by_dir = {}
for loginfo in logs:
loginfo['dl_url'] = "%s/%s" % (topurl, loginfo['path'])
logdir = loginfo['dir']
if logdir == '.':
logdir = ''
logs_by_dir.setdefault(logdir, []).append(loginfo)
values['logs_by_dir'] = logs_by_dir
values['build'] = build
values['tags'] = tags
values['rpmsByArch'] = rpmsByArch
@ -1196,7 +1189,6 @@ def buildinfo(environ, buildID):
values['typeinfo'] = typeinfo
values['archiveIndex'] = archiveIndex
values['noarch_log_dest'] = noarch_log_dest
if environ['koji.currentUser']:
values['perms'] = server.getUserPerms(environ['koji.currentUser']['id'])
else: