public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-79-gff4c1b9
@ 2017-05-11 17:33 jturney
  0 siblings, 0 replies; only message in thread
From: jturney @ 2017-05-11 17:33 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit ff4c1b9d1bb650d6b2120fe30fcdb216c9c233bf
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 12 13:05:17 2017 +0100

    Add experimental tool to help write gitolite configuration


Diff:
---
 calm/mkgitoliteconf.py |  104 ++++++++++++++++++++++++++++++++++++++++++++++++
 setup.py               |    1 +
 2 files changed, 105 insertions(+), 0 deletions(-)

diff --git a/calm/mkgitoliteconf.py b/calm/mkgitoliteconf.py
new file mode 100755
index 0000000..e32c69b
--- /dev/null
+++ b/calm/mkgitoliteconf.py
@@ -0,0 +1,104 @@
+#!/usr/bin/env python3
+#
+# Copyright (c) 2017 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.
+#
+
+#
+# mkgitoliteconf - creates a gitolite conf file fragment from cygwin-pkg-maint
+#
+
+from collections import defaultdict
+import argparse
+import logging
+import os
+import sys
+
+from . import common_constants
+from . import maintainers
+
+
+#
+# transform username to charset acceptable to gitolite
+#
+
+
+def transform_username(name):
+    name = name.replace('.', '')
+    name = name.replace(' ', '_')
+    name = name.encode('ascii', 'replace').decode()
+    return name
+
+
+#
+#
+#
+
+def do_main(args):
+    # read maintainer list
+    mlist = {}
+    mlist = maintainers.Maintainer.add_packages(mlist, args.pkglist, getattr(args, 'orphanmaint', None))
+
+    # make the list of all packages
+    all_packages = maintainers.Maintainer.all_packages(mlist)
+
+    # invert to a per-package list of maintainers
+    pkgs = defaultdict(list)
+    # for each maintainer
+    for m in mlist.values():
+        # for each package
+        for p in m.pkgs:
+            # add the maintainer name
+            pkgs[p].append(m.name)
+
+    # header
+    print("# automatically generated by mkgitoliteconf")
+
+    # for each package
+    for p in sorted(pkgs):
+        users = ' '.join(map(transform_username, pkgs[p]))
+        if p.startswith('_'):
+            p = p[1:]
+
+        print("repo cygwin-packages/%s" % (p))
+        print("C  = %s" % (users))
+        print("RW = %s" % (users))
+        print("")
+
+#
+#
+#
+
+
+def main():
+    pkglist_default = common_constants.PKGMAINT
+
+    parser = argparse.ArgumentParser(description='gitolite rules config generator')
+    parser.add_argument('--pkglist', action='store', metavar='FILE', help="package maintainer list (default: " + pkglist_default + ")", default=pkglist_default)
+    (args) = parser.parse_args()
+
+    do_main(args)
+
+#
+#
+#
+
+if __name__ == "__main__":
+    sys.exit(main())
diff --git a/setup.py b/setup.py
index 6472e62..b7b6262 100644
--- a/setup.py
+++ b/setup.py
@@ -13,6 +13,7 @@ setup(
         'console_scripts': [
             'calm = calm.calm:main',
             'mksetupini = calm.mksetupini:main',
+            'calm-mkgitoliteconf = calm.mkgitoliteconf:main',
         ],
     },
     url='https://cygwin.com/git/?p=cygwin-apps/calm.git',


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-05-11 17:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-11 17:33 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-79-gff4c1b9 jturney

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).