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-gf2f2bfc
Date: Fri, 21 Feb 2020 17:35:00 -0000	[thread overview]
Message-ID: <20200221173517.117310.qmail@sourceware.org> (raw)




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

commit f2f2bfcdb66e085223436db333369f320d3d0208
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 momement, 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.


Diff:
---
 calm/common_constants.py                      |  1 +
 calm/hint.py                                  |  1 +
 calm/package.py                               | 20 +++++++++++++++++---
 test/testdata/conflict/rel_area.expected      |  3 +++
 test/testdata/conflict/vault.expected         |  5 +----
 test/testdata/process_arch/htdocs.expected    | 12 ++++++++++--
 test/testdata/process_arch/rel_area.expected  |  3 +++
 test/testdata/process_arch/setup.ini.expected |  6 ++++++
 test/testdata/process_arch/vault.expected     |  5 +----
 9 files changed, 43 insertions(+), 13 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..cdf7100 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]:
+                mark_package_fresh(packages, pn, v)
+                keep_count = keep_count - 1
+                if keep_count <= 0:
+                    break
+
+        # 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]:
+                mark_package_fresh(packages, pn, v)
+                keep_count = keep_count - 1
+                if keep_count <= 0:
+                    break
 
         # mark as fresh all versions after the first one which is newer than
         # the keep-days: override hint, (defaulting to DEFAULT_KEEP_DAYS)
diff --git a/test/testdata/conflict/rel_area.expected b/test/testdata/conflict/rel_area.expected
index baf726d..1068e5c 100644
--- a/test/testdata/conflict/rel_area.expected
+++ b/test/testdata/conflict/rel_area.expected
@@ -121,6 +121,9 @@
                               'staleversion-250-0-src.tar.xz',
                               'staleversion-250-0.hint',
                               'staleversion-250-0.tar.xz',
+                              'staleversion-251-0-src.tar.xz',
+                              'staleversion-251-0.hint',
+                              'staleversion-251-0.tar.xz',
                               'staleversion-260-0-src.tar.xz',
                               'staleversion-260-0.hint',
                               'staleversion-260-0.tar.xz'],
diff --git a/test/testdata/conflict/vault.expected b/test/testdata/conflict/vault.expected
index 6f418e2..e9ba4b0 100644
--- a/test/testdata/conflict/vault.expected
+++ b/test/testdata/conflict/vault.expected
@@ -6,7 +6,4 @@
                               'staleversion-240-1.tar.xz',
                               'staleversion-242-0-src.tar.xz',
                               'staleversion-242-0.hint',
-                              'staleversion-242-0.tar.xz',
-                              'staleversion-251-0-src.tar.xz',
-                              'staleversion-251-0.hint',
-                              'staleversion-251-0.tar.xz']}
+                              'staleversion-242-0.tar.xz']}
diff --git a/test/testdata/process_arch/htdocs.expected b/test/testdata/process_arch/htdocs.expected
index 947fb4c..d1108b0 100644
--- a/test/testdata/process_arch/htdocs.expected
+++ b/test/testdata/process_arch/htdocs.expected
@@ -78,8 +78,16 @@
                                'perl-Net-SMTP-SSL-1.03-2-src'],
  'x86/rpm-doc': ['.htaccess', 'rpm-doc-4.1-2', 'rpm-doc-999-1'],
  'x86/rpm-doc-src': ['.htaccess', 'rpm-doc-4.1-2-src'],
- 'x86/staleversion': ['.htaccess', 'staleversion-243-0', 'staleversion-250-0', 'staleversion-260-0'],
- 'x86/staleversion-src': ['.htaccess', 'staleversion-243-0-src', 'staleversion-250-0-src', 'staleversion-260-0-src'],
+ 'x86/staleversion': ['.htaccess',
+                      'staleversion-243-0',
+                      'staleversion-250-0',
+                      'staleversion-251-0',
+                      'staleversion-260-0'],
+ 'x86/staleversion-src': ['.htaccess',
+                          'staleversion-243-0-src',
+                          'staleversion-250-0-src',
+                          'staleversion-251-0-src',
+                          'staleversion-260-0-src'],
  'x86/test-c': ['.htaccess', 'test-c-1.0-1'],
  'x86/test-c-src': ['.htaccess', 'test-c-1.0-1-src'],
  'x86/test-d': ['.htaccess', 'test-d-1.0-1'],
diff --git a/test/testdata/process_arch/rel_area.expected b/test/testdata/process_arch/rel_area.expected
index d3d925c..56f4139 100644
--- a/test/testdata/process_arch/rel_area.expected
+++ b/test/testdata/process_arch/rel_area.expected
@@ -124,6 +124,9 @@
                               'staleversion-250-0-src.tar.xz',
                               'staleversion-250-0.hint',
                               'staleversion-250-0.tar.xz',
+                              'staleversion-251-0-src.tar.xz',
+                              'staleversion-251-0.hint',
+                              'staleversion-251-0.tar.xz',
                               'staleversion-260-0-src.tar.xz',
                               'staleversion-260-0.hint',
                               'staleversion-260-0.tar.xz'],
diff --git a/test/testdata/process_arch/setup.ini.expected b/test/testdata/process_arch/setup.ini.expected
index 5ec1b8e..65c2421 100644
--- a/test/testdata/process_arch/setup.ini.expected
+++ b/test/testdata/process_arch/setup.ini.expected
@@ -310,6 +310,12 @@
  'source: x86/release/staleversion/staleversion-250-0-src.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
  '[prev]\n'
+ 'version: 251-0\n'
+ 'install: x86/release/staleversion/staleversion-251-0.tar.xz 228 '
+ 'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ 'source: x86/release/staleversion/staleversion-251-0-src.tar.xz 228 '
+ 'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ '[prev]\n'
  'version: 243-0\n'
  'install: x86/release/staleversion/staleversion-243-0.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
diff --git a/test/testdata/process_arch/vault.expected b/test/testdata/process_arch/vault.expected
index e14d68d..d476abb 100644
--- a/test/testdata/process_arch/vault.expected
+++ b/test/testdata/process_arch/vault.expected
@@ -11,8 +11,5 @@
                               'staleversion-240-1.tar.xz',
                               'staleversion-242-0-src.tar.xz',
                               'staleversion-242-0.hint',
-                              'staleversion-242-0.tar.xz',
-                              'staleversion-251-0-src.tar.xz',
-                              'staleversion-251-0.hint',
-                              'staleversion-251-0.tar.xz'],
+                              'staleversion-242-0.tar.xz'],
  'x86/release/testpackage': ['testpackage-0.1-1-src.tar.bz2', 'testpackage-0.1-1.hint', 'testpackage-0.1-1.tar.bz2']}


                 reply	other threads:[~2020-02-21 17:35 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=20200221173517.117310.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).