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. 20200129-10-ga86f5ec
Date: Thu, 20 Feb 2020 15:19:00 -0000	[thread overview]
Message-ID: <20200220151919.106295.qmail@sourceware.org> (raw)




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

commit a86f5ecf1f84bf5e7f6a90549d03c3d68c7c535b
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Feb 19 18:58:53 2020 +0000

    Improve test wrapper script to pass arguments

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

commit 31865d5e209689b94844a6208e2df4840ae842f4
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Feb 18 23:29:40 2020 +0000

    Transfer 'perl5_26' annotation from comment to a notes: key
    
    Transfer 'perl5_26' annotation from comment to a notes: key.  This
    ensures it survives other hint transformations.


Diff:
---
 calm/fix-annotate-perl-hint.py | 38 ++++++++++++++++++--------------------
 calm/hint.py                   |  8 ++++++++
 test.sh                        |  2 +-
 3 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/calm/fix-annotate-perl-hint.py b/calm/fix-annotate-perl-hint.py
index 55b27eb..d3cf1cf 100644
--- a/calm/fix-annotate-perl-hint.py
+++ b/calm/fix-annotate-perl-hint.py
@@ -21,17 +21,9 @@
 # THE SOFTWARE.
 #
 
-#
-# Annotate existing hints with requires: perl with a comment noting these
-# require perl5.26 (or possibly earlier), before we deploy perl5.30.  Later
-# these comments can be transformed into an requires: on an additional provides:
-# in perl_base package.
-#
-
 import argparse
 import logging
 import os
-import re
 import shutil
 import sys
 
@@ -46,29 +38,35 @@ from . import hint
 def fix_one_hint(dirpath, hintfile):
     pn = os.path.join(dirpath, hintfile)
 
+    annotation = False
     with open(pn, 'r') as f:
         for l in f:
-            if 'perl5_26' in l:
-                logging.info("%s already annotated" % (hintfile))
-                return
+            if '# perl5_26' in l:
+                logging.info("%s has annotation comment" % (hintfile))
+                annotation = True
+                break
+
+    if not annotation:
+        return
 
     hints = hint.hint_file_parse(pn, hint.pvr)
 
-    requires = hints.get('requires', '').split()
-    if requires:
-        if ('perl_base' in requires) or ('perl' in requires):
-            logging.info("%s has perl in requires" % (hintfile))
+    hints.pop('parse-warnings', None)
+    if 'parse-errors' in hints:
+        logging.error('invalid hints %s' % hintfile)
+        return
+
+    hints['notes'] = 'perl5_26'
 
-            shutil.copy2(pn, pn + '.bak')
-            with open(pn, 'a') as f:
-                print("# perl5_26", file=f)
+    # write updated hints
+    shutil.copy2(pn, pn + '.bak')
+    hint.hint_file_write(pn, hints)
 
 
 def fix_hints(relarea):
     for (dirpath, subdirs, files) in os.walk(relarea):
         for f in files:
-            match = re.match(r'^.*\.hint$', f)
-            if match:
+            if f.endswith('.hint'):
                 fix_one_hint(dirpath, f)
 
 #
diff --git a/calm/hint.py b/calm/hint.py
index 608cc96..c2d702c 100755
--- a/calm/hint.py
+++ b/calm/hint.py
@@ -57,6 +57,7 @@ hintkeys[pvr] = {
     'disable-check': 'val',
     'provides': 'val',
     'conflicts': 'val',
+    'notes': 'val',    # tool notes; not significant to calm itself
 }
 
 hintkeys[override] = {
@@ -328,6 +329,13 @@ def hint_file_parse(fn, kind):
     return hints
 
 
+# write hints |hints| to file |fn|
+def hint_file_write(fn, hints):
+    with open(fn, 'w') as f:
+        for k, v in hints.items():
+            print("%s: %s" % (k, v), file=f)
+
+
 #
 # words that Cygwin package maintainers apparently can't spell correctly
 #
diff --git a/test.sh b/test.sh
index b4f1c39..259b48f 100755
--- a/test.sh
+++ b/test.sh
@@ -1,2 +1,2 @@
 #!/usr/bin/bash
-exec python3 -m unittest discover
+exec python3 -m unittest discover "$@"


                 reply	other threads:[~2020-02-20 15:19 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=20200220151919.106295.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).