public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/metagen:master commit in: docs/, metagen/
@ 2011-09-25 14:04 Jesus Rivero
  0 siblings, 0 replies; 3+ messages in thread
From: Jesus Rivero @ 2011-09-25 14:04 UTC (permalink / raw
  To: gentoo-commits

commit:     bdaf557f19876472cde430a53259b9e0bfee55fb
Author:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 25 09:42:02 2011 +0000
Commit:     Jesus Rivero <neurogeek <AT> gentoo <DOT> org>
CommitDate: Sun Sep 25 09:42:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/metagen.git;a=commit;h=bdaf557f

Removed support for no-herd and empty herd tags

---
 docs/README              |    5 +----
 docs/metagen.1           |    7 ++++---
 metagen/main.py          |   11 ++---------
 metagen/meta_unittest.py |   12 ++++--------
 metagen/metagenerator.py |    2 +-
 metagen/test_cli         |    4 ++--
 metagen/version.py       |    2 +-
 7 files changed, 15 insertions(+), 28 deletions(-)

diff --git a/docs/README b/docs/README
index 4f6bf0b..56c56c9 100644
--- a/docs/README
+++ b/docs/README
@@ -47,13 +47,11 @@ metagen -H python
 
 metagen -m
 
- * This takes the maintainer info from your ECHANGELOG_USER variable
-   and assigns "no-herd" as the herd.
+ * This takes the maintainer info from your ECHANGELOG_USER variable.
 
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE pkgmetadata SYSTEMhttp://www.gentoo.org/dtd/metadata.dtd">
     <pkgmetadata>
-            <herd>no-herd</herd>
             <maintainer>
                     <email>pythonhead@gentoo.org</email>
                     <name>Rob Cakebread</name>
@@ -68,7 +66,6 @@ metagen -m -d "I maintain this because I'm crazy."
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE pkgmetadata SYSTEMhttp://www.gentoo.org/dtd/metadata.dtd">
     <pkgmetadata>
-            <herd>no-herd</herd>
             <maintainer>
                     <email>pythonhead@gentoo.org</email>
                     <name>Rob Cakebread</name>

diff --git a/docs/metagen.1 b/docs/metagen.1
index 0977087..c80d5db 100644
--- a/docs/metagen.1
+++ b/docs/metagen.1
@@ -1,4 +1,4 @@
-.\" Contact pythonhead@gentoo.org to correct errors or omissions. 
+.\" Contact neurogeek@gentoo.org to correct errors or omissions. 
 .TH man 1 "22 August 2004" "1.0" "metagen man page"
 .SH NAME
 .B metagen
@@ -8,7 +8,7 @@
 [options]
 .SH DESCRIPTION
 .B metagen 
-will create a valid metadata.xml file in the current directory. metadata.xml requires a herd tag (-H). If you only specify a package maintainer's email address (-e) "no-herd" will be inserted in the herd tag automatically.
+will create a valid metadata.xml file in the current directory.
 
 If you need multiple elements, such as two herds, use a comma to
 separate them. See EXAMPLES.
@@ -67,7 +67,7 @@ Creates metadata in current directory with two herds and long description
            -d 'The voices in my head told me to maintain this package' \
            -Q
 
-herd='no-herd', maintainer email, maintainer name, description of maintainership, to stdout only
+maintainer email, maintainer name, description of maintainership, to stdout only
 
 
 .B metagen -H net-p2p,python -e jo@gentoo.org,flo@gentoo.org \
@@ -89,6 +89,7 @@ No known bugs at this time.
 .SH AUTHOR
 .nf
 Rob 'pythonhead' Cakebread (pythonhead@gentoo.org)
+Jesus Rivero (neurogeek@gentoo.org)
 .fi
 .SH HISTORY
 2004 \- Initial revision

diff --git a/metagen/main.py b/metagen/main.py
index 22abbd5..0a996f7 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -62,8 +62,6 @@ def generate_xml(options):
 
     if options.herd:
         herds = options.herd.split(",")
-    else:
-        herds = ["no-herd"]
 
     for herd in herds:
         if not HB.known_herd(herd):
@@ -96,7 +94,7 @@ def validate_xml(my_xml):
     """Test for valid XML"""
     #TODO validate against DTD
     #This just makes sure its valid XML of some sort.
-    #Probably not necessary since repoma validates against DTD?
+    #Probably not necessary since repoman validates against DTD?
     re_escape_quotes = re.compile('"')
     s = re_escape_quotes.sub('\\"', my_xml)
     cmd = "echo \"%s\" | xmllint --valid - 2>&1 > /dev/null" % s
@@ -106,8 +104,7 @@ def validate_xml(my_xml):
 if __name__ == '__main__':
     optParser = OptionParser(version=__version__)
     optParser.add_option("-H", action="store", dest="herd", type="string",
-                         help="Name of herd. If not specified, " +
-                         "'no-herd' will be inserted. " +
+                         help="Name of herd. If not specified, It will be empty. " +
                          "This requires either the -e or -m option.")
 
     optParser.add_option("-e", action="store", dest="email", type="string",
@@ -156,10 +153,6 @@ if __name__ == '__main__':
             print red("!!! Options -d and -n are only valid with -e or -m")
             sys.exit(1)
  
-    if options.herd == "no-herd" and not options.email and not options.echangelog:
-        print red("!!! You must specify a maintainer if you have no-herd.")
-        sys.exit(1)
-
     if not options.herd and not options.email and not options.echangelog:
         print red("!!! You must specify at least a herd (-H) " +
                   "or maintainer's email address (-e)\n")

diff --git a/metagen/meta_unittest.py b/metagen/meta_unittest.py
index 2e6440a..83c311d 100644
--- a/metagen/meta_unittest.py
+++ b/metagen/meta_unittest.py
@@ -15,8 +15,7 @@ def test2():
     metadata.set_herd()
     metadata.set_maintainer(["<pythonhead@gentoo.org>"], 
                             ["Rob Cakebread"], 
-                            ["Maintainer description."]
-                           )
+                            ["Maintainer description."])
     return metadata 
     
 def test3():
@@ -25,8 +24,7 @@ def test3():
     metadata.set_herd(["python"])
     metadata.set_maintainer(["<pythonhead@gentoo.org>"],
                             ["Rob Cakebread"],
-                            ["Maintainer description."]
-                           )
+                            ["Maintainer description."])
     return metadata 
 
 def test4():
@@ -35,8 +33,7 @@ def test4():
     metadata.set_herd(["python", "gnome"])
     metadata.set_maintainer(["pythonhead@gentoo.org"],
                             ["Rob Cakebread"],
-                            ["Maintainer description."]
-                           )
+                            ["Maintainer description."])
     return metadata 
 
 def test5():
@@ -45,8 +42,7 @@ def test5():
     metadata.set_herd(["python", "gnome"])
     metadata.set_maintainer(["goofy@gentoo.org", "pythonhead@gentoo.org"],
                             ["Goo Fi", "Rob Cakebread"],
-                            ["Maintainer one.", "Maintainer two"]
-                           )
+                            ["Maintainer one.", "Maintainer two"])
     metadata.set_longdescription("This packages does X Y and Z.")
     return metadata 
 

diff --git a/metagen/metagenerator.py b/metagen/metagenerator.py
index 99aad2f..8b69ca0 100755
--- a/metagen/metagenerator.py
+++ b/metagen/metagenerator.py
@@ -17,7 +17,7 @@ class MyMetadata(jaxml.XML_document):
                    '"http://www.gentoo.org/dtd/metadata.dtd">')
         self.pkgmetadata()
 
-    def set_herd(self, opt_herds=["no-herd"]):
+    def set_herd(self, opt_herds=[]):
         """Set herd(s)"""
         for my_herd in opt_herds:
             self.herd(my_herd)

diff --git a/metagen/test_cli b/metagen/test_cli
index 8995050..84cf9cf 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -15,8 +15,8 @@ echo 'metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q'
 ./metagen.py -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
 
 #Should fail:
-echo 'metagen -H no-herd -Q'
-./metagen.py -H no-herd -Q
+echo 'metagen -Q'
+./metagen.py -Q
 
 #Should fail:
 echo 'metagen -l "Long desc" -Q'

diff --git a/metagen/version.py b/metagen/version.py
index 743d158..f320129 100644
--- a/metagen/version.py
+++ b/metagen/version.py
@@ -1 +1 @@
-__version__="0.6"
+__version__="0.6.1"



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: docs/, metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     e6495a131210cbbcefe950804dead16788b2bd74
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 20:11:57 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 21:56:02 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=e6495a13

Introduce speaking options

 docs/metagen.1  | 110 ++++++++++++++++++++++++++++++++++++++------------------
 metagen/main.py |  24 ++++++-------
 2 files changed, 88 insertions(+), 46 deletions(-)

diff --git a/docs/metagen.1 b/docs/metagen.1
index c80d5db..db9f76b 100644
--- a/docs/metagen.1
+++ b/docs/metagen.1
@@ -15,40 +15,82 @@ separate them. See EXAMPLES.
 
 .SH OPTIONS
 .\" metagen [OPTIONS]
-  -H  herd
-      Name of herd.
-
-  -e  email-address
-      Package maintainer's email address
-
-  -n  maintainer-name
-      Package maintainer's name (used with -e option)
-
-  -m 
-      Uses ECHANGELOG_USER variable. Can be used instead of -e and -n
-
-  -d  description
-      Description of maintainership (used with -e option)
-
-  -l  long-description
-      Long description of package.
-
-  -o  output-file
-      Write to <output-file> instead of ./metadata.xml
-
-  -f
-      Force overwrite of existing metadata
-
-  -v 
-      Write to stdout as well as disk (default)
-
-  -q
-      Don't write to stdout
-
-  -Q
-      Don't write file to disk 
-
-  -h, --help  show this help message and exit
+.B --herd
+|
+.B
+-H
+herd
+    Name of herd.
+
+.B --email
+|
+.B
+-e
+email-address
+    Package maintainer's email address
+
+.B --name
+|
+.B
+-n
+maintainer-name
+    Package maintainer's name (used with -e option)
+
+.B --echangelog
+|
+.B
+-m
+    Uses ECHANGELOG_USER variable. Can be used instead of -e and -n
+
+.B --desc
+|
+.B
+-d
+description
+    Description of maintainership (used with -e option)
+
+.B --long
+|
+.B
+-l
+long-description
+    Long description of package.
+
+.B --output
+|
+.B
+-o
+output-file
+    Write to <output-file> instead of ./metadata.xml
+
+.B --force
+|
+.B
+-f
+    Force overwrite of existing metadata
+
+.B --verbose
+|
+.B
+-v
+    Write to stdout as well as disk (default)
+
+.B --quiet
+|
+.B
+-q
+    Don't write to stdout
+
+.B -Q
+    Don't write file to disk
+
+.B --help
+|
+.B -h
+    show usage help and exit
+
+.B --version
+    show version and exit
 
 .SH EXAMPLES
 .B metagen -H python

diff --git a/metagen/main.py b/metagen/main.py
index 1648f92..671bd02 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -114,33 +114,33 @@ if __name__ == '__main__':
     parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
 
     maintainer = parser.add_argument_group(title='maintainer arguments')
-    maintainer.add_argument("-H", action="store", dest="herd",
+    maintainer.add_argument("--herd", "-H", action="store",
                          help="Name of herd. If not specified, It will be empty. " +
                          "This requires either the -e or -m option.")
-    maintainer.add_argument("-e", action="store", dest="email",
+    maintainer.add_argument("--email", "-e", action="store",
                          help="Maintainer's email address")
-    maintainer.add_argument("-n", action="store", dest="name",
+    maintainer.add_argument("--name", "-n", action="store",
                          help="Maintainer's name")
-    maintainer.add_argument("-m", action="store_true", dest="echangelog",
+    maintainer.add_argument("--echangelog", "-m", action="store_true",
                          default=False,
                          help="Use name and email address from ECHANGELOG_USER "+
                          "environmental variable. "+
                          "This is a shortcut for -e <email> -n <name>")
-    maintainer.add_argument("-d", action="store", dest="desc",
+    maintainer.add_argument("--desc", "-d", action="store",
                          help="Description of maintainership")
 
-    package = parser.add_argument_group(title='package arguments')
-    package.add_argument("-l", action="store", dest="long",
+    package = parser.add_argument_group(title='package arguments', description=None)
+    package.add_argument("--long", "-l", action="store",
                          help="Long description of package.")
 
-    operation = parser.add_argument_group(title='operation arguments')
-    operation.add_argument("-o", action="store", dest="output",
+    operation = parser.add_argument_group(title='operation arguments', description=None)
+    operation.add_argument("--output", "-o", action="store",
                          help="Specify location of output file.")
-    operation.add_argument("-f", action="store_true", dest="force", default=False,
+    operation.add_argument("--force", "-f", action="store_true", default=False,
                          help="Force overwrite of existing metadata.")
-    operation.add_argument("-v", action="store_true", dest="verbose", default=True,
+    operation.add_argument("--verbose", "-v", action="store_true", default=True,
                          help="Verbose. Output of file to stdout. (default)")
-    operation.add_argument("-q", action="store_false", dest="verbose",
+    operation.add_argument("--quiet", "-q", action="store_false", dest="verbose",
                          help="Squelch output of file to stdout.")
     operation.add_argument("-Q", action="store_true", dest="no_write",
                          default=False,


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/metagen:master commit in: docs/, metagen/
@ 2016-02-21 22:14 Sebastian Pipping
  0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Pipping @ 2016-02-21 22:14 UTC (permalink / raw
  To: gentoo-commits

commit:     4083e1ee5e119dc278cecb499935cf366cfe8c93
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Sun Feb 21 21:02:40 2016 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Sun Feb 21 22:11:35 2016 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=4083e1ee

Add support for GLEP 67 maintainer type (bug #573136)

 docs/metagen.1           |  8 ++++++++
 metagen/main.py          | 28 +++++++++++++++++++++++++++-
 metagen/metagenerator.py | 10 ++++++++--
 metagen/test_cli         | 22 +++++++++++++---------
 4 files changed, 56 insertions(+), 12 deletions(-)

diff --git a/docs/metagen.1 b/docs/metagen.1
index db9f76b..6364ece 100644
--- a/docs/metagen.1
+++ b/docs/metagen.1
@@ -42,6 +42,14 @@ maintainer-name
 -m
     Uses ECHANGELOG_USER variable. Can be used instead of -e and -n
 
+.B --type
+|
+.B
+-t
+type
+    Maintainer type as of GLEP 67; valid types are: "person", "project", "unknown"
+    (required with --email|-e and --echangelog|-m options)
+
 .B --desc
 |
 .B

diff --git a/metagen/main.py b/metagen/main.py
index 671bd02..1e30a20 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -34,6 +34,12 @@ from metagen import metagenerator
 PORTDIR = config(local_config=False)["PORTDIR"]
 HB = herdbase.make_herd_base(os.path.sep.join([PORTDIR, 'metadata', 'herds.xml']))
 
+# GLEP 67
+_MAINTAINER_TYPE_PERSON = 'person'
+_MAINTAINER_TYPE_PROJECT = 'project'
+_MAINTAINER_TYPE_UNKNOWN = 'unknown'
+_VALID_MAINTAINER_TYPES = (_MAINTAINER_TYPE_PERSON, _MAINTAINER_TYPE_PROJECT, _MAINTAINER_TYPE_UNKNOWN)
+
 def parse_echangelog_variable(name, email):
     """Extract developer name and email from ECHANGELOG_USER variable"""
     try:
@@ -88,9 +94,11 @@ def generate_xml(options):
             names = options.name.split(",")
         if options.desc:
             descs = options.desc.split(",")
+        maintainer_types = options.maintainer_type.split(",")
         metadata.set_maintainer(options.email.split(","),
                                 names,
-                                descs
+                                descs,
+                                maintainer_types,
                                 )
 
     if options.long:
@@ -109,6 +117,15 @@ def validate_xml(my_xml):
     return getstatusoutput(cmd)[0]
 
 
+def _check_maintainer_type_list(text):
+    for candidate in text.split(','):
+        if candidate not in _VALID_MAINTAINER_TYPES:
+            raise ValueError('"%s" not a valid maintainer type' % candidate)
+    return text
+
+_check_maintainer_type_list.__name__ = 'maintainer type'
+
+
 if __name__ == '__main__':
     parser = ArgumentParser(prog='metagen')
     parser.add_argument('--version', action='version', version='%(prog)s ' + __version__)
@@ -128,6 +145,9 @@ if __name__ == '__main__':
                          "This is a shortcut for -e <email> -n <name>")
     maintainer.add_argument("--desc", "-d", action="store",
                          help="Description of maintainership")
+    maintainer.add_argument("--type", "-t", dest='maintainer_type', type=_check_maintainer_type_list,
+                         help="Maintainer type as of GLEP 67; valid values are: %s" \
+                             % ', '.join('"%s"' % e for e in _VALID_MAINTAINER_TYPES))
 
     package = parser.add_argument_group(title='package arguments', description=None)
     package.add_argument("--long", "-l", action="store",
@@ -159,6 +179,12 @@ if __name__ == '__main__':
                   "or maintainer's email address (-e)\n")
         sys.exit(1)
 
+    if (options.email or options.echangelog) and not options.maintainer_type:
+        print red("!!! No maintainer type specified. Please pass one of the following, in addition:")
+        for candidate in _VALID_MAINTAINER_TYPES:
+            print red("!!!   --type %s" % candidate)
+        sys.exit(1)
+
     txt = generate_xml(options)
 
     error_status = validate_xml(txt)

diff --git a/metagen/metagenerator.py b/metagen/metagenerator.py
index 8b69ca0..9c513fa 100755
--- a/metagen/metagenerator.py
+++ b/metagen/metagenerator.py
@@ -22,12 +22,18 @@ class MyMetadata(jaxml.XML_document):
         for my_herd in opt_herds:
             self.herd(my_herd)
 
-    def set_maintainer(self, emails, names, descs):
+    def set_maintainer(self, emails, names, descs, types):
         """Set maintainer(s)'s email, name, desc"""
+        if len(types) != len(emails):
+            if len(types) != 1:
+                print red("!!! Nbr maintainer types != nbr emails")
+                sys.exit(1)
+            types = [types[0] for _ in emails]
+
         i = 0
         for e in emails:
             self._push("maintainer_level")
-            self.maintainer().email(e)
+            self.maintainer(type=types[i]).email(e)
             if names:
                 if len(names) > len(emails):
                     print red("!!! Nbr names > nbr emails")

diff --git a/metagen/test_cli b/metagen/test_cli
index 79fa443..d8b0f42 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -18,26 +18,30 @@ set -x
 ########################################
 
 
-#Should fail if ECHANGELOG_USER not set:
-ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -Q
+#Should fail as -t ... is missing
 ! metagen -m -Q
+! metagen -e mail@example.org -Q
+
+#Should fail if ECHANGELOG_USER not set:
+ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -Q -t person
+! metagen -m -Q -t person
 
-metagen -e "someguy@gentoo.org" -d "Maint desc" -Q
+metagen -e "someguy@gentoo.org" -d "Maint desc" -Q -t person
 
-metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q
+metagen -e "someguy@gentoo.org" -n "Jon Doe" -d "Maint desc" -Q -t person
 
 #Should fail if ECHANGELOG_USER not set:
-ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
-! metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q
+ECHANGELOG_USER='First Last <mail@example.org>' metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q -t person
+! metagen -m -H python -e "foo@bar.com" -d "Foo bar.","Chow fun" -Q -t person
 
 #Should fail:
-! metagen -Q
+! metagen -Q -t person
 
 #Should fail:
-! metagen -l "Long desc" -Q
+! metagen -l "Long desc" -Q -t person
 
 #Should fail:
-! metagen -d "Maintainer desc" -Q
+! metagen -d "Maintainer desc" -Q -t person
 
 
 ########################################


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-21 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-21 22:14 [gentoo-commits] proj/metagen:master commit in: docs/, metagen/ Sebastian Pipping
  -- strict thread matches above, loose matches on Subject: below --
2016-02-21 22:14 Sebastian Pipping
2011-09-25 14:04 Jesus Rivero

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox