enable creation of LiveCD/DVD images in Koji
Signed-off-by: Mike Bonnet <mikeb@redhat.com>
This commit is contained in:
parent
3bc3e2628e
commit
d93d05ab5f
9 changed files with 714 additions and 34 deletions
|
|
@ -12,6 +12,7 @@ Alias /koji "/usr/share/koji-web/scripts/"
|
|||
PythonOption SiteName Koji
|
||||
PythonOption KojiHubURL http://hub.example.com/kojihub
|
||||
PythonOption KojiPackagesURL http://server.example.com/mnt/koji/packages
|
||||
PythonOption KojiImagesURL http://server.example.com/mnt/koji/images
|
||||
PythonOption WebPrincipal koji/web@EXAMPLE.COM
|
||||
PythonOption WebKeytab /etc/httpd.keytab
|
||||
PythonOption WebCCache /var/tmp/kojiweb.ccache
|
||||
|
|
|
|||
|
|
@ -362,9 +362,10 @@ _TASKS = ['build',
|
|||
'createrepo',
|
||||
'buildNotification',
|
||||
'tagNotification',
|
||||
'dependantTask']
|
||||
'dependantTask',
|
||||
'createLiveCD']
|
||||
# Tasks that can exist without a parent
|
||||
_TOPLEVEL_TASKS = ['build', 'buildNotification', 'chainbuild', 'newRepo', 'tagBuild', 'tagNotification', 'waitrepo']
|
||||
_TOPLEVEL_TASKS = ['build', 'buildNotification', 'chainbuild', 'newRepo', 'tagBuild', 'tagNotification', 'waitrepo', 'createLiveCD']
|
||||
# Tasks that can have children
|
||||
_PARENT_TASKS = ['build', 'chainbuild', 'newRepo']
|
||||
|
||||
|
|
@ -509,6 +510,12 @@ def taskinfo(req, taskID):
|
|||
if task['method'] == 'buildArch':
|
||||
buildTag = server.getTag(params[1])
|
||||
values['buildTag'] = buildTag
|
||||
elif task['method'] == 'createLiveCD':
|
||||
# 'arch' is param[0], which is already mentioned later in the page.
|
||||
values['target'] = params[1]
|
||||
values['kickstart'] = os.path.basename(params[2])
|
||||
values['opts'] = params[3]
|
||||
values['image'] = server.getImageInfo(taskID=taskID)
|
||||
elif task['method'] == 'buildSRPMFromSCM':
|
||||
if len(params) > 1:
|
||||
buildTag = server.getTag(params[1])
|
||||
|
|
@ -564,6 +571,24 @@ def taskinfo(req, taskID):
|
|||
|
||||
return _genHTML(req, 'taskinfo.chtml')
|
||||
|
||||
def imageinfo(req, imageID):
|
||||
"""Do some prep work and generate the imageinfo page for kojiweb."""
|
||||
server = _getServer(req)
|
||||
values = _initValues(req, 'Image Information')
|
||||
imageURL = req.get_options().get('KojiImagesURL', 'http://localhost/images')
|
||||
values['image'] = server.getImageInfo(imageID=imageID)
|
||||
urlrelpath = koji.pathinfo.livecdRelPath(values['image']['id'])
|
||||
filelist = []
|
||||
for ofile in os.listdir(values['image']['path']):
|
||||
relpath = os.path.join(urlrelpath, ofile)
|
||||
if relpath.endswith('.iso'):
|
||||
values['imageURL'] = imageURL + '/' + relpath
|
||||
else:
|
||||
filelist.append(imageURL + '/' + relpath)
|
||||
|
||||
values['logs'] = filelist
|
||||
return _genHTML(req, 'imageinfo.chtml')
|
||||
|
||||
def taskstatus(req, taskID):
|
||||
server = _getServer(req)
|
||||
|
||||
|
|
@ -614,8 +639,11 @@ def getfile(req, taskID, name, offset=None, size=None):
|
|||
req.headers_out['Content-Disposition'] = 'attachment; filename=%s' % name
|
||||
elif name.endswith('.log'):
|
||||
req.content_type = 'text/plain'
|
||||
elif name.endswith('.iso'):
|
||||
req.content_type = 'application/octetstream'
|
||||
req.headers_out['Content-Disposition'] = 'attachment; filename=%s' % name
|
||||
|
||||
file_size = file_info['st_size']
|
||||
file_size = int(file_info['st_size'])
|
||||
if offset is None:
|
||||
offset = 0
|
||||
else:
|
||||
|
|
@ -1370,26 +1398,51 @@ def buildrootinfo(req, buildrootID, builtStart=None, builtOrder=None, componentS
|
|||
|
||||
return _genHTML(req, 'buildrootinfo.chtml')
|
||||
|
||||
def rpmlist(req, buildrootID, type, start=None, order='nvr'):
|
||||
def rpmlist(req, type, buildrootID=None, imageID=None, start=None, order='nvr'):
|
||||
"""
|
||||
rpmlist requires a buildrootID OR an imageID to be passed in. From one
|
||||
of these values it will paginate a list of rpms included in the
|
||||
corresponding object. (buildroot or image)
|
||||
"""
|
||||
|
||||
values = _initValues(req, 'RPM List', 'hosts')
|
||||
server = _getServer(req)
|
||||
|
||||
buildrootID = int(buildrootID)
|
||||
buildroot = server.getBuildroot(buildrootID)
|
||||
if buildroot == None:
|
||||
raise koji.GenericError, 'unknown buildroot ID: %i' % buildrootID
|
||||
if buildrootID != None:
|
||||
buildrootID = int(buildrootID)
|
||||
buildroot = server.getBuildroot(buildrootID)
|
||||
values['buildroot'] = buildroot
|
||||
if buildroot == None:
|
||||
raise koji.GenericError, 'unknown buildroot ID: %i' % buildrootID
|
||||
|
||||
rpms = None
|
||||
if type == 'component':
|
||||
rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs', kw={'componentBuildrootID': buildroot['id']},
|
||||
start=start, dataName='rpms', prefix='rpm', order=order)
|
||||
elif type == 'built':
|
||||
rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs', kw={'buildrootID': buildroot['id']},
|
||||
start=start, dataName='rpms', prefix='rpm', order=order)
|
||||
rpms = None
|
||||
if type == 'component':
|
||||
rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs',
|
||||
kw={'componentBuildrootID': buildroot['id']},
|
||||
start=start, dataName='rpms', prefix='rpm', order=order)
|
||||
elif type == 'built':
|
||||
rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs',
|
||||
kw={'buildrootID': buildroot['id']},
|
||||
start=start, dataName='rpms', prefix='rpm', order=order)
|
||||
else:
|
||||
raise koji.GenericError, 'unrecognized type of rpmlist'
|
||||
|
||||
elif imageID != None:
|
||||
|
||||
values['image'] = server.getImageInfo(imageID=imageID)
|
||||
# If/When future image types are supported, add elifs here if needed.
|
||||
if type == 'image':
|
||||
rpms = kojiweb.util.paginateMethod(server, values, 'listRPMs',
|
||||
kw={'imageID': imageID}, \
|
||||
start=start, dataName='rpms', prefix='rpm', order=order)
|
||||
else:
|
||||
raise koji.GenericError, 'unrecognized type of image rpmlist'
|
||||
|
||||
else:
|
||||
# It is an error if neither buildrootID and imageID are defined.
|
||||
raise koji.GenericError, 'Both buildrootID and imageID are None'
|
||||
|
||||
values['buildroot'] = buildroot
|
||||
values['type'] = type
|
||||
|
||||
values['order'] = order
|
||||
|
||||
return _genHTML(req, 'rpmlist.chtml')
|
||||
|
|
|
|||
|
|
@ -2,19 +2,39 @@
|
|||
|
||||
#include "includes/header.chtml"
|
||||
|
||||
#def getID()
|
||||
#if $type == 'image'
|
||||
imageID=$image.id #slurp
|
||||
#else
|
||||
buildrootID=$buildroot.id #slurp
|
||||
#end if
|
||||
#end def
|
||||
|
||||
#def getColspan()
|
||||
#if $type == 'component'
|
||||
"colspan=3"
|
||||
#elif $type == 'image'
|
||||
"colspan=2"
|
||||
#else
|
||||
"colspan=1"
|
||||
#end if
|
||||
#end def
|
||||
|
||||
#if $type == 'component'
|
||||
<h4>Component RPMs of buildroot $buildroot.tag_name-$buildroot.id-$buildroot.repo_id</h4>
|
||||
#elif $type == 'image'
|
||||
<h4>RPMs installed in <a href="imageinfo?imageID=$image.id">$image.filename</a></h4>
|
||||
#else
|
||||
<h4>RPMs built in buildroot $buildroot.tag_name-$buildroot.id-$buildroot.repo_id</h4>
|
||||
#end if
|
||||
|
||||
<table class="data-list">
|
||||
<tr>
|
||||
<td class="paginate" colspan="#if $type == 'component' then '3' else '1'#">
|
||||
<td class="paginate" $getColspan()>
|
||||
#if $len($rpmPages) > 1
|
||||
<form class="pageJump" action="">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'rpmlist?buildrootID=$buildroot.id&start=' + this.value * $rpmRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
<select onchange="javascript: window.location = 'rpmlist?$getID()&start=' + this.value * $rpmRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
#for $pageNum in $rpmPages
|
||||
<option value="$pageNum"#if $pageNum == $rpmCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -22,21 +42,23 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $rpmStart > 0
|
||||
<a href="rpmlist?buildrootID=$buildroot.id&start=#echo $rpmStart - $rpmRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
<a href="rpmlist?$getID()&start=#echo $rpmStart - $rpmRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
#end if
|
||||
#if $totalRpms != 0
|
||||
<strong>RPMs #echo $rpmStart + 1 # through #echo $rpmStart + $rpmCount # of $totalRpms</strong>
|
||||
#end if
|
||||
#if $rpmStart + $rpmCount < $totalRpms
|
||||
<a href="rpmlist?buildrootID=$buildroot.id&start=#echo $rpmStart + $rpmRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
<a href="rpmlist?$getID()&start=#echo $rpmStart + $rpmRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="list-header">
|
||||
<th><a href="rpmlist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'nvr')$util.passthrough($self, 'type')">NVR</a> $util.sortImage($self, 'nvr')</th>
|
||||
<th><a href="rpmlist?$getID()&order=$util.toggleOrder($self, 'nvr')$util.passthrough($self, 'type')">NVR</a> $util.sortImage($self, 'nvr')</th>
|
||||
#if $type == 'component'
|
||||
<th><a href="rpmlist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'external_repo_name')$util.passthrough($self, 'type')">Origin</a> $util.sortImage($self, 'external_repo_name')</th>
|
||||
<th><a href="rpmlist?buildrootID=$buildroot.id&order=$util.toggleOrder($self, 'is_update')$util.passthrough($self, 'type')">Update?</a> $util.sortImage($self, 'is_update')</th>
|
||||
<th><a href="rpmlist?$getID()&order=$util.toggleOrder($self, 'external_repo_name')$util.passthrough($self, 'type')">Origin</a> $util.sortImage($self, 'external_repo_name')</th>
|
||||
<th><a href="rpmlist?$getID()&order=$util.toggleOrder($self, 'is_update')$util.passthrough($self, 'type')">Update?</a> $util.sortImage($self, 'is_update')</th>
|
||||
#elif $type == 'image'
|
||||
<th><a href="rpmlist?$getID()&order=$util.toggleOrder($self, 'external_repo_name')$util.passthrough($self, 'type')">Origin</a> $util.sortImage($self, 'external_repo_name')</th>
|
||||
#end if
|
||||
</tr>
|
||||
#if $len($rpms) > 0
|
||||
|
|
@ -44,13 +66,11 @@
|
|||
<tr class="$util.rowToggle($self)">
|
||||
#set $epoch = ($rpm.epoch != None and $str($rpm.epoch) + ':' or '')
|
||||
<td><a href="rpminfo?rpmID=$rpm.id">$rpm.name-$epoch$rpm.version-$rpm.release.${rpm.arch}.rpm</a></td>
|
||||
#if $type == 'component'
|
||||
#if $rpm.external_repo_id == 0
|
||||
<td>internal</td>
|
||||
#else
|
||||
<td><a href="externalrepoinfo?extrepoID=$rpm.external_repo_id">$rpm.external_repo_name</a></td>
|
||||
#end if
|
||||
#end if
|
||||
#if $type == 'component'
|
||||
#set $update = $rpm.is_update and 'yes' or 'no'
|
||||
<td class="$update">$util.imageTag($update)</td>
|
||||
|
|
@ -67,7 +87,7 @@
|
|||
#if $len($rpmPages) > 1
|
||||
<form class="pageJump" action="">
|
||||
Page:
|
||||
<select onchange="javascript: window.location = 'rpmlist?buildrootID=$buildroot.id&start=' + this.value * $rpmRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
<select onchange="javascript: window.location = 'rpmlist?$getID()&start=' + this.value * $rpmRange + '$util.passthrough($self, 'order', 'type')';">
|
||||
#for $pageNum in $rpmPages
|
||||
<option value="$pageNum"#if $pageNum == $rpmCurrentPage then ' selected="selected"' else ''#>#echo $pageNum + 1#</option>
|
||||
#end for
|
||||
|
|
@ -75,13 +95,13 @@
|
|||
</form>
|
||||
#end if
|
||||
#if $rpmStart > 0
|
||||
<a href="rpmlist?buildrootID=$buildroot.id&start=#echo $rpmStart - $rpmRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
<a href="rpmlist?$getID()&start=#echo $rpmStart - $rpmRange #$util.passthrough($self, 'order', 'type')"><<<</a>
|
||||
#end if
|
||||
#if $totalRpms != 0
|
||||
<strong>RPMs #echo $rpmStart + 1 # through #echo $rpmStart + $rpmCount # of $totalRpms</strong>
|
||||
#end if
|
||||
#if $rpmStart + $rpmCount < $totalRpms
|
||||
<a href="rpmlist?buildrootID=$buildroot.id&start=#echo $rpmStart + $rpmRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
<a href="rpmlist?$getID()&start=#echo $rpmStart + $rpmRange#$util.passthrough($self, 'order', 'type')">>>></a>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -116,6 +116,10 @@
|
|||
<strong>Source:</strong> $params[0]<br/>
|
||||
<strong>Build Target:</strong> <a href="buildtargetinfo?name=$params[1]">$params[1]</a><br/>
|
||||
$printOpts($params[2])
|
||||
#elif $task.method == 'createLiveCD'
|
||||
<strong>Target:</strong> $target<br/>
|
||||
<strong>Kickstart File:</strong> $kickstart<br/>
|
||||
$printOpts($opts)
|
||||
#elif $task.method == 'newRepo'
|
||||
<strong>Tag:</strong> <a href="taginfo?tagID=$tag.id">$tag.name</a><br/>
|
||||
#if $len($params) > 1
|
||||
|
|
@ -236,6 +240,18 @@
|
|||
</td>
|
||||
</tr>
|
||||
#end if
|
||||
#if $task.method == 'createLiveCD'
|
||||
<tr>
|
||||
<th>Image Information</th>
|
||||
<td>
|
||||
#if $image
|
||||
<a href="imageinfo?imageID=$image.id">$image.filename</a><br/>
|
||||
#elif $opts.scratch
|
||||
Scratch image, no information will be saved.<br/>
|
||||
#end if
|
||||
</td>
|
||||
</tr>
|
||||
#end if
|
||||
<tr>
|
||||
<th>Parent</th>
|
||||
<td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue