[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20210626-11-g3282d5c

Jon TURNEY via Cygwin-apps-cvs <[email protected]>
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


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

commit 3282d5c98e7bbad81abe17bdf42507f330c35caf
Author: Jon Turney <[email protected]>
Date:   Mon Nov 29 18:43:58 2021 +0000

    Expire superseded test versions
    
    Expire superseded test versions (that is: expire test versions where a
    non-test version with a higher version number exists), unless disabled by
    the 'keep-superseded-test' hint.
    
    (For this to work as expected, don't unconditionally mark the version
    assigned to the test: stability level as not to be expired, so it can be
    expired if superseded).


Diff:
---
 TODO            | 1 -
 calm/hint.py    | 1 +
 calm/package.py | 8 +++++++-
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/TODO b/TODO
index 534080c..c7c6f26 100644
--- a/TODO
+++ b/TODO
@@ -11,4 +11,3 @@
 * report changes in override.hint like we used to for setup.hint
 * maintainers.py should only re-read cygwin-pkg-maint if it's changed
 * empty install packages should only come in two variants: no dependencies and in _obsolete category, or with dependencies and in 'meta' category
-* expire test versions superseded by a non-test version (unless keep-superseded-test: in override.hint?)
diff --git a/calm/hint.py b/calm/hint.py
index dc5efe8..15c468f 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -74,6 +74,7 @@ hintkeys[override] = {
     'keep-count': 'val',
     'keep-count-test': 'val',
     'keep-days': 'val',
+    'keep-superseded-versions': 'noval',
     'disable-check': 'val',
     'replace-versions': 'val',
 }
diff --git a/calm/package.py b/calm/package.py
index 4ec906f..947d06b 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1340,7 +1340,7 @@ def mark_package_fresh(packages, p, v):
 def stale_packages(packages):
     for pn, po in packages.items():
         # mark any versions used by stability levels as fresh
-        for level in ['curr', 'prev', 'test']:
+        for level in ['curr', 'prev']:
             if level in po.stability:
                 v = po.stability[level]
                 mark_package_fresh(packages, pn, v)
@@ -1364,6 +1364,9 @@ def stale_packages(packages):
 
         # mark as fresh the highest n test versions, where n is given by the
         # keep-count-test: override hint, (defaulting to DEFAULT_KEEP_COUNT_TEST)
+        #
+        # only consider versions not superseded by non-test versions (unless
+        # 'keep-superseded-test' is present).
         keep_count = int(po.override_hints.get('keep-count-test', common_constants.DEFAULT_KEEP_COUNT_TEST))
         for v in sorted(po.versions(), key=lambda v: SetupVersion(v), reverse=True):
             if 'test' in po.version_hints[v]:
@@ -1371,6 +1374,9 @@ def stale_packages(packages):
                     break
                 mark_package_fresh(packages, pn, v)
                 keep_count = keep_count - 1
+            else:
+                if 'keep-superseded-test' not in po.override_hints:
+                    break
 
         # mark as fresh all versions after the first one which is newer than
         # the keep-days: override hint, (defaulting to DEFAULT_KEEP_DAYS)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.