Per GLEP 67, orphaned packages do not have a <maintainer> in metadata.xml.
They can't be matched using '--maintainer-email=maintainer-nee...@gentoo.org'
anymore. Add a new command line argument '--orphaned' to match the orphaned
packages.

Signed-off-by: Göktürk Yüksek <gokt...@binghamton.edu>
---
 bin/portageq | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/bin/portageq b/bin/portageq
index 925640b..8ec81ea 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -1028,6 +1028,12 @@ class HerdMatcher(object):
                herds = self._herds
                return any(x in herds for x in metadata_xml.herds())
 
+class OrphanedMatcher(object):
+       def __call__(self, metadata_xml):
+               if not metadata_xml.maintainers():
+                       return True
+               else:
+                       return False
 
 def pquery(parser, opts, args):
        portdb = portage.db[portage.root]['porttree'].dbapi
@@ -1090,6 +1096,8 @@ def pquery(parser, opts, args):
                for x in opts.herd:
                        herds.extend(x.split(","))
                xml_matchers.append(HerdMatcher(herds))
+       if opts.orphaned:
+               xml_matchers.append(OrphanedMatcher())
 
        if opts.repo is not None:
                repos = [portdb.repositories[opts.repo]]
@@ -1248,6 +1256,11 @@ def add_pquery_arguments(parser):
                                        "longopt": "--maintainer-email",
                                        "action": "append",
                                        "help": "comma-separated list of 
maintainer email regexes to search for"
+                               },
+                               {
+                                       "longopt": "--orphaned",
+                                       "action": "store_true",
+                                       "help": "match only orphaned 
(maintainer-needed) packages"
                                }
                        )
                ),
-- 
2.4.10


Reply via email to