From 6012a2fcb30796a2b729f817cb0898b0fd91bb65 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Sun, 11 Jun 2023 11:32:55 +0100 Subject: Remember package group information so we can show it on summary page --- calm/maintainers.py | 18 +++++++++++++----- calm/pkg2html.py | 14 +++++++++++--- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/calm/maintainers.py b/calm/maintainers.py index 9809522..e2c60c7 100644 --- a/calm/maintainers.py +++ b/calm/maintainers.py @@ -48,9 +48,10 @@ from . import utils # supports is_orphaned() and maintainers() methods # class MaintainerPackage(UserString): - def __init__(self, name, maintainers, orphaned): + def __init__(self, name, maintainers, groups, orphaned): super().__init__(name) self._maintainers = maintainers + self._groups = groups self._orphaned = orphaned # XXX: for historical reasons, 'ORPHANED' still appears in the maintainer @@ -61,6 +62,9 @@ class MaintainerPackage(UserString): def maintainers(self): return self._maintainers + def groups(self): + return self._groups + # # @@ -159,6 +163,8 @@ def _read_pkglist(pkglist): def _split_maintainer_names(m, teams=None): # joint maintainers are separated by '/' maintainers = list() + groups = list() + for name in m.split('/'): if not name: continue @@ -176,6 +182,8 @@ def _read_pkglist(pkglist): continue if name.startswith('@'): + groups.append(name[1:]) + if teams and name in teams: for n in teams[name]: if n not in maintainers: @@ -189,7 +197,7 @@ def _read_pkglist(pkglist): if name not in maintainers: maintainers.append(name) - return maintainers + return maintainers, groups if l.startswith('#'): # comment @@ -201,7 +209,7 @@ def _read_pkglist(pkglist): team = match.group(1) rest = match.group(2) - teams[team] = _split_maintainer_names(rest) + teams[team], _ = _split_maintainer_names(rest) continue else: # package @@ -242,9 +250,9 @@ def _read_pkglist(pkglist): else: m = rest - maintainers = _split_maintainer_names(m, teams) + maintainers, groups = _split_maintainer_names(m, teams) - mpkgs[pkg] = MaintainerPackage(pkg, maintainers, orphaned) + mpkgs[pkg] = MaintainerPackage(pkg, maintainers, groups, orphaned) continue # couldn't handle the line diff --git a/calm/pkg2html.py b/calm/pkg2html.py index a4cd59a..43591ff 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -271,10 +271,14 @@ def update_package_listings(args, packages): m_pn = es_po.orig_name if m_pn not in pkg_maintainers: m = None - elif pkg_maintainers[m_pn].is_orphaned(): - m = 'ORPHANED' + pkg_groups = None else: - m = ', '.join(sorted(pkg_maintainers[m_pn].maintainers())) + if pkg_maintainers[m_pn].is_orphaned(): + m = 'ORPHANED' + else: + m = ', '.join(sorted(pkg_maintainers[m_pn].maintainers())) + + pkg_groups = pkg_maintainers[m_pn].groups() if m: print('maintainer(s): %s ' % m, file=f) @@ -284,6 +288,10 @@ def update_package_listings(args, packages): Do not contact the maintainer(s) directly.)'''), file=f) print('

', file=f) + if pkg_groups: + print('group: %s ' % ','.join(pkg_groups), file=f) + print('

', file=f) + if po.kind == package.Kind.source: repo = '/git/cygwin-packages/%s.git' % pn if os.path.exists(repo): -- cgit v1.2.3