public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: jturney@sourceware.org
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200220-1-g187fd2a
Date: Sat, 22 Feb 2020 15:07:00 -0000	[thread overview]
Message-ID: <20200222150659.123387.qmail@sourceware.org> (raw)




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

commit 187fd2a99a5e65f2d37ab7b846263258c33a53c2
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Feb 21 15:33:17 2020 +0000

    Make keep-count: not retain test: versions
    
    (Note that we will always retain the version assigned to the test:
    stability level (the highest test: version, unless specified in
    override.hint), if any.
    
    For the moment, also retain 2 test versions, so the change in
    behaviour isn't large. This could be tuned down to retaining 1 test
    version in future.
    
    v2:
    Handle keep-count:0 correctly


Diff:
---
 calm/common_constants.py |  1 +
 calm/hint.py             |  1 +
 calm/package.py          | 20 +++++++++++++++++---
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/calm/common_constants.py b/calm/common_constants.py
index 5d884c4..7111dd6 100644
--- a/calm/common_constants.py
+++ b/calm/common_constants.py
@@ -71,6 +71,7 @@ MAILHOST = 'localhost'
 
 # defaults for package freshness
 DEFAULT_KEEP_COUNT = 3
+DEFAULT_KEEP_COUNT_TEST = 2
 DEFAULT_KEEP_DAYS = 0
 
 # different values to be used when we are not running on sourceware.org, but my
diff --git a/calm/hint.py b/calm/hint.py
index c2d702c..ec9bda9 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -66,6 +66,7 @@ hintkeys[override] = {
     'test': 'val',
     'keep': 'val',
     'keep-count': 'val',
+    'keep-count-test': 'val',
     'keep-days': 'val',
     'disable-check': 'val',
     'replace-versions': 'val',
diff --git a/calm/package.py b/calm/package.py
index 26072f2..dca89b2 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -1350,11 +1350,25 @@ def stale_packages(packages):
             else:
                 logging.error("package '%s' has non-existent keep: version '%s'" % (pn, v))
 
-        # mark as fresh the highest n versions, where n is given by the
+        # mark as fresh the highest n non-test versions, where n is given by the
         # keep-count: override hint, (defaulting to DEFAULT_KEEP_COUNT)
         keep_count = int(po.override_hints.get('keep-count', common_constants.DEFAULT_KEEP_COUNT))
-        for v in sorted(po.vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0:keep_count]:
-            mark_package_fresh(packages, pn, v)
+        for v in sorted(po.vermap.keys(), key=lambda v: SetupVersion(v), reverse=True):
+            if 'test' not in po.version_hints[v]:
+                if keep_count <= 0:
+                    break
+                mark_package_fresh(packages, pn, v)
+                keep_count = keep_count - 1
+
+        # 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)
+        keep_count = int(po.override_hints.get('keep-count-test', common_constants.DEFAULT_KEEP_COUNT_TEST))
+        for v in sorted(po.vermap.keys(), key=lambda v: SetupVersion(v), reverse=True):
+            if 'test' in po.version_hints[v]:
+                if keep_count <= 0:
+                    break
+                mark_package_fresh(packages, pn, v)
+                keep_count = keep_count - 1
 
         # mark as fresh all versions after the first one which is newer than
         # the keep-days: override hint, (defaulting to DEFAULT_KEEP_DAYS)


                 reply	other threads:[~2020-02-22 15:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200222150659.123387.qmail@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).