From f635493c95639e22ded484abb0e3a0ec39c5066c Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Dec 07 2017 19:47:09 +0000 Subject: show archives in archives --- diff --git a/www/kojiweb/archiveinfo.chtml b/www/kojiweb/archiveinfo.chtml index a99628c..55b5bab 100644 --- a/www/kojiweb/archiveinfo.chtml +++ b/www/kojiweb/archiveinfo.chtml @@ -148,9 +148,14 @@ #end if - #if $show_components + #if $show_rpm_components - Components + RPM components + + #end if + #if $show_archive_components + + Archive components #end if diff --git a/www/kojiweb/archivelist.chtml b/www/kojiweb/archivelist.chtml index cb5e0c1..8d11857 100644 --- a/www/kojiweb/archivelist.chtml +++ b/www/kojiweb/archivelist.chtml @@ -1,9 +1,19 @@ #from kojiweb import util #include "includes/header.chtml" +# +#def getID() + #if $type == 'image' +imageID=$image.id #slurp + #else +buildrootID=$buildroot.id #slurp + #end if +#end def #if $type == 'component'

Component Archives of buildroot $util.brLabel($buildroot)

+ #elif $type == 'image' +

Archives installed in $image.filename

#else

Archives built in buildroot $util.brLabel($buildroot)

#end if @@ -14,7 +24,7 @@ #if $len($archivePages) > 1
Page: - #for $pageNum in $archivePages #end for @@ -22,21 +32,21 @@
#end if #if $archiveStart > 0 - <<< + <<< #end if #if $totalArchives != 0 Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives #end if #if $archiveStart + $archiveCount < $totalArchives - >>> + >>> #end if - Filename $util.sortImage($self, 'filename') - Type $util.sortImage($self, 'type_name') + Filename $util.sortImage($self, 'filename') + Type $util.sortImage($self, 'type_name') #if $type == 'component' - Build Dependency? $util.sortImage($self, 'project') + Build Dependency? $util.sortImage($self, 'project') #end if #if $len($archives) > 0 @@ -60,7 +70,7 @@ #if $len($archivePages) > 1
Page: - #for $pageNum in $archivePages #end for @@ -68,13 +78,13 @@
#end if #if $archiveStart > 0 - <<< + <<< #end if #if $totalArchives != 0 Archives #echo $archiveStart + 1 # through #echo $archiveStart + $archiveCount # of $totalArchives #end if #if $archiveStart + $archiveCount < $totalArchives - >>> + >>> #end if diff --git a/www/kojiweb/index.py b/www/kojiweb/index.py index f2c9564..d616ff7 100644 --- a/www/kojiweb/index.py +++ b/www/kojiweb/index.py @@ -1432,8 +1432,8 @@ def archiveinfo(environ, archiveID, fileOrder='name', fileStart=None, buildrootO values['wininfo'] = wininfo values['builtInRoot'] = builtInRoot values['buildroots'] = buildroots - values['show_components'] = archive.get('rootid', False) or \ - server.listRPMs(imageID=archive['id'], queryOpts={'limit':1}) + values['show_rpm_components'] = archive.get('rootid', False) + values['show_archive_components'] = server.listArchives(imageID=archive['id'], queryOpts={'limit':1}) return _genHTML(environ, 'archiveinfo.chtml') @@ -1723,27 +1723,40 @@ def rpmlist(environ, type, buildrootID=None, imageID=None, start=None, order='nv return _genHTML(environ, 'rpmlist.chtml') -def archivelist(environ, buildrootID, type, start=None, order='filename'): +def archivelist(environ, type, buildrootID=None, imageID=None, start=None, order='filename'): values = _initValues(environ, 'Archive List', 'hosts') server = _getServer(environ) - buildrootID = int(buildrootID) - buildroot = server.getBuildroot(buildrootID) - if buildroot == None: - raise koji.GenericError('unknown buildroot ID: %i' % buildrootID) + if buildrootID is not None: + buildrootID = int(buildrootID) + buildroot = server.getBuildroot(buildrootID) + values['buildroot'] = buildroot - if type == 'component': - kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']}, - start=start, dataName='archives', prefix='archive', order=order) - elif type == 'built': - kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']}, + if buildroot == None: + raise koji.GenericError('unknown buildroot ID: %i' % buildrootID) + + if type == 'component': + kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'componentBuildrootID': buildroot['id']}, + start=start, dataName='archives', prefix='archive', order=order) + elif type == 'built': + kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'buildrootID': buildroot['id']}, start=start, dataName='archives', prefix='archive', order=order) + else: + raise koji.GenericError('unrecognized type of archivelist') + elif imageID is not None: + imageID = int(imageID) + values['image'] = server.getArchive(imageID) + # If/When future image types are supported, add elifs here if needed. + if type == 'image': + kojiweb.util.paginateMethod(server, values, 'listArchives', kw={'imageID': imageID}, + start=start, dataName='archives', prefix='archive', order=order) + else: + raise koji.GenericError('unrecognized type of archivelist') else: - raise koji.GenericError('invalid type: %s' % type) + # 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(environ, 'archivelist.chtml')