aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfuzzyray <fuzzyray@gentoo.org>2010-09-22 21:59:35 +0000
committerfuzzyray <fuzzyray@gentoo.org>2010-09-22 21:59:35 +0000
commite43337a9b05b3a5c39a1b2ca988375f2b7e352d3 (patch)
tree16568b52cf103374a49df4611bf71ca4bf4a6bfd
parentMerge from genscripts r459: douglasjanderson (diff)
downloadgentoolkit-e43337a9b05b3a5c39a1b2ca988375f2b7e352d3.tar.gz
gentoolkit-e43337a9b05b3a5c39a1b2ca988375f2b7e352d3.tar.bz2
gentoolkit-e43337a9b05b3a5c39a1b2ca988375f2b7e352d3.zip
Merge from genscripts r457: douglasjanderson
Add h(a)s to gentoolkit.test.equery.test_init.test_expand_module_name so that the test passes. Merge from genscripts r453: douglasjanderson This bring all equery modules except the new has module on board with bug #114086; adding non-zero exit status when a script finds no results Merge from genscripts r441: brian.dolbec some minor (non fatal) indent fixes. svn path=/trunk/gentoolkit/; revision=812
-rw-r--r--pym/gentoolkit/equery/belongs.py3
-rw-r--r--pym/gentoolkit/equery/changes.py8
-rw-r--r--pym/gentoolkit/equery/depends.py10
-rw-r--r--pym/gentoolkit/equery/hasuse.py26
-rw-r--r--pym/gentoolkit/test/equery/test_init.py1
5 files changed, 36 insertions, 12 deletions
diff --git a/pym/gentoolkit/equery/belongs.py b/pym/gentoolkit/equery/belongs.py
index 8e8abb3..7c20658 100644
--- a/pym/gentoolkit/equery/belongs.py
+++ b/pym/gentoolkit/equery/belongs.py
@@ -154,6 +154,7 @@ def main(input_args):
printer_fn=printer_fn
)
- find_owner(queries)
+ if not find_owner(queries):
+ sys.exit(1)
# vim: set ts=4 sw=4 tw=79:
diff --git a/pym/gentoolkit/equery/changes.py b/pym/gentoolkit/equery/changes.py
index b290f0a..1e9be32 100644
--- a/pym/gentoolkit/equery/changes.py
+++ b/pym/gentoolkit/equery/changes.py
@@ -141,11 +141,16 @@ def main(input_args):
sys.exit(2)
first_run = True
+ got_match = False
for query in (Query(x) for x in queries):
if not first_run:
print()
match = query.find_best()
+ if match is None:
+ continue
+
+ got_match = True
changelog_path = os.path.join(match.package_path(), 'ChangeLog')
changelog = ChangeLog(changelog_path)
@@ -177,5 +182,8 @@ def main(input_args):
print_entries(changelog.entries_matching_atom(atom)[:end])
first_run = False
+
+ if not got_match:
+ sys.exit(1)
# vim: set ts=4 sw=4 tw=79:
diff --git a/pym/gentoolkit/equery/depends.py b/pym/gentoolkit/equery/depends.py
index 2890365..cab23d1 100644
--- a/pym/gentoolkit/equery/depends.py
+++ b/pym/gentoolkit/equery/depends.py
@@ -171,7 +171,9 @@ def main(input_args):
#
dep_print = DependPrinter(verbose=CONFIG['verbose'])
+
first_run = True
+ got_match = False
for query in queries:
if not first_run:
print()
@@ -184,13 +186,17 @@ def main(input_args):
if CONFIG['verbose']:
print(" * These packages depend on %s:" % pp.emph(pkg.cpv))
- pkg.graph_reverse_depends(
+ if pkg.graph_reverse_depends(
pkgset=sorted(pkggetter(), key=CPV),
max_depth=QUERY_OPTS["max_depth"],
only_direct=QUERY_OPTS["only_direct"],
printer_fn=dep_print
- )
+ ):
+ got_match = True
first_run = False
+ if not got_match:
+ sys.exit(1)
+
# vim: set ts=4 sw=4 tw=79:
diff --git a/pym/gentoolkit/equery/hasuse.py b/pym/gentoolkit/equery/hasuse.py
index 03b989e..80c98fe 100644
--- a/pym/gentoolkit/equery/hasuse.py
+++ b/pym/gentoolkit/equery/hasuse.py
@@ -60,7 +60,7 @@ def print_help(with_description=True):
(" -o, --overlay-tree", "include overlays in search path"),
(" -p, --portage-tree", "include entire portage tree in search path"),
(" -F, --format=TMPL", "specify a custom output format"),
- (" TMPL",
+ (" TMPL",
"a format template using (see man page):")
)))
print(" " * 24, ', '.join(pp.emph(x) for x in FORMAT_TMPL_VARS))
@@ -73,19 +73,19 @@ def display_useflags(query, pkg):
useflags = [x.lstrip("+-") for x in pkg.environment("IUSE").split()]
except errors.GentoolkitFatalError:
# aux_get KeyError or other unexpected result
- return
+ return False
if query not in useflags:
- return
+ return False
if CONFIG['verbose']:
- pkgstr = PackageFormatter(
+ pkgstr = PackageFormatter(
pkg,
do_format=True,
custom_format=QUERY_OPTS["package_format"]
)
else:
- pkgstr = PackageFormatter(
+ pkgstr = PackageFormatter(
pkg,
do_format=False,
custom_format=QUERY_OPTS["package_format"]
@@ -95,17 +95,19 @@ def display_useflags(query, pkg):
not QUERY_OPTS["in_porttree"] and
not QUERY_OPTS["in_overlay"]):
if not 'I' in pkgstr.location:
- return
+ return False
if (QUERY_OPTS["in_porttree"] and
not QUERY_OPTS["in_overlay"]):
if not 'P' in pkgstr.location:
- return
+ return False
if (QUERY_OPTS["in_overlay"] and
not QUERY_OPTS["in_porttree"]):
if not 'O' in pkgstr.location:
- return
+ return False
pp.uprint(pkgstr)
+ return True
+
def parse_module_options(module_opts):
@@ -158,6 +160,7 @@ def main(input_args):
#
first_run = True
+ got_match = False
for query in queries:
if not first_run:
print()
@@ -166,7 +169,12 @@ def main(input_args):
pp.uprint(" * Searching for USE flag %s ... " % pp.emph(query))
for pkg in matches:
- display_useflags(query, pkg)
+ if display_useflags(query, pkg):
+ got_match = True
+
first_run = False
+ if not got_match:
+ sys.exit(1)
+
# vim: set ts=4 sw=4 tw=79:
diff --git a/pym/gentoolkit/test/equery/test_init.py b/pym/gentoolkit/test/equery/test_init.py
index d59fdc2..31da635 100644
--- a/pym/gentoolkit/test/equery/test_init.py
+++ b/pym/gentoolkit/test/equery/test_init.py
@@ -17,6 +17,7 @@ class TestEqueryInit(unittest.TestCase):
def test_expand_module_name(self):
# Test that module names are properly expanded
name_map = {
+ 'a': 'has',
'b': 'belongs',
'c': 'changes',
'k': 'check',