[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200401-39-ga29bc5f

Jon TURNEY via Cygwin-apps-cvs <[email protected]>
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


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

commit a29bc5f7069b3c6561cb1b93b9cefd09772d3a9a
Author: Jon Turney <[email protected]>
Date:   Sun Jun 7 15:19:34 2020 +0100

    Teach check that requires: are satified to know about provides:

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

commit d7837d076f12ecda50231889b662544f9bbf1f5f
Author: Jon Turney <[email protected]>
Date:   Sun Mar 1 20:18:17 2020 +0000

    Add zstd compression of setup.ini

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

commit 76e2feee7f88dbd7328dbe29929024f29f8171f6
Author: Jon Turney <[email protected]>
Date:   Sat Jun 6 16:26:03 2020 +0100

    Only allow creation of /git/cygwin-packages/<packagename> repos
    
    This avoids accidents when pushing outside of /git/cygwin-packages/
    (which probably means someone in @leads accidentally pushed to something
    under /git/cygwin-apps/ etc. with the username cygwin rather than their
    actual username)
    
    It also avoids leads pushing to a non-existent typoed package name under
    /git/cygwin-packages/


Diff:
---
 calm/calm.py                                             |  4 +++-
 calm/mkgitoliteconf.py                                   |  3 +--
 calm/package.py                                          | 16 ++++++++++++----
 .../x86/release/base-cygwin/base-cygwin-3.8-1.expected   |  2 +-
 test/testdata/htdocs.expected/summary/base-cygwin.html   |  1 +
 test/testdata/inifile/setup.ini.expected                 |  3 +++
 test/testdata/process_arch/setup.ini.expected            |  3 +++
 .../x86/release/base-cygwin/base-cygwin-3.8-1.hint       |  2 +-
 8 files changed, 25 insertions(+), 9 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index 88ebdd7..c2ba507 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -448,7 +448,7 @@ def do_output(args, state):
                     irk.irk("calm updated setup.ini for arch '%s'" % (arch))
 
                     # compress and re-sign
-                    for ext in ['.ini', '.bz2', '.xz']:
+                    for ext in ['.ini', '.bz2', '.xz', '.zstd']:
                         extfile = os.path.join(basedir, 'setup' + ext)
                         try:
                             os.remove(extfile + '.sig')
@@ -459,6 +459,8 @@ def do_output(args, state):
                             utils.system('/usr/bin/bzip2 <%s >%s' % (inifile, extfile))
                         elif ext == '.xz':
                             utils.system('/usr/bin/xz -6e <%s >%s' % (inifile, extfile))
+                        elif ext == '.zstd':
+                            utils.system('/usr/bin/zstd -q --ultra -20 %s -o %s' % (inifile, extfile))
 
                         keys = ' '.join(['-u' + k for k in args.keys])
                         utils.system('/usr/bin/gpg ' + keys + ' --batch --yes -b ' + extfile)
diff --git a/calm/mkgitoliteconf.py b/calm/mkgitoliteconf.py
index 0e12c6e..4082be6 100755
--- a/calm/mkgitoliteconf.py
+++ b/calm/mkgitoliteconf.py
@@ -73,7 +73,6 @@ def do_main(args):
     print('@leads = %s' % ' '.join(map(transform_username, common_constants.ORPHANMAINT.split('/'))))
     print('')
     print('repo @all')
-    print('    C  = @leads')
     print('    RW = @leads')
     print('    RW+ playground$ = @all')
     print('# anyone can create, push, rewind or delete the \'playground\' branch')
@@ -91,7 +90,7 @@ def do_main(args):
         owner = pkgs[p][0]  # first named maintainer
 
         print("repo git/cygwin-packages/%s" % (p))
-        print("C  = %s" % (users))
+        print("C  = %s @leads" % (users))
         print("RW = %s" % (users))
         print("owner = %s" % (owner))
         print("")
diff --git a/calm/package.py b/calm/package.py
index fb60d39..a1fed9a 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -486,6 +486,14 @@ def validate_packages(args, packages):
     if packages is None:
         return False
 
+    # build the set of valid things to requires:
+    valid_requires = set()
+    for p in packages:
+        valid_requires.add(p)
+        for hints in packages[p].version_hints.values():
+            valid_requires.update(hints.get('provides', '').split())
+
+    # perform various package validations
     for p in sorted(packages.keys()):
         logging.log(5, "validating package '%s'" % (p))
         has_requires = False
@@ -517,14 +525,14 @@ def validate_packages(args, packages):
 
                         # all packages listed in a hint must exist (unless the
                         # disable-check option says that's ok)
-                        if r not in packages:
+                        if r not in valid_requires:
                             if okmissing not in getattr(args, 'disable_check', []):
-                                logging.error("package '%s' version '%s' %s nonexistent or errored package '%s'" % (p, v, c, r))
+                                logging.error("package '%s' version '%s' %s: '%s', but nothing satisfies that" % (p, v, c, r))
                                 error = True
                             continue
 
                         # hint referencing a source-only package makes no sense
-                        if packages[r].skip:
+                        if r in packages and packages[r].skip:
                             logging.error("package '%s' version '%s' %s source-only package '%s'" % (p, v, c, r))
                             error = True
 
@@ -532,7 +540,7 @@ def validate_packages(args, packages):
             if 'external-source' in hints:
                 e = hints['external-source']
                 if e not in packages:
-                    logging.error("package '%s' version '%s' refers to nonexistent or errored external-source '%s'" % (p, v, e))
+                    logging.error("package '%s' version '%s' refers to non-existent or errored external-source '%s'" % (p, v, e))
                     error = True
 
         # If package A is obsoleted by package B, B should appear in the
diff --git a/test/testdata/hints/x86/release/base-cygwin/base-cygwin-3.8-1.expected b/test/testdata/hints/x86/release/base-cygwin/base-cygwin-3.8-1.expected
index 7505632..cac431d 100644
--- a/test/testdata/hints/x86/release/base-cygwin/base-cygwin-3.8-1.expected
+++ b/test/testdata/hints/x86/release/base-cygwin/base-cygwin-3.8-1.expected
@@ -1,5 +1,5 @@
 {'sdesc': '"Initial base installation helper script"',
  'ldesc': '"Initial base installation helper script."',
  'category': 'Base',
- 'requires': '',
+ 'requires': 'cygwin-api0_291',
  'parse-warnings': ["sdesc ends with '.'"]}
diff --git a/test/testdata/htdocs.expected/summary/base-cygwin.html b/test/testdata/htdocs.expected/summary/base-cygwin.html
index 9dbd8fa..5d14df3 100644
--- a/test/testdata/htdocs.expected/summary/base-cygwin.html
+++ b/test/testdata/htdocs.expected/summary/base-cygwin.html
@@ -13,6 +13,7 @@
 <span class="detail">summary</span>: Initial base installation helper script<br><br>
 <span class="detail">description</span>: Initial base installation helper script.<br><br>
 <span class="detail">categories</span>: Base<br><br>
+<span class="detail">depends</span>: cygwin-api0_291<br><br>
 <span class="detail">source package</span>: base-cygwin-src<br><br>
 <span class="detail">maintainer(s)</span>: Corinna Vinschen 
 <span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
diff --git a/test/testdata/inifile/setup.ini.expected b/test/testdata/inifile/setup.ini.expected
index 4a350c6..bfb82f7 100644
--- a/test/testdata/inifile/setup.ini.expected
+++ b/test/testdata/inifile/setup.ini.expected
@@ -31,13 +31,16 @@
  'sdesc: "Initial base installation helper script"\n'
  'ldesc: "Initial base installation helper script."\n'
  'category: Base\n'
+ 'requires: cygwin-api0_291\n'
  'version: 3.8-1\n'
  'install: x86/release/base-cygwin/base-cygwin-3.8-1.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ 'depends2: cygwin-api0_291\n'
  '[prev]\n'
  'version: 3.6-1\n'
  'install: x86/release/base-cygwin/base-cygwin-3.6-1.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ 'depends2: \n'
  '\n'
  '@ corrupt\n'
  'sdesc: "A corrupt package"\n'
diff --git a/test/testdata/process_arch/setup.ini.expected b/test/testdata/process_arch/setup.ini.expected
index f3d3534..26378a3 100644
--- a/test/testdata/process_arch/setup.ini.expected
+++ b/test/testdata/process_arch/setup.ini.expected
@@ -31,13 +31,16 @@
  'sdesc: "Initial base installation helper script"\n'
  'ldesc: "Initial base installation helper script."\n'
  'category: Base\n'
+ 'requires: cygwin-api0_291\n'
  'version: 3.8-1\n'
  'install: x86/release/base-cygwin/base-cygwin-3.8-1.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ 'depends2: cygwin-api0_291\n'
  '[prev]\n'
  'version: 3.6-1\n'
  'install: x86/release/base-cygwin/base-cygwin-3.6-1.tar.xz 228 '
  'e675b0ac4bc2c3e1c4971bc56d77b0cd53a9bdf5632873a235d7582e29dfd3e8a7bb04b28f6cdee3e6b3d14c25ed39392538e3f628a9bfda6c905646ebc3c225\n'
+ 'depends2: \n'
  '\n'
  '@ corrupt\n'
  'sdesc: "A corrupt package"\n'
diff --git a/test/testdata/relarea/x86/release/base-cygwin/base-cygwin-3.8-1.hint b/test/testdata/relarea/x86/release/base-cygwin/base-cygwin-3.8-1.hint
index f6f64b2..9586976 100644
--- a/test/testdata/relarea/x86/release/base-cygwin/base-cygwin-3.8-1.hint
+++ b/test/testdata/relarea/x86/release/base-cygwin/base-cygwin-3.8-1.hint
@@ -1,4 +1,4 @@
 sdesc: "Initial base installation helper script."
 ldesc: "Initial base installation helper script."
 category: Base
-requires: 
+requires: cygwin-api0_291
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.