Taginfo page shows packages with/without blocked
Fixes: https://pagure.io/koji/issue/1350
This commit is contained in:
parent
fd516dffd8
commit
355c713044
4 changed files with 22 additions and 4 deletions
|
|
@ -3210,8 +3210,15 @@ def anon_handle_list_pkgs(goptions, session, args):
|
|||
if options.show_blocked:
|
||||
parser.error("--show-blocked makes sense only with --tag,"
|
||||
" --owner or --package")
|
||||
if options.show_blocked:
|
||||
opts['with_blocked'] = options.show_blocked
|
||||
|
||||
try:
|
||||
data = session.listPackages(**opts)
|
||||
except koji.ParameterError:
|
||||
del opts['with_blocked']
|
||||
data = session.listPackages(**opts)
|
||||
|
||||
data = session.listPackages(**opts)
|
||||
if not data:
|
||||
error("(no matching packages)")
|
||||
if not options.quiet:
|
||||
|
|
|
|||
|
|
@ -1121,7 +1121,7 @@ def pkglist_setarches(taginfo, pkginfo, arches, force=False):
|
|||
|
||||
|
||||
def readPackageList(tagID=None, userID=None, pkgID=None, event=None, inherit=False,
|
||||
with_dups=False, with_owners=True):
|
||||
with_dups=False, with_owners=True, with_blocked=True):
|
||||
"""Returns the package list for the specified tag or user.
|
||||
|
||||
One of (tagID,userID,pkgID) must be specified
|
||||
|
|
@ -1175,6 +1175,8 @@ def readPackageList(tagID=None, userID=None, pkgID=None, event=None, inherit=Fal
|
|||
'users ON users.id = tag_package_owners.owner'
|
||||
]
|
||||
clauses.append(eventCondition(event, table='tag_package_owners'))
|
||||
if not with_blocked:
|
||||
clauses.append('NOT tag_packages.blocked')
|
||||
fields, aliases = zip(*fields)
|
||||
query = QueryProcessor(columns=fields, aliases=aliases, tables=tables, joins=joins,
|
||||
clauses=clauses, values=locals())
|
||||
|
|
@ -12285,7 +12287,8 @@ class RootExports(object):
|
|||
getPackage = staticmethod(lookup_package)
|
||||
|
||||
def listPackages(self, tagID=None, userID=None, pkgID=None, prefix=None, inherited=False,
|
||||
with_dups=False, event=None, queryOpts=None, with_owners=True):
|
||||
with_dups=False, event=None, queryOpts=None, with_owners=True,
|
||||
with_blocked=False):
|
||||
"""
|
||||
Returns a list of packages in Koji.
|
||||
|
||||
|
|
@ -12330,7 +12333,8 @@ class RootExports(object):
|
|||
pkgID = get_package_id(pkgID, strict=True)
|
||||
result_list = list(readPackageList(tagID=tagID, userID=userID, pkgID=pkgID,
|
||||
inherit=inherited, with_dups=with_dups,
|
||||
event=event, with_owners=with_owners).values())
|
||||
event=event, with_owners=with_owners,
|
||||
with_blocked=with_blocked).values())
|
||||
if with_dups:
|
||||
# when with_dups=True, readPackageList returns a list of list of dicts
|
||||
# convert it to a list of dicts for consistency
|
||||
|
|
|
|||
|
|
@ -984,8 +984,11 @@ def taginfo(environ, tagID, all='0', packageOrder='package_name', packageStart=N
|
|||
all = int(all)
|
||||
|
||||
numPackages = server.count('listPackages', tagID=tag['id'], inherited=True, with_owners=False)
|
||||
numPackagesBlocked = server.count('listPackages', tagID=tag['id'], inherited=True,
|
||||
with_owners=False, with_blocked=True)
|
||||
numBuilds = server.count('listTagged', tag=tag['id'], inherit=True)
|
||||
values['numPackages'] = numPackages
|
||||
values['numPackagesBlocked'] = numPackagesBlocked
|
||||
values['numBuilds'] = numBuilds
|
||||
|
||||
inheritance = server.getFullInheritance(tag['id'])
|
||||
|
|
|
|||
|
|
@ -123,6 +123,10 @@
|
|||
<th>Packages</th>
|
||||
<td><a href="packages?tagID=$tag.id">$numPackages</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Packages (blocked packages included)</th>
|
||||
<td><a href="packages?tagID=$tag.id">$numPackagesBlocked</a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Builds</th>
|
||||
<td><a href="builds?tagID=$tag.id">$numBuilds</a></td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue