diff options
author | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2015-11-25 13:49:19 +0100 |
---|---|---|
committer | Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> | 2015-11-25 13:49:19 +0100 |
commit | b8da04b86fdde6e2137dad51dc5917ef49c91a4a (patch) | |
tree | 0fc65821e4c7ebf67ec1f97f34117c14a7fbd9e2 | |
parent | _emerge.actions.getgccversion(): Work with chost=None and with no explicit ch... (diff) | |
download | portage-b8da04b8.tar.gz portage-b8da04b8.tar.bz2 portage-b8da04b8.zip |
portageq envvar: Return 1 for any nonexistent variable.
-rwxr-xr-x | bin/portageq | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/portageq b/bin/portageq index 548d090e0..925640b2e 100755 --- a/bin/portageq +++ b/bin/portageq @@ -1,5 +1,5 @@ #!/usr/bin/python -bO -# Copyright 1999-2014 Gentoo Foundation +# Copyright 1999-2015 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 from __future__ import print_function, unicode_literals @@ -800,15 +800,25 @@ def envvar(argv): print("ERROR: insufficient parameters!") return 2 + exit_status = 0 + for arg in argv: if arg in ("PORTDIR", "PORTDIR_OVERLAY", "SYNC"): print("WARNING: 'portageq envvar %s' is deprecated. Use any of " "'get_repos, get_repo_path, repos_config' instead." % arg, file=sys.stderr) + + value = portage.settings.get(arg) + if value is None: + value = "" + exit_status = 1 + if verbose: - print(arg + "=" + portage._shell_quote(portage.settings[arg])) + print(arg + "=" + portage._shell_quote(value)) else: - print(portage.settings[arg]) + print(value) + + return exit_status docstrings['envvar'] = """<variable>+ Returns a specific environment variable as exists prior to ebuild.sh. |