public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-100-g8078633
@ 2024-04-23 18:17 Jon Turney
  0 siblings, 0 replies; only message in thread
From: Jon Turney @ 2024-04-23 18:17 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit 8078633ef0e976911e845cceace9bb1826f062d0
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 17 23:08:31 2024 +0100

    Be a bit more aggressive about expiring old soversions
    
    Allow the source package responsible for the old soversion to be
    completely expired if it wouldn't normally be kept, and all of it's
    install packages have no external rdepends.

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

commit f4dd6de8b226852989861754b574bf6e9cf65f84
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 17 14:19:57 2024 +0100

    Drop 'noretain' hint
    
    This was pretty much useless, even more so now we have the 'vault'
    command to do the same thing.
    
    This effectively reverts commit aec1dcf7.


Diff:
---
 calm/hint.py    |  1 -
 calm/package.py | 47 +++++++++++++++++++++++++++++++----------------
 2 files changed, 31 insertions(+), 17 deletions(-)

diff --git a/calm/hint.py b/calm/hint.py
index 41f55f8..680e3f7 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -94,7 +94,6 @@ hintkeys[override] = {
     'keep-superseded-test': 'noval',
     'disable-check': 'val',
     'replace-versions': 'val',
-    'noretain': 'val',
 }
 
 # valid categories
diff --git a/calm/package.py b/calm/package.py
index d03989a..2205376 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1660,7 +1660,7 @@ def mark_fn(packages, po, v, certain_age, vault_requests):
     # shouldn't retain anything.
     #
     if pn.endswith('-debuginfo'):
-        return Freshness.conditional
+        return (Freshness.conditional, False)
 
     # - shared library packages which don't come from the current version of
     # source (i.e. is superseded or removed), have no packages from a
@@ -1674,21 +1674,14 @@ def mark_fn(packages, po, v, certain_age, vault_requests):
             mtime = po.tar(v).mtime
             if mtime < certain_age:
                 logging.debug("deprecated soversion package '%s' version '%s' mtime '%s' is over cut-off age" % (pn, v, time.strftime("%F %T %Z", time.localtime(mtime))))
-                return Freshness.conditional
+                return (Freshness.conditional, True)
 
     # - if package depends on anything in expired_provides
     #
     requires = po.version_hints[v].get('depends', [])
     if any(ep in requires for ep in past_mistakes.expired_provides):
         logging.debug("package '%s' version '%s' not retained as it requires a provide known to be expired" % (pn, v))
-        return Freshness.conditional
-
-    # - explicitly marked as 'noretain'
-    #
-    if 'noretain' in po.override_hints:
-        noretain_versions = po.override_hints.get('noretain', '').split()
-        if (v in noretain_versions) or ('all' in noretain_versions):
-            return Freshness.conditional
+        return (Freshness.conditional, False)
 
     # - marked via 'calm-tool vault'
     #
@@ -1696,10 +1689,10 @@ def mark_fn(packages, po, v, certain_age, vault_requests):
     if es in vault_requests:
         if v in vault_requests[es]:
             logging.info("package '%s' version '%s' not retained due vault request" % (pn, v))
-            return Freshness.conditional
+            return (Freshness.conditional, False)
 
     # otherwise, make no change
-    return Freshness.fresh
+    return (Freshness.fresh, False)
 
 
 #
@@ -1715,9 +1708,6 @@ def stale_packages(packages, vault_requests):
 
     # mark install packages for freshness
     for pn, po in packages.items():
-        if po.kind != Kind.binary:
-            continue
-
         # mark as fresh any versions explicitly listed in the keep: override
         # hint (unconditionally)
         for v in po.override_hints.get('keep', '').split():
@@ -1766,13 +1756,38 @@ def stale_packages(packages, vault_requests):
             if newer:
                 mark_package_fresh(packages, pn, v)
 
+    for pn, po in packages.items():
+        if po.kind != Kind.binary:
+            continue
+
         # overwrite with 'conditional' package retention mark if it meets
         # various criteria
         for v in sorted(po.versions(), key=lambda v: SetupVersion(v)):
-            mark = mark_fn(packages, po, v, certain_age, vault_requests)
+            (mark, others) = mark_fn(packages, po, v, certain_age, vault_requests)
             if mark != Freshness.fresh:
                 mark_package_fresh(packages, pn, v, mark)
 
+            # also look over the other install packages generated by the
+            # source...
+            if others:
+                es = po.version_hints[v].get('external-source', None)
+                if es:
+                    es_po = packages[es]
+                    # ... if the source package version doesn't count as kept ...
+                    #
+                    # (set above using same critera as for install package
+                    # e.g. we have an excess number of packages)
+                    logging.warning("considering other packages from source package '%s' version '%s'" % (es, v))
+                    if getattr(es_po.tar(v), 'fresh', Freshness.stale) != Freshness.fresh:
+                        # ...  additionally mark anything with no other-source
+                        # rdepends
+                        for opn in sorted(es_po.is_used_by):
+                            if v in packages[opn].versions():
+                                if not any(packages[p].srcpackage(v) != es for p in packages[opn].rdepends):
+                                    mark_package_fresh(packages, opn, v, mark)
+                                else:
+                                    logging.warning("package '%s' version '%s' retained due to being used" % (opn, v))
+
     # mark source packages as fresh if any install package which uses it is fresh
     for po in packages.values():
         if po.kind == Kind.source:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-23 18:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-23 18:17 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-100-g8078633 Jon Turney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).