From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123458 invoked by alias); 22 Feb 2020 15:07:01 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 123399 invoked by uid 9795); 22 Feb 2020 15:06:59 -0000 Date: Sat, 22 Feb 2020 15:07:00 -0000 Message-ID: <20200222150659.123387.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200220-1-g187fd2a X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 3660a7a0a242af197ba33015392d25e7efa5de00 X-Git-Newrev: 187fd2a99a5e65f2d37ab7b846263258c33a53c2 X-SW-Source: 2020-q1/txt/msg00022.txt https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=187fd2a99a5e65f2d37ab7b846263258c33a53c2 commit 187fd2a99a5e65f2d37ab7b846263258c33a53c2 Author: Jon Turney 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)