[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20180131-5-gdd5b9e8

jturney-9JcytcrH/[email protected]
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


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

commit dd5b9e83d5251aafe6880008b09ef59f9be4b634
Author: Jon Turney <[email protected]>
Date:   Fri Feb 2 18:34:18 2018 +0000

    Also warn about pointless replace-versions: when it's equal to current version

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

commit 1ff7fde354b962c91558cf7834487989997b8c38
Author: Jon Turney <[email protected]>
Date:   Thu Jan 18 20:51:07 2018 +0000

    Update TODO

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

commit e81e90bd84c9e96a9ffd03b84ab5d8c5ff192bb1
Author: Jon Turney <[email protected]>
Date:   Thu Feb 1 19:35:04 2018 +0000

    mksetupini: mutually imply disable-checks for requires: and depends:
    
    Disabling either of 'missing-depended-package' or 'missing-required-package'
    checks, implies both of these checks are disabled (since depends: is
    generated from requires:, and vice versa, if not present)

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

commit d7c649fa5a460ea28b42c50cc0750d8b118088c6
Author: Jon Turney <[email protected]>
Date:   Thu Feb 1 11:31:49 2018 +0000

    Update URL for setup.ini format description
    
    The URL given is just a redirect now.  Details of setup.ini were moved
    elsewhere in 2002.

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

commit 0d69b4204f2c690b2aac84a91d3f8bfcaeaf7e5d
Author: Jon Turney <[email protected]>
Date:   Wed Jan 31 22:49:30 2018 +0000

    Clarify vaulting message
    
    Packages are removed due to expiry settings, so "no longer accessible by
    installer" is no longer true.


Diff:
---
 TODO                                          |    3 +++
 calm/calm.py                                  |    4 ++--
 calm/mksetupini.py                            |   10 ++++++++++
 calm/package.py                               |    9 ++++++---
 calm/version.py                               |   12 +++++-------
 test/testdata/inifile/setup.ini.expected      |    5 ++++-
 test/testdata/process_arch/setup.ini.expected |    5 ++++-
 7 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/TODO b/TODO
index 7bfcbbf..a892159 100644
--- a/TODO
+++ b/TODO
@@ -6,3 +6,6 @@
 * don't do upload authorization by path, then remove unique path constraint
 * mksetupini should be able to verify requires: contains valid package names using a provided list of packages (or a cygwin-pkg-maint file?)
 * make override.hint (optionally?) apply recursively?
+* something to expire old soversions
+* atomically update .ini/.sig (rename of containing directory, if we put release/ was somewhere else?)
+* report changes in override.hint like we used to for setup.hint
diff --git a/calm/calm.py b/calm/calm.py
index a1d6ca0..fa89a0a 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -114,7 +114,7 @@ def process_relarea(args):
             stale_to_vault = remove_stale_packages(args, packages)
             if stale_to_vault:
                 for arch in common_constants.ARCHES + ['noarch', 'src']:
-                    logging.info("vaulting %d old package(s) for arch %s, which are no longer accessible by installer" % (len(stale_to_vault[arch]), arch))
+                    logging.info("vaulting %d old package(s) for arch %s" % (len(stale_to_vault[arch]), arch))
                     uploads.move_to_vault(args, stale_to_vault[arch])
             else:
                 logging.error("error while evaluating stale packages")
@@ -240,7 +240,7 @@ def process_uploads(args, state):
                 if args.stale:
                     for arch in common_constants.ARCHES + ['noarch', 'src']:
                         if stale_to_vault[arch]:
-                            logging.info("vaulting %d old package(s) for arch %s, which are no longer accessible by installer" % (len(stale_to_vault[arch]), arch))
+                            logging.info("vaulting %d old package(s) for arch %s" % (len(stale_to_vault[arch]), arch))
                             uploads.move_to_vault(args, stale_to_vault[arch])
 
                 # for each arch
diff --git a/calm/mksetupini.py b/calm/mksetupini.py
index 10daa4e..d788559 100755
--- a/calm/mksetupini.py
+++ b/calm/mksetupini.py
@@ -157,6 +157,16 @@ def main():
     if args.okmissing:
         args.disable_check.extend(['missing-' + m for m in args.okmissing])
 
+    # disabling either of these checks, implies both of these are disabled
+    # (since depends: is generated from requires:, and vice versa, if not
+    # present)
+    implied = ['missing-depended-package', 'missing-required-package']
+    for p in implied:
+        if p in args.disable_check:
+            for c in implied:
+                if c not in args.disable_check:
+                    args.disable_check.append(c)
+
     return do_main(args)
 
 
diff --git a/calm/package.py b/calm/package.py
index 9d73d1b..8c45dc0 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -653,8 +653,8 @@ def validate_packages(args, packages):
         if 'replace-versions' in packages[p].override_hints:
             if packages[p].best_version:
                 for rv in packages[p].override_hints['replace-versions'].split():
-                    if SetupVersion(rv) < SetupVersion(packages[p].best_version):
-                        logging.warning("package '%s' replace-versions: lists version '%s' which is less than current version" % (p, rv))
+                    if SetupVersion(rv) <= SetupVersion(packages[p].best_version):
+                        logging.warning("package '%s' replace-versions: uselessly lists version '%s', which is <= current version" % (p, rv))
 
         # If the install tarball is empty and there is no source tarball, we
         # should probably be marked obsolete
@@ -826,7 +826,10 @@ def write_setup_ini(args, packages, arch):
         # This file was automatically generated at %s.
         #
         # If you edit it, your edits will be discarded next time the file is
-        # generated.  See http://cygwin.com/setup.html for details.''')
+        # generated.
+        #
+        # See https://sourceware.org/cygwin-apps/setup.ini.html for a description
+        # of the format.''')
               % (time.strftime("%F %T %Z", time.localtime(tz))),
               file=f)
 
diff --git a/calm/version.py b/calm/version.py
index f00ddbb..508260e 100644
--- a/calm/version.py
+++ b/calm/version.py
@@ -21,6 +21,7 @@
 # THE SOFTWARE.
 #
 
+import functools
 import itertools
 import re
 
@@ -37,6 +38,7 @@ def cmp(a, b):
 # a helper class which implements the same version ordering as setup
 #
 
[email protected]_ordering
 class SetupVersion:
     def __init__(self, version_string):
         self._version_string = version_string
@@ -56,17 +58,13 @@ class SetupVersion:
     def __str__(self):
         return '%s (V=%s R=%s)' % (self._version_string, str(self._V), str(self._R))
 
-    # XXX: Implementing the __lt__ comparison operator in terms of the obsolete
-    # __cmp__ operator is rather over-complicated.  If we really only need
-    # __lt__ (which is sufficent to make this class sortable), then we should
-    # just implement it directly.  For the moment, keep __cmp__ around in case
-    # we need to do other comparisons. (in which case, see also functools
-    # @total_ordering class decorator)
     def __lt__(self, other):
         return self.__cmp__(other) == -1
 
-    def __cmp__(self, other):
+    def __eq__(self, other):
+        return self.__cmp__(other) == 0
 
+    def __cmp__(self, other):
         # compare V
         c = SetupVersion._compare(self._V, other._V)
         if c != 0:
diff --git a/test/testdata/inifile/setup.ini.expected b/test/testdata/inifile/setup.ini.expected
index f77bfd9..a852352 100644
--- a/test/testdata/inifile/setup.ini.expected
+++ b/test/testdata/inifile/setup.ini.expected
@@ -1,7 +1,10 @@
 ('# This file was automatically generated at 2016-03-17 13:36:40 GMT\n'
  '#\n'
  '# If you edit it, your edits will be discarded next time the file is\n'
- '# generated.  See http://cygwin.com/setup.html for details.\n'
+ '# generated.\n'
+ '#\n'
+ '# See https://sourceware.org/cygwin-apps/setup.ini.html for a description\n'
+ '# of the format.\n'
  'release: testing\n'
  'arch: x86\n'
  'setup-timestamp: 1458221800\n'
diff --git a/test/testdata/process_arch/setup.ini.expected b/test/testdata/process_arch/setup.ini.expected
index 7158b7d..60023ba 100644
--- a/test/testdata/process_arch/setup.ini.expected
+++ b/test/testdata/process_arch/setup.ini.expected
@@ -1,7 +1,10 @@
 ('# This file was automatically generated at 2016-09-13 21:04:40 BST\n'
  '#\n'
  '# If you edit it, your edits will be discarded next time the file is\n'
- '# generated.  See http://cygwin.com/setup.html for details.\n'
+ '# generated.\n'
+ '#\n'
+ '# See https://sourceware.org/cygwin-apps/setup.ini.html for a description\n'
+ '# of the format.\n'
  'release: trial\n'
  'arch: x86\n'
  'setup-timestamp: 1473797080\n'
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.