From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 106349 invoked by alias); 20 Feb 2020 15:19:19 -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 106307 invoked by uid 9795); 20 Feb 2020 15:19:19 -0000 Date: Thu, 20 Feb 2020 15:19:00 -0000 Message-ID: <20200220151919.106295.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20200129-10-ga86f5ec X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 0c1b671e3e3ca0c5b6b964cc8de3623764fb203a X-Git-Newrev: a86f5ecf1f84bf5e7f6a90549d03c3d68c7c535b X-SW-Source: 2020-q1/txt/msg00018.txt https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=a86f5ecf1f84bf5e7f6a90549d03c3d68c7c535b commit a86f5ecf1f84bf5e7f6a90549d03c3d68c7c535b Author: Jon Turney 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 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 "$@"