From 72a36434339e74676904906db287e720a0b75a0d Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Wed, 3 Jan 2024 19:33:24 +0000 Subject: Add rdepends and build_rdepends to package summary Use the HTML
widget to avoid showing large lists by default. --- calm/pkg2html.py | 27 +++++++++++++++++----- .../htdocs.expected/summary/base-cygwin.html | 1 + .../htdocs.expected/summary/cygwin-debuginfo.html | 1 + .../htdocs.expected/summary/cygwin-devel.html | 1 + test/testdata/htdocs.expected/summary/cygwin.html | 1 + .../htdocs.expected/summary/libdns_sd1.html | 1 + test/testdata/htdocs.expected/summary/openssh.html | 1 + test/testdata/htdocs.expected/summary/test-d.html | 1 + test/testdata/htdocs.expected/summary/test-e.html | 1 + 9 files changed, 29 insertions(+), 6 deletions(-) diff --git a/calm/pkg2html.py b/calm/pkg2html.py index 2d6930e..d44b40b 100755 --- a/calm/pkg2html.py +++ b/calm/pkg2html.py @@ -50,6 +50,7 @@ import string import sys import textwrap import time +from typing import NamedTuple import xtarfile @@ -210,12 +211,22 @@ def update_package_listings(args, packages): details_table['description'] = ldesc(po, bv) details_table['categories'] = po.version_hints[bv].get('category', '') + class PackageData(NamedTuple): + is_attr: bool = False + summarize_limit: int = 0 + if po.kind == package.Kind.source: - details = ['build-depends'] + details = {'build-depends': PackageData()} else: - details = ['depends', 'obsoletes', 'obsoleted_by', 'provides', 'conflicts'] - - detail_is_attr = ['obsoleted_by'] + details = { + 'depends': PackageData(), + 'obsoletes': PackageData(), + 'obsoleted_by': PackageData(is_attr=True), + 'provides': PackageData(), + 'conflicts': PackageData(), + 'rdepends': PackageData(is_attr=True, summarize_limit=10), + 'build_rdepends': PackageData(is_attr=True, summarize_limit=10) + } for key in details: # make the union of the package list for this detail @@ -224,7 +235,7 @@ def update_package_listings(args, packages): value = {} values = set() for arch in pos: - if key in detail_is_attr: + if details[key].is_attr: value[arch] = getattr(pos[arch], key, set()) else: t = pos[arch].version_hints[pos[arch].best_version].get(key, None) @@ -243,7 +254,11 @@ def update_package_listings(args, packages): else: detail.append(linkify_package(detail_pkg) + ' (%s)' % (','.join([arch for arch in pos if detail_pkg in value[arch]]))) - details_table[key] = ', '.join(detail) + limit = details[key].summarize_limit + if limit and len(detail) > limit: + details_table[key] = '
(%s)%s
' % (len(detail), ', '.join(detail)) + else: + details_table[key] = ', '.join(detail) if po.kind == package.Kind.source: es = p diff --git a/test/testdata/htdocs.expected/summary/base-cygwin.html b/test/testdata/htdocs.expected/summary/base-cygwin.html index de9b17e..4eceb2f 100644 --- a/test/testdata/htdocs.expected/summary/base-cygwin.html +++ b/test/testdata/htdocs.expected/summary/base-cygwin.html @@ -15,6 +15,7 @@

description:

Initial base installation helper script.

categories:

Base

depends:

cygwin-api0_291

+

rdepends:

cygwin, per-version

source package:

base-cygwin-src

maintainer(s):

Corinna Vinschen (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/cygwin-debuginfo.html b/test/testdata/htdocs.expected/summary/cygwin-debuginfo.html index 3a32e97..9d017df 100644 --- a/test/testdata/htdocs.expected/summary/cygwin-debuginfo.html +++ b/test/testdata/htdocs.expected/summary/cygwin-debuginfo.html @@ -16,6 +16,7 @@ cygwin package with gdb.

categories:

Debug

depends:

cygwin-debuginfo

+

rdepends:

cygwin-debuginfo

source package:

cygwin

maintainer(s):

Corinna Vinschen, Yaakov Selkowitz (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/cygwin-devel.html b/test/testdata/htdocs.expected/summary/cygwin-devel.html index e5ab745..c4e6b59 100644 --- a/test/testdata/htdocs.expected/summary/cygwin-devel.html +++ b/test/testdata/htdocs.expected/summary/cygwin-devel.html @@ -14,6 +14,7 @@

summary:

Core development files

description:

Core development files required to build Cygwin packages

categories:

Devel

+

build_rdepends:

test-e

source package:

cygwin

maintainer(s):

Corinna Vinschen, Yaakov Selkowitz (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/cygwin.html b/test/testdata/htdocs.expected/summary/cygwin.html index ee7dfc5..fd9801b 100644 --- a/test/testdata/htdocs.expected/summary/cygwin.html +++ b/test/testdata/htdocs.expected/summary/cygwin.html @@ -15,6 +15,7 @@

description:

The UNIX emulation engine

categories:

Base

depends:

base-cygwin

+

rdepends:

per-version, per-version-replacement-hint-only

source package:

cygwin

maintainer(s):

Corinna Vinschen, Yaakov Selkowitz (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/libdns_sd1.html b/test/testdata/htdocs.expected/summary/libdns_sd1.html index 782beac..d099261 100644 --- a/test/testdata/htdocs.expected/summary/libdns_sd1.html +++ b/test/testdata/htdocs.expected/summary/libdns_sd1.html @@ -16,6 +16,7 @@ automatic discovery of computers, devices, and services on IP networks using industry standard IP protocols.

categories:

Net

+

rdepends:

libdns_sd-devel, mDNSResponder

source package:

mDNSResponder

maintainer(s):

Yaakov Selkowitz (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/openssh.html b/test/testdata/htdocs.expected/summary/openssh.html index a78ffc3..a97c3ca 100644 --- a/test/testdata/htdocs.expected/summary/openssh.html +++ b/test/testdata/htdocs.expected/summary/openssh.html @@ -16,6 +16,7 @@ executing commands on a remote machine. It can replace rlogin and rsh, providing encrypted communication between two machines.

categories:

Net

+

rdepends:

keychain

source package:

openssh

maintainer(s):

Corinna Vinschen (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/test-d.html b/test/testdata/htdocs.expected/summary/test-d.html index e993c1e..90ccc9e 100644 --- a/test/testdata/htdocs.expected/summary/test-d.html +++ b/test/testdata/htdocs.expected/summary/test-d.html @@ -14,6 +14,7 @@

summary:

test package D

description:

test package D

categories:

Devel

+

rdepends:

test-c

source package:

test-d

maintainer(s):

ORPHANED (Use the mailing list to report bugs or ask questions. diff --git a/test/testdata/htdocs.expected/summary/test-e.html b/test/testdata/htdocs.expected/summary/test-e.html index ab0a890..4d742f8 100644 --- a/test/testdata/htdocs.expected/summary/test-e.html +++ b/test/testdata/htdocs.expected/summary/test-e.html @@ -14,6 +14,7 @@

summary:

test package E

description:

test package E

categories:

Devel

+

rdepends:

test-c

source package:

test-e

maintainer(s):

ORPHANED (Use the mailing list to report bugs or ask questions. -- cgit v1.2.3