commit:     ac589ba6708f62d41ac6684c5602a45e2c625766
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 16 18:33:57 2022 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Mar 16 19:02:13 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=ac589ba6

Remove remnants of herds support

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 man/epkginfo.1                  |  24 ++++-----
 man/equery.1                    |  10 ++--
 man/imlate.1                    |   3 --
 pym/gentoolkit/equery/meta.py   |  35 --------------
 pym/gentoolkit/imlate/imlate.py |  45 -----------------
 pym/gentoolkit/metadata.py      | 105 ++++++++++------------------------------
 6 files changed, 38 insertions(+), 184 deletions(-)

diff --git a/man/epkginfo.1 b/man/epkginfo.1
index 4000ab4..6c88de9 100644
--- a/man/epkginfo.1
+++ b/man/epkginfo.1
@@ -12,22 +12,16 @@ examples, see \fBman equery\fP.
 
 .SH "EXAMPLES"
 .nf
-  * app\-portage/gentoolkit [portage]
-Location:    /usr/portage/app\-portage/gentoolkit
-Herd:        tools\-portage (tools\[email protected])
-Maintainer:  None specified
+ * app-portage/gentoolkit [gentoo]
+Maintainer:  [email protected] (Gentoo Portage tools team)
 Upstream:    None specified
-Keywords:    0.2.4.5: alpha amd64 arm hppa ia64 m68k ~mips ppc ppc64
-                      s390 sh sparc x86 \-x86\-fbsd
-Keywords:    0.3.0_rc5: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips
-                        ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd
-                        ~x86\-fbsd
-Keywords:    0.3.0_rc6: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips
-                        ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd
-                        ~x86\-fbsd
-Keywords:    0.3.0_rc7: ~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips
-                        ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc\-fbsd
-                        ~x86\-fbsd
+Homepage:    https://wiki.gentoo.org/wiki/Project:Portage-Tools
+Location:    /var/db/repos/gentoo/app-portage/gentoolkit
+Keywords:    0.5.0-r3:0:
+Keywords:    0.5.1-r1:0: amd64 arm arm64 hppa ppc ppc64 sparc x86 ~alpha 
~amd64-linux ~ia64 ~m68k ~mips ~ppc-macos ~riscv ~s390
+                         ~sparc-solaris ~sparc64-solaris ~x64-cygwin 
~x64-macos ~x64-solaris ~x86-linux ~x86-solaris
+Keywords:    9999:0:
+License:     GPL-2
 .fi
 
 .SH "AUTHORS"

diff --git a/man/equery.1 b/man/equery.1
index f7a5deb..9cbe408 100644
--- a/man/equery.1
+++ b/man/equery.1
@@ -465,10 +465,6 @@ 
https://devmanual.gentoo.org/ebuild-writing/misc-files/metadata/index.html
 .br
 Show an extended package description.
 .HP
-.B \-H, \-\-herd
-.br
-Show the herd(s) for the package. When not piping and not passing 
\fB\-\-quiet\fP as a global option, also show the herd's email address. (shown 
by default)
-.HP
 .B \-k, \-\-keywords
 .br
 Show keywords for all matching versions. \fBkeywords\fP does not list all 
keywords for all versions. Instead, it filters the list to make it easier to 
spot versions that need bumping or are okay to remove from the tree. It filters 
by slot. For example:
@@ -501,7 +497,7 @@ Dump the plain XML file to the screen.
 equery meta gnucash
 .EE
 .br
-Show general information about maintainership, including herd, maintainer and 
upstream.
+Show general information about maintainership, including maintainer and 
upstream.
 .EX
 .HP
 equery meta \-\-description app\-misc/screen
@@ -510,10 +506,10 @@ equery meta \-\-description app\-misc/screen
 See if the package maintainer has provided an extended description.
 .EX
 .HP
-equery \-N meta \-H gnome |grep \-o \-\-color=never '[^( ]*@gentoo.org'
+equery \-N meta \-H gnome-base/gnome |grep \-o \-\-color=never '[^( 
]*@gentoo.org'
 .EE
 .br
-Extract the herd's email address to let them know they're doing a great job. 
Remember, bug reports should go to bugs.gentoo.org. The above example will 
extract one or more emails if available, or return nothing if the herd is 
\fBno\-herd\fP.
+Extract the maintainers's email address to let them know they're doing a great 
job. Remember, bug reports should go to bugs.gentoo.org. The above example will 
extract one or more emails if available.
 
 .SS
 .BI "size (s) [OPTIONS] " "PKG"

diff --git a/man/imlate.1 b/man/imlate.1
index 7d8cbe8..8e2430b 100644
--- a/man/imlate.1
+++ b/man/imlate.1
@@ -36,9 +36,6 @@ just show keyword candidates (e.g. \-s and \-k is the default 
result) [default:
 .B \-M MAINTAINER, \-\-maintainer=MAINTAINER
 Show only packages from the specified maintainer
 .TP
-.B \-H HERD, \-\-herd=HERD
-Show only packages from the specified herd
-.TP
 .B \-C CATEGORIES, \-\-category=CATEGORIES, \-\-categories=CATEGORIES
 just check in the specified category/categories (comma separated) [default: 
none]
 .SH "AUTHORS"

diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py
index 7747893..4cf4bc6 100644
--- a/pym/gentoolkit/equery/meta.py
+++ b/pym/gentoolkit/equery/meta.py
@@ -30,7 +30,6 @@ from gentoolkit.query import Query
 QUERY_OPTS = {
     "current": False,
     "description": False,
-    "herd": False,
     "keywords": False,
     "license": False,
     "maintainer": False,
@@ -79,7 +78,6 @@ def print_help(with_description=True, with_usage=True):
             (
                 (" -h, --help", "display this help message"),
                 (" -d, --description", "show an extended package description"),
-                (" -H, --herd", "show the herd(s) for the package"),
                 (" -k, --keywords", "show keywords for all matching package 
versions"),
                 (" -l, --license", "show licenses for the best maching 
version"),
                 (" -m, --maintainer", "show the maintainer(s) for the 
package"),
@@ -159,21 +157,6 @@ def filter_keywords(matches):
     return result
 
 
-def format_herds(herds):
-    """Format herd information for display."""
-
-    result = []
-    for herd in herds:
-        herdstr = ""
-        email = "(%s)" % herd[1] if herd[1] else ""
-        herdstr = herd[0]
-        if CONFIG["verbose"]:
-            herdstr += " %s" % (email,)
-        result.append(herdstr)
-
-    return result
-
-
 def format_maintainers(maints):
     """Format maintainer information for display."""
 
@@ -305,21 +288,6 @@ def call_format_functions(best_match, matches):
         # Specific information requested, less formatting
         got_opts = True
 
-    if QUERY_OPTS["herd"] or not got_opts:
-        herds = best_match.metadata.herds(include_email=True)
-        if any(not h[0] for h in herds):
-            print(
-                pp.warn("The packages metadata.xml has an empty <herd> tag"),
-                file=sys.stderr,
-            )
-            herds = [x for x in herds if x[0]]
-        herds = format_herds(herds)
-        if QUERY_OPTS["herd"]:
-            print_sequence(format_list(herds))
-        else:
-            for herd in herds:
-                pp.uprint(format_line(herd, "Herd:        ", " " * 13))
-
     if QUERY_OPTS["maintainer"] or not got_opts:
         maints = format_maintainers(best_match.metadata.maintainers())
         if QUERY_OPTS["maintainer"]:
@@ -503,8 +471,6 @@ def parse_module_options(module_opts):
             sys.exit(0)
         elif opt in ("-d", "--description"):
             QUERY_OPTS["description"] = True
-        elif opt in ("-H", "--herd"):
-            QUERY_OPTS["herd"] = True
         elif opt in ("-l", "--license"):
             QUERY_OPTS["license"] = True
         elif opt in ("-m", "--maintainer"):
@@ -528,7 +494,6 @@ def main(input_args):
     long_opts = (
         "help",
         "description",
-        "herd",
         "keywords",
         "license",
         "maintainer",

diff --git a/pym/gentoolkit/imlate/imlate.py b/pym/gentoolkit/imlate/imlate.py
index b553849..d8c9fe0 100755
--- a/pym/gentoolkit/imlate/imlate.py
+++ b/pym/gentoolkit/imlate/imlate.py
@@ -161,12 +161,6 @@ def _get_metadata(metadata, element, tag):
         for _element in elements:
             node = _element.getElementsByTagName(tag)
 
-            if tag == "herd" and (not node or not node[0].childNodes):
-                #                              print >> stderr, "'%s' is 
missing a <herd> tag or it is empty," % metadata
-                #                              print >> stderr, "please file a 
bug at https://bugs.gentoo.org and refer to 
http://www.gentoo.org/proj/en/devrel/handbook/handbook.xml?part=2&chap=4";
-                values.append("no-herd")
-                continue
-
             try:
                 values.append(node[0].childNodes[0].data)
             except IndexError:
@@ -202,30 +196,6 @@ def is_maintainer(maintainer, metadata):
     return False
 
 
-def is_herd(herd, metadata):
-    data = []
-
-    if herd == None:
-        return True
-
-    hrd = herd.split(",")
-    data = _get_metadata(metadata, "pkgmetadata", "herd")
-
-    if not data and len(herd) == 0:
-        return True
-    elif not data and len(herd) > 0:
-        return False
-    else:
-        for hd in data:
-            for hd2 in hrd:
-                if hd == hd2:
-                    return True
-                if hd.startswith(hd2):
-                    return True
-
-    return False
-
-
 # fetch a list of arch (just stable) packages
 # -* is important to be sure that just arch is used
 def get_packages(conf):
@@ -249,9 +219,6 @@ def get_packages(conf):
                 conf["MAINTAINER"], join(conf["PORTDIR"], cp, "metadata.xml")
             ):
                 continue
-        if conf["HERD"] != None:
-            if not is_herd(conf["HERD"], join(conf["PORTDIR"], cp, 
"metadata.xml")):
-                continue
 
         cpvrs = conf["portdb"].dbapi.match(cp)
 
@@ -510,17 +477,6 @@ def main():
         default=None,
     )
 
-    parser.add_option(
-        "-H",
-        "--herd",
-        dest="herd",
-        action="store",
-        type="string",
-        help="Show only packages from the specified herd",
-        metavar="HERD",
-        default=None,
-    )
-
     parser.add_option(
         "-C",
         "--category",
@@ -576,7 +532,6 @@ def main():
     conf["CATEGORIES"] = options.categories
 
     conf["MAINTAINER"] = options.maintainer
-    conf["HERD"] = options.herd
 
     # append to our existing
     conf = get_settings(conf)

diff --git a/pym/gentoolkit/metadata.py b/pym/gentoolkit/metadata.py
index 2678611..479456a 100644
--- a/pym/gentoolkit/metadata.py
+++ b/pym/gentoolkit/metadata.py
@@ -4,31 +4,32 @@
 
 """Provides an easy-to-use python interface to Gentoo's metadata.xml file.
 
-       Example usage:
-               >>> from gentoolkit.metadata import MetaData
-               >>> pkg_md = 
MetaData('/usr/portage/app-misc/gourmet/metadata.xml')
-               >>> pkg_md
-               <MetaData '/usr/portage/app-misc/gourmet/metadata.xml'>
-               >>> pkg_md.herds()
-               []
-               >>> for maint in pkg_md.maintainers():
-               ...     print('{0} ({1})'.format(maint.email, maint.name))
-               ...
-               [email protected] (Joe Sapp)
-               >>> for flag in pkg_md.use():
-               ...     print(flag.name, '->', flag.description)
-               ...
-               rtf -> Enable export to RTF
-               gnome-print -> Enable pretty Python printing with gnome-print
-               >>> upstream = pkg_md.upstream()
-               >>> upstream  # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
-               [<_Upstream {'node': <Element 'upstream' at 0x...>,
-                 'remoteids': [], 'docs': [],
-                 'maintainers':
-                 [<_Maintainer '[email protected]'>],
-                 'changelogs': [], 'bugtrackers': []}>]
-               >>> upstream[0].maintainers[0].name
-               'Thomas Mills Hinkle'
+    Example usage:
+    >>> pkg_md = 
MetaData('/var/db/repos/gentoo/app-accessibility/espeak-ng/metadata.xml')
+    >>> pkg_md
+    <MetaData '/var/db/repos/gentoo/app-accessibility/espeak-ng/metadata.xml'>
+    >>> for maint in pkg_md.maintainers():
+    ...     print('{0} ({1})'.format(maint.email, maint.name))
+    ...
+    [email protected] (William Hubbs)
+    >>> for flag in pkg_md.use():
+    ...     print(flag.name, '->', flag.description)
+    ...
+    async -> Enables asynchronous commands
+    klatt -> Enables Klatt formant synthesis and implementation
+    l10n_ru -> Builds extended Russian Dictionary file
+    l10n_zh -> Builds extended Chinese (Mandarin and Cantonese) Dictionary 
files
+    man -> Builds and installs manpage with app-text/ronn
+    mbrola -> Adds support for mbrola voices
+    >>> upstream = pkg_md.upstream()
+    >>> upstream
+    [<_Upstream {'node': <Element 'upstream' at 0x7f952a73b2c0>,
+     'maintainers': [<_Maintainer '[email protected]'>],
+     'changelogs': ['https://github.com/espeak-ng/espeak-ng/releases.atom'],
+     'docs': [], 'bugtrackers': [],
+     'remoteids': [('espeak-ng/espeak-ng', 'github')]}>]
+    >>> upstream[0].maintainers[0].name
+    'Reece H. Dunn'
 """
 
 __all__ = ("MetaData",)
@@ -38,12 +39,9 @@ __docformat__ = "epytext"
 # Imports
 # =======
 
-import os
 import re
 import xml.etree.cElementTree as etree
 
-from portage import settings
-
 # =======
 # Classes
 # =======
@@ -183,7 +181,6 @@ class MetaData:
         self._xml_tree = etree.parse(metadata_path)
 
         # Used for caching
-        self._herdstree = None
         self._descriptions = None
         self._maintainers = None
         self._useflags = None
@@ -192,56 +189,6 @@ class MetaData:
     def __repr__(self):
         return "<%s %r>" % (self.__class__.__name__, self.metadata_path)
 
-    def _get_herd_email(self, herd):
-        """Get a herd's email address.
-
-        @type herd: str
-        @param herd: herd whose email you want
-        @rtype: str or None
-        @return: email address or None if herd is not in herds.xml
-        @raise IOError: if $PORTDIR/metadata/herds.xml can not be read
-        """
-
-        if self._herdstree is None:
-            herds_path = os.path.join(settings["PORTDIR"], 
"metadata/herds.xml")
-            try:
-                self._herdstree = etree.parse(herds_path)
-            except IOError:
-                # For some trees, herds.xml may not exist. Bug #300108.
-                return None
-
-        # Some special herds are not listed in herds.xml
-        if herd in ("no-herd", "maintainer-wanted", "maintainer-needed"):
-            return None
-
-        for node in self._herdstree.iter("herd"):
-            if node.findtext("name") == herd:
-                return node.findtext("email")
-
-    def herds(self, include_email=False):
-        """Return a list of text nodes for <herd>.
-
-        @type include_email: bool
-        @keyword include_email: if True, also look up the herd's email
-        @rtype: list
-        @return: if include_email is False, return a list of strings;
-                 if include_email is True, return a list of tuples containing:
-                                 [('herd1', '[email protected]'), ('no-herd', 
None);
-        """
-
-        result = []
-        for elem in self._xml_tree.findall("herd"):
-            text = elem.text
-            if text is None:
-                text = ""
-            if include_email:
-                herd_mail = self._get_herd_email(text)
-                result.append((text, herd_mail))
-            else:
-                result.append(text)
-
-        return result
-
     def descriptions(self):
         """Return a list of text nodes for <longdescription>.
 

Reply via email to