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-3-g15e6342
Date: Sun, 16 Feb 2020 18:48:00 -0000	[thread overview]
Message-ID: <20200216184808.125170.qmail@sourceware.org> (raw)




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

commit 15e6342e2573c3b1459ed5b196a0c452c4d67b17
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Feb 16 17:23:43 2020 +0000

    Add a tool for annotating existing perl hints


Diff:
---
 calm/fix-annotate-perl-hint.py | 92 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)

diff --git a/calm/fix-annotate-perl-hint.py b/calm/fix-annotate-perl-hint.py
new file mode 100644
index 0000000..55b27eb
--- /dev/null
+++ b/calm/fix-annotate-perl-hint.py
@@ -0,0 +1,92 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2020 Jon Turney
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# 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
+
+from . import common_constants
+from . import hint
+
+#
+#
+#
+
+
+def fix_one_hint(dirpath, hintfile):
+    pn = os.path.join(dirpath, hintfile)
+
+    with open(pn, 'r') as f:
+        for l in f:
+            if 'perl5_26' in l:
+                logging.info("%s already annotated" % (hintfile))
+                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))
+
+            shutil.copy2(pn, pn + '.bak')
+            with open(pn, 'a') as f:
+                print("# perl5_26", file=f)
+
+
+def fix_hints(relarea):
+    for (dirpath, subdirs, files) in os.walk(relarea):
+        for f in files:
+            match = re.match(r'^.*\.hint$', f)
+            if match:
+                fix_one_hint(dirpath, f)
+
+#
+#
+#
+
+
+if __name__ == "__main__":
+    relarea_default = common_constants.FTP
+
+    parser = argparse.ArgumentParser(description='perl requires annotater')
+    parser.add_argument('-v', '--verbose', action='count', dest='verbose', help='verbose output', default=0)
+    parser.add_argument('--releasearea', action='store', metavar='DIR', help="release directory (default: " + relarea_default + ")", default=relarea_default, dest='relarea')
+    (args) = parser.parse_args()
+
+    if args.verbose:
+        logging.getLogger().setLevel(logging.INFO)
+
+    logging.basicConfig(format=os.path.basename(sys.argv[0]) + ': %(message)s')
+
+    fix_hints(args.relarea)


                 reply	other threads:[~2020-02-16 18:48 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=20200216184808.125170.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).