public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200220-1-g187fd2a
@ 2020-02-22 15:07 jturney
0 siblings, 0 replies; only message in thread
From: jturney @ 2020-02-22 15:07 UTC (permalink / raw)
To: cygwin-apps-cvs
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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-02-22 15:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-22 15:07 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200220-1-g187fd2a jturney
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).