1 |
commit: b8da04b86fdde6e2137dad51dc5917ef49c91a4a |
2 |
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org> |
3 |
AuthorDate: Wed Nov 25 12:49:19 2015 +0000 |
4 |
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org> |
5 |
CommitDate: Wed Nov 25 12:49:19 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b8da04b8 |
7 |
|
8 |
portageq envvar: Return 1 for any nonexistent variable. |
9 |
|
10 |
bin/portageq | 16 +++++++++++++--- |
11 |
1 file changed, 13 insertions(+), 3 deletions(-) |
12 |
|
13 |
diff --git a/bin/portageq b/bin/portageq |
14 |
index 548d090..925640b 100755 |
15 |
--- a/bin/portageq |
16 |
+++ b/bin/portageq |
17 |
@@ -1,5 +1,5 @@ |
18 |
#!/usr/bin/python -bO |
19 |
-# Copyright 1999-2014 Gentoo Foundation |
20 |
+# Copyright 1999-2015 Gentoo Foundation |
21 |
# Distributed under the terms of the GNU General Public License v2 |
22 |
|
23 |
from __future__ import print_function, unicode_literals |
24 |
@@ -800,15 +800,25 @@ def envvar(argv): |
25 |
print("ERROR: insufficient parameters!") |
26 |
return 2 |
27 |
|
28 |
+ exit_status = 0 |
29 |
+ |
30 |
for arg in argv: |
31 |
if arg in ("PORTDIR", "PORTDIR_OVERLAY", "SYNC"): |
32 |
print("WARNING: 'portageq envvar %s' is deprecated. Use any of " |
33 |
"'get_repos, get_repo_path, repos_config' instead." |
34 |
% arg, file=sys.stderr) |
35 |
+ |
36 |
+ value = portage.settings.get(arg) |
37 |
+ if value is None: |
38 |
+ value = "" |
39 |
+ exit_status = 1 |
40 |
+ |
41 |
if verbose: |
42 |
- print(arg + "=" + portage._shell_quote(portage.settings[arg])) |
43 |
+ print(arg + "=" + portage._shell_quote(value)) |
44 |
else: |
45 |
- print(portage.settings[arg]) |
46 |
+ print(value) |
47 |
+ |
48 |
+ return exit_status |
49 |
|
50 |
docstrings['envvar'] = """<variable>+ |
51 |
Returns a specific environment variable as exists prior to ebuild.sh. |