commit:     9ddd1640a0e63f1a029c42614635ccdc072d51a3
Author:     Sebastian Pipping <sebastian <AT> pipping <DOT> org>
AuthorDate: Mon Mar 13 19:31:07 2017 +0000
Commit:     Sebastian Pipping <sping <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 19:37:47 2017 +0000
URL:        https://gitweb.gentoo.org/proj/metagen.git/commit/?id=9ddd1640

Drop support for herds (bug #611190)

 docs/README              | 26 ++++----------------------
 docs/metagen.1           | 24 +++---------------------
 metagen/main.py          | 36 ++----------------------------------
 metagen/meta_unittest.py | 34 +++-------------------------------
 metagen/metagenerator.py |  5 -----
 metagen/test_cli         |  4 ++--
 6 files changed, 14 insertions(+), 115 deletions(-)

diff --git a/docs/README b/docs/README
index 56c56c9..3a40768 100644
--- a/docs/README
+++ b/docs/README
@@ -12,11 +12,6 @@ from Python to create metadata.xml files easily:
     from metagen.metagenerator import MyMetadata
 
     metadata = MyMetadata()
-    metadata.set_herd(["python"])
-    print metadata 
-
-    metadata = MyMetadata()
-    metadata.set_herd(["gnome", "python"])
     metadata.set_maintainer(["<[email protected]>"], 
                             ["Rob Cakebread"], 
                             ["Maintainer description."]
@@ -35,16 +30,6 @@ from Python to create metadata.xml files easily:
 
 Command line tool examples:
 
-metagen -H python
-
- * One herd
-
-    <?xml version="1.0" encoding="UTF-8"?>
-    <!DOCTYPE pkgmetadata SYSTEMhttp://www.gentoo.org/dtd/metadata.dtd";>
-    <pkgmetadata>
-            <herd>python</herd>
-    </pkgmetadata>
-
 metagen -m
 
  * This takes the maintainer info from your ECHANGELOG_USER variable.
@@ -74,14 +59,13 @@ metagen -m -d "I maintain this because I'm crazy."
     </pkgmetadata>
 
 
-metagen -m -H python -l "This package does X, Y, and Z."
+metagen -m -l "This package does X, Y, and Z."
 
- * Maintainer, herd, long description
+ * Maintainer, long description
 
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE pkgmetadata SYSTEMhttp://www.gentoo.org/dtd/metadata.dtd";>
     <pkgmetadata>
-            <herd>python</herd>
             <maintainer>
                     <email>[email protected]</email>
                     <name>Rob Cakebread</name>
@@ -89,15 +73,13 @@ metagen -m -H python -l "This package does X, Y, and Z."
             <longdescription>This package does X, Y, and Z.</longdescription>
     </pkgmetadata>
 
-metagen -m -e "[email protected]","[email protected]" -n "Jane Doe","Tom Smith" 
-H python,gnome -l "This package does X, Y, and Z."
+metagen -m -e "[email protected]","[email protected]" -n "Jane Doe","Tom Smith" 
-l "This package does X, Y, and Z."
 
- * Two herds, 3 maintainers, long description
+ * 3 maintainers, long description
 
     <?xml version="1.0" encoding="UTF-8"?>
     <!DOCTYPE pkgmetadata SYSTEMhttp://www.gentoo.org/dtd/metadata.dtd";>
     <pkgmetadata>
-            <herd>python</herd>
-            <herd>gnome</herd>
             <maintainer>
                     <email>[email protected]</email>
                     <name>Rob Cakebread</name>

diff --git a/docs/metagen.1 b/docs/metagen.1
index 6364ece..bab2e98 100644
--- a/docs/metagen.1
+++ b/docs/metagen.1
@@ -10,18 +10,11 @@
 .B metagen 
 will create a valid metadata.xml file in the current directory.
 
-If you need multiple elements, such as two herds, use a comma to
+If you need multiple elements, such as two email addresses, use a comma to
 separate them. See EXAMPLES.
 
 .SH OPTIONS
 .\" metagen [OPTIONS]
-.B --herd
-|
-.B
--H
-herd
-    Name of herd.
-
 .B --email
 |
 .B
@@ -101,17 +94,6 @@ output-file
     show version and exit
 
 .SH EXAMPLES
-.B metagen -H python
-
-Creates metadata.xml in current directory with python as the herd
-
-
-.B metagen -H python,wxwidgets \
-           -l 'This package does a little of this and some o dat.'
-
-Creates metadata in current directory with two herds and long description
-
-
 .B metagen -e [email protected] \
            -n 'Joe Blow' \
            -d 'The voices in my head told me to maintain this package' \
@@ -120,13 +102,13 @@ Creates metadata in current directory with two herds and 
long description
 maintainer email, maintainer name, description of maintainership, to stdout 
only
 
 
-.B metagen -H net-p2p,python -e [email protected],[email protected] \
+.B metagen -e [email protected],[email protected] \
            -n 'Jo Blo','Flo Blo' \
            -d 'I am maintaining this because foo','I am maintaining this 
because bar' \
            -l 'This package is yadda yadda yadda, spam and eggs' \
            -Q
 
-2 herds, 2 maintainers with names and maintainer descriptions for each 
maintainer,
+2 maintainers with names and maintainer descriptions for each maintainer,
 only write to stdout
 
 

diff --git a/metagen/main.py b/metagen/main.py
index 235fb53..c642b12 100755
--- a/metagen/main.py
+++ b/metagen/main.py
@@ -23,14 +23,6 @@ from portage import config
 from portage.exception import FileNotFound
 from portage.output import red, blue, yellow
 
-try:
-    # portage <2.2.22
-    # https://bugs.gentoo.org/show_bug.cgi?id=561908
-    from repoman import herdbase
-except ImportError:
-    # portage >=2.2.22
-    from repoman.checks.herds import herdbase
-
 from metagen.version import __version__
 from metagen import metagenerator
 
@@ -70,32 +62,11 @@ def parse_echangelog_variable(name, email):
         name = my_name
     return name, email
 
-def check_herds(herds):
-    herds_xml_path = os.path.sep.join([PORTDIR, 'metadata', 'herds.xml'])
-    try:
-        HB = herdbase.make_herd_base(herds_xml_path)
-    except FileNotFound as e:  # bug 577148
-        print yellow('!!! Warning. Herd names could not be checked '
-                'against the list of known herds as '
-                'file "%s" was not found.' % e.value)
-    else:
-        for herd in herds:
-            if not HB.known_herd(herd):
-                print red("!!! Error. Herd %s does not exist." % herd)
-                sys.exit(1)
-
 def generate_xml(options):
     """Returns metadata.xml text"""
 
-    herds=[]
     metadata = metagenerator.MyMetadata()
 
-    if options.herd:
-        herds = options.herd.split(",")
-        check_herds(herds)
-
-    metadata.set_herd(herds)
-
     if options.echangelog:
         (options.name, options.email) = \
             parse_echangelog_variable(options.name, options.email)
@@ -143,9 +114,6 @@ if __name__ == '__main__':
     parser.add_argument('--version', action='version', version='%(prog)s ' + 
__version__)
 
     maintainer = parser.add_argument_group(title='maintainer arguments')
-    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("--email", "-e", action="store",
                          help="Maintainer's email address")
     maintainer.add_argument("--name", "-n", action="store",
@@ -187,8 +155,8 @@ if __name__ == '__main__':
             print red("!!! Options -d and -n are only valid with -e or -m")
             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) " +
+    if not options.email and not options.echangelog:
+        print red("!!! You must specify --echangelog|-m " +
                   "or maintainer's email address (-e)\n")
         sys.exit(1)
 

diff --git a/metagen/meta_unittest.py b/metagen/meta_unittest.py
index 4af902c..73b5072 100644
--- a/metagen/meta_unittest.py
+++ b/metagen/meta_unittest.py
@@ -4,45 +4,17 @@ from metagenerator import MyMetadata
 
 
 def test1():
-    """1 herd specified"""
+    """1 maintainer"""
     metadata = MyMetadata()
-    metadata.set_herd(["python"])
-    return metadata 
- 
-def test2():
-    """No herd specified, 1 maintainer"""
-    metadata = MyMetadata()
-    metadata.set_herd()
     metadata.set_maintainer(["<[email protected]>"], 
                             ["Rob Cakebread"], 
                             ["Maintainer description."],
                             ["person"])
     return metadata 
     
-def test3():
-    """1 herd, 1 maintainer"""
-    metadata = MyMetadata()
-    metadata.set_herd(["python"])
-    metadata.set_maintainer(["<[email protected]>"],
-                            ["Rob Cakebread"],
-                            ["Maintainer description."],
-                            ["person"])
-    return metadata 
-
-def test4():
-    """2 herds, 1 maintainer"""
-    metadata = MyMetadata()
-    metadata.set_herd(["python", "gnome"])
-    metadata.set_maintainer(["[email protected]"],
-                            ["Rob Cakebread"],
-                            ["Maintainer description."],
-                            ["person"])
-    return metadata 
-
-def test5():
-    """2 herds, 2 maintainers, longdesc"""
+def test2():
+    """2 maintainers, longdesc"""
     metadata = MyMetadata()
-    metadata.set_herd(["python", "gnome"])
     metadata.set_maintainer(["[email protected]", "[email protected]"],
                             ["Goo Fi", "Rob Cakebread"],
                             ["Maintainer one.", "Maintainer two"],

diff --git a/metagen/metagenerator.py b/metagen/metagenerator.py
index 9c513fa..b08839b 100755
--- a/metagen/metagenerator.py
+++ b/metagen/metagenerator.py
@@ -17,11 +17,6 @@ class MyMetadata(jaxml.XML_document):
                    '"http://www.gentoo.org/dtd/metadata.dtd";>')
         self.pkgmetadata()
 
-    def set_herd(self, opt_herds=[]):
-        """Set herd(s)"""
-        for my_herd in opt_herds:
-            self.herd(my_herd)
-
     def set_maintainer(self, emails, names, descs, types):
         """Set maintainer(s)'s email, name, desc"""
         if len(types) != len(emails):

diff --git a/metagen/test_cli b/metagen/test_cli
index d8b0f42..959388d 100755
--- a/metagen/test_cli
+++ b/metagen/test_cli
@@ -31,8 +31,8 @@ metagen -e "[email protected]" -d "Maint desc" -Q -t person
 metagen -e "[email protected]" -n "Jon Doe" -d "Maint desc" -Q -t person
 
 #Should fail if ECHANGELOG_USER not set:
-ECHANGELOG_USER='First Last <[email protected]>' metagen -m -H python -e 
"[email protected]" -d "Foo bar.","Chow fun" -Q -t person
-! metagen -m -H python -e "[email protected]" -d "Foo bar.","Chow fun" -Q -t person
+ECHANGELOG_USER='First Last <[email protected]>' metagen -m -e "[email protected]" 
-d "Foo bar.","Chow fun" -Q -t person
+! metagen -m -e "[email protected]" -d "Foo bar.","Chow fun" -Q -t person
 
 #Should fail:
 ! metagen -Q -t person

Reply via email to