[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-51-ge0c3e0a

Jon Turney jturney@sourceware.org
Sat Dec 16 16:33:13 GMT 2023




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=e0c3e0a55b64689124adc70f5b5b2ee0926856b9

commit e0c3e0a55b64689124adc70f5b5b2ee0926856b9
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Dec 14 19:26:40 2023 +0000

    Facilitate more python2 removal

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=c48d8a653378e405bc1083e33b7ea9991b8f6a04

commit c48d8a653378e405bc1083e33b7ea9991b8f6a04
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Dec 12 22:01:29 2023 +0000

    Also sort by package "importance" in unmaintained packages report


Diff:
---
 calm/package.py       | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 calm/past_mistakes.py |  4 +++-
 calm/reports.py       |  9 +++++----
 3 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/calm/package.py b/calm/package.py
index a9aff3d..dd46b57 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -56,6 +56,16 @@ class Kind(Enum):
     source = 2
 
 
+@unique
+class Importance(IntEnum):
+    base = 1     # has base category
+    basedep = 2  # doesn't have base category, but is depended on by something that does
+    other = 3    # all others
+
+    def __str__(self):
+        return self.name
+
+
 # a path inside a package repository (e.g relative to relarea)
 class RepoPath():
     def __init__(self, _arch=None, _path=None, _fn=None):
@@ -1077,9 +1087,48 @@ def validate_packages(args, packages, valid_provides_extra=None, missing_obsolet
     # validate that all packages are in the package maintainers list
     error = validate_package_maintainers(args, packages) or error
 
+    assign_importance(packages)
+
     return not error
 
 
+# assign importance classes to packages
+def assign_importance(packages):
+    # XXX: if we had some package popularity data, we'd use it here
+    for po in packages.values():
+        po.importance = Importance.other
+
+    # recursively give dependencies of base packages the basedep importance
+    def recursive_basedep(p):
+        bv = p.best_version
+        requires = p.version_hints[bv].get('depends', '').split(', ')
+        requires = [re.sub(r'(.*) +\(.*\)', r'\1', r) for r in requires]
+        for r in requires:
+            if r in packages:
+                if packages[r].importance == Importance.other:
+                    packages[r].importance = Importance.basedep
+                    recursive_basedep(packages[r])
+
+    for po in packages.values():
+        bv = po.best_version
+        categories = po.version_hints[bv]['category'].lower().split()
+        if 'base' in categories:
+            recursive_basedep(po)
+
+    # base packages have base importance
+    for po in packages.values():
+        bv = po.best_version
+        categories = po.version_hints[bv]['category'].lower().split()
+        if 'base' in categories:
+            po.importance = Importance.base
+
+    # a source package has the importance of it's most important install package
+    for po in packages.values():
+        if po.kind == Kind.source:
+            for ip in po.is_used_by:
+                po.importance = min(po.importance, packages[ip].importance)
+
+
 #
 def validate_package_maintainers(args, packages):
     error = False
diff --git a/calm/past_mistakes.py b/calm/past_mistakes.py
index 13dfd50..5b7ddb1 100644
--- a/calm/past_mistakes.py
+++ b/calm/past_mistakes.py
@@ -171,8 +171,10 @@ nonexistent_provides = historical_provides + [
     'python2',
     'python2-devel',
     'python27',
-    'python-pygments',
     'python-lxml',
+    'python-mx',
+    'python-pygments',
+    'python-pynotify',
     '_windows',
     r'perl5_\d+',
     r'ruby_\d+',
diff --git a/calm/reports.py b/calm/reports.py
index 6fa570e..d56eb89 100644
--- a/calm/reports.py
+++ b/calm/reports.py
@@ -112,6 +112,7 @@ def unmaintained(args, packages, reportlist):
         up.ts = po.tar(v).mtime
         up.rdepends = len(rdepends)
         up.build_rdepends = len(build_rdepends)
+        up.importance = po.importance
 
         # some packages are mature. If 'v' is still latest upstream version,
         # then maybe we don't need to worry about this package quite as much...
@@ -125,11 +126,11 @@ def unmaintained(args, packages, reportlist):
     print('<p>Packages without a maintainer.</p>', file=body)
 
     print('<table class="grid">', file=body)
-    print('<tr><th>last updated</th><th>package</th><th>version</th><th>upstream version</th><th>rdepends</th><th>build_rdepends</th></tr>', file=body)
+    print('<tr><th>last updated</th><th>package</th><th>version</th><th>upstream version</th><th>rdepends</th><th>build_rdepends</th><th>importance</th></tr>', file=body)
 
-    for up in sorted(um_list, key=lambda i: (i.rdepends + i.build_rdepends, not i.unchanged, i.ts), reverse=True):
-        print('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
-              (pkg2html.tsformat(up.ts), linkify(up.pn, up.po), up.v, up.upstream_v, up.rdepends, up.build_rdepends), file=body)
+    for up in sorted(um_list, key=lambda i: (-i.importance, i.rdepends + i.build_rdepends, not i.unchanged, i.ts), reverse=True):
+        print('<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' %
+              (pkg2html.tsformat(up.ts), linkify(up.pn, up.po), up.v, up.upstream_v, up.rdepends, up.build_rdepends, up.importance), file=body)
 
     print('</table>', file=body)
 



More information about the Cygwin-apps-cvs mailing list