[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-85-g13248b3
Jon Turney
jturney@sourceware.org
Sun Apr 7 17:54:39 GMT 2024
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=13248b3a30eee83bc91bd0d27e03593a77859e2b
commit 13248b3a30eee83bc91bd0d27e03593a77859e2b
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sun Apr 7 16:45:39 2024 +0100
Add dependencies etc. to JSON output
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=7edaa9634d420e5cebf52f33656227d58f5cac32
commit 7edaa9634d420e5cebf52f33656227d58f5cac32
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat Apr 6 17:19:48 2024 +0100
Produce a subreport for each solib
Initially I wanted to put this information directly into the solib
report, but some sort of disclosure widget which spans the whole table
width is hard to do in just HTML.
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=62c983ea30540392c63bc7ea40ae383ac2ff5467
commit 62c983ea30540392c63bc7ea40ae383ac2ff5467
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Sat Apr 6 17:17:41 2024 +0100
Make fix-requires-by-linkage quieter
Diff:
---
calm/fix-requires-by-linkage.py | 2 +-
calm/package.py | 19 ++++++---
calm/reports.py | 50 +++++++++++++++++++++--
calm/utils.py | 11 +++++
test/testdata/process_arch/packages.json.expected | 36 +++++++++++++++-
5 files changed, 106 insertions(+), 12 deletions(-)
diff --git a/calm/fix-requires-by-linkage.py b/calm/fix-requires-by-linkage.py
index 7de5f3f..0f1136f 100644
--- a/calm/fix-requires-by-linkage.py
+++ b/calm/fix-requires-by-linkage.py
@@ -73,7 +73,7 @@ def fix_one_hint(args, dirpath, hintfile, tf):
logging.info('Found executable %s' % m.name)
a.extract(m)
- result = subprocess.run(['objdump', '-p', m.name], stdout=subprocess.PIPE, text=True)
+ result = subprocess.run(['objdump', '-p', m.name], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
if ('DLL Name: %s' % args.dll) in result.stdout:
exe = True
diff --git a/calm/package.py b/calm/package.py
index 860bc64..5414053 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1448,15 +1448,22 @@ def write_repo_json(args, packages, f):
'name': po.orig_name,
'versions': versions,
'summary': po.version_hints[bv]['sdesc'].strip('"'),
- 'subpackages': [{'name': sp, 'categories': package(sp).version_hints[package(sp).best_version].get('category', '').split()} for sp in sorted(po.is_used_by)],
'arches': arches,
}
- if 'homepage' in po.version_hints[bv]:
- d['homepage'] = po.version_hints[bv]['homepage']
-
- if 'license' in po.version_hints[bv]:
- d['license'] = po.version_hints[bv]['license']
+ spl = []
+ for sp in sorted(po.is_used_by):
+ hints = package(sp).version_hints[package(sp).best_version]
+ sp = {'name': sp, 'categories': hints.get('category', '').split()}
+ for k in ['depends', 'provides', 'obsoletes']:
+ if hints.get(k, None):
+ sp[k] = [d.strip() for d in hints[k].split(',')]
+ spl.append(sp)
+ d['subpackages'] = spl
+
+ for k in ['homepage', 'license', 'build-depends']:
+ if k in po.version_hints[bv]:
+ d[k] = po.version_hints[bv][k]
build_recipe = _find_build_recipe_file(args, po.orig_name)
if build_recipe:
diff --git a/calm/reports.py b/calm/reports.py
index 54a0d76..eb1078b 100644
--- a/calm/reports.py
+++ b/calm/reports.py
@@ -174,11 +174,49 @@ def deprecated(args, packages, reportlist):
depp.po = po
depp.v = bv
depp.ts = po.tar(bv).mtime
- # number of rdepends which have a different source package
- depp.rdepends = len(list(p for p in po.rdepends if packages[arch][p].srcpackage(packages[arch][p].best_version) != es))
+
+ # filter rdepends
+ depp.rdepends = []
+ for d in po.rdepends:
+ # have a different source package
+ bv = packages[arch][d].best_version
+ if packages[arch][d].srcpackage(bv) == es:
+ continue
+
+ # current version has the dependency of interest
+ dpl = utils.deplist_without_verrel(packages[arch][d].version_hints[bv]['depends'])
+ if p not in dpl:
+ continue
+
+ depp.rdepends.append(d)
dep_list.append(depp)
+ # produce a rebuild report for each solib
+ for depp in dep_list:
+ if len(depp.rdepends) == 0:
+ continue
+
+ body = io.StringIO()
+ print('<p>Packages needing a rebuild for a later version solib than %s.</p>' % depp.pn, file=body)
+
+ print('<table class="grid sortable">', file=body)
+ print('<tr><th>package</th><th>srcpackage</th><th>version</th><th>timestamp</th></tr>', file=body)
+
+ for r in sorted(depp.rdepends):
+ po = packages[arch][r]
+ bv = po.best_version
+ spn = po.srcpackage(bv)
+ spo = packages[arch][spn]
+
+ print('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
+ (linkify(r, po), linkify(spn, spo), bv, pkg2html.tsformat(po.tar(bv).mtime)), file=body)
+
+ print('</table>', file=body)
+
+ write_report(args, 'Package needing rebuilds (%s)' % depp.pn, body, 'so_rebuild_%s.html' % depp.pn, reportlist, not_empty=False)
+
+ # then produce an overall report
body = io.StringIO()
print(textwrap.dedent('''\
<p>Packages for old soversions. (The corresponding source package produces a
@@ -187,9 +225,13 @@ def deprecated(args, packages, reportlist):
print('<table class="grid sortable">', file=body)
print('<tr><th>package</th><th>version</th><th>timestamp</th><th>rdepends</th></tr>', file=body)
- for depp in sorted(dep_list, key=lambda i: (i.rdepends, i.ts), reverse=True):
+ for depp in sorted(dep_list, key=lambda i: (len(i.rdepends), i.ts), reverse=True):
+ len_link = len(depp.rdepends)
+ if len_link:
+ len_link = '<a href="so_rebuild_%s.html">%s</a>' % (depp.pn, len_link)
+
print('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
- (linkify(depp.pn, depp.po), depp.v, pkg2html.tsformat(depp.ts), depp.rdepends), file=body)
+ (linkify(depp.pn, depp.po), depp.v, pkg2html.tsformat(depp.ts), len_link), file=body)
print('</table>', file=body)
diff --git a/calm/utils.py b/calm/utils.py
index 26e3655..f6679fb 100644
--- a/calm/utils.py
+++ b/calm/utils.py
@@ -30,6 +30,7 @@ import email.utils
import filecmp
import logging
import os
+import re
import subprocess
from contextlib import contextmanager
@@ -198,3 +199,13 @@ def sendmail(hdr, msg):
logging.debug('sendmail: msgid %s, exit status %d' % (m['Message-Id'], p.returncode))
return m['Message-Id']
+
+
+#
+# remove version-constrains from a list of dependencies
+#
+def deplist_without_verrel(dl):
+ dpl = dl.split(',')
+ dpl = [dp.strip() for dp in dpl]
+ dpl = [re.sub(r'(.*)\s+\(.*\)', r'\1', dp) for dp in dpl]
+ return dpl
diff --git a/test/testdata/process_arch/packages.json.expected b/test/testdata/process_arch/packages.json.expected
index a915f4d..2c41b14 100644
--- a/test/testdata/process_arch/packages.json.expected
+++ b/test/testdata/process_arch/packages.json.expected
@@ -63,12 +63,18 @@
' "categories": [\n'
' "Base"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "base-cygwin"\n'
+ ' ],\n'
' "name": "cygwin"\n'
' },\n'
' {\n'
' "categories": [\n'
' "Debug"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "cygwin-debuginfo"\n'
+ ' ],\n'
' "name": "cygwin-debuginfo"\n'
' },\n'
' {\n'
@@ -102,6 +108,9 @@
' "categories": [\n'
' "Utils"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "openssh"\n'
+ ' ],\n'
' "name": "keychain"\n'
' }\n'
' ],\n'
@@ -126,6 +135,9 @@
' "categories": [\n'
' "Net"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "libdns_sd1"\n'
+ ' ],\n'
' "name": "libdns_sd-devel"\n'
' },\n'
' {\n'
@@ -138,6 +150,9 @@
' "categories": [\n'
' "Net"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "libdns_sd1"\n'
+ ' ],\n'
' "name": "mDNSResponder"\n'
' }\n'
' ],\n'
@@ -224,6 +239,10 @@
' "categories": [\n'
' "Base"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "base-cygwin",\n'
+ ' "per-version"\n'
+ ' ],\n'
' "name": "per-version-replacement-hint-only"\n'
' }\n'
' ],\n'
@@ -247,6 +266,9 @@
' "categories": [\n'
' "Base"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "base-cygwin"\n'
+ ' ],\n'
' "name": "per-version"\n'
' }\n'
' ],\n'
@@ -347,7 +369,15 @@
' "categories": [\n'
' "Devel"\n'
' ],\n'
- ' "name": "test-c"\n'
+ ' "depends": [\n'
+ ' "test-d (>= 1.0)",\n'
+ ' "test-e"\n'
+ ' ],\n'
+ ' "name": "test-c",\n'
+ ' "obsoletes": [\n'
+ ' "obs-a",\n'
+ ' "obs-b"\n'
+ ' ]\n'
' }\n'
' ],\n'
' "summary": "test package C",\n'
@@ -381,6 +411,7 @@
' "arches": [\n'
' "x86_64"\n'
' ],\n'
+ ' "build-depends": "cygwin-devel",\n'
' "name": "test-e",\n'
' "subpackages": [\n'
' {\n'
@@ -411,6 +442,9 @@
' "categories": [\n'
' "Devel"\n'
' ],\n'
+ ' "depends": [\n'
+ ' "cygwin"\n'
+ ' ],\n'
' "name": "testpackage"\n'
' },\n'
' {\n'
More information about the Cygwin-apps-cvs
mailing list