summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2017-05-17 14:07:26 +0100
committerJonathan Maw <jonathan.maw@codethink.co.uk>2017-05-17 14:16:56 +0100
commit3db37af2d54bf1d84c75d56289fc7a9d91e39c27 (patch)
tree35492b5964e454e143e391cd83cd8a5f4134497b
parent8ecf7503e3aabb470499a67130b81fa1546bed19 (diff)
downloadybd-3db37af2d54bf1d84c75d56289fc7a9d91e39c27.tar.gz
sandbox: Make it possible to hide the logging of which command was run
We use invocations of 'rpm' to get information from rpms. This makes rpm generation barely-readable unless we make the logs hide this.
-rw-r--r--ybd/rpm.py2
-rw-r--r--ybd/sandbox.py6
2 files changed, 4 insertions, 4 deletions
diff --git a/ybd/rpm.py b/ybd/rpm.py
index f122558..2f44b0e 100644
--- a/ybd/rpm.py
+++ b/ybd/rpm.py
@@ -99,7 +99,7 @@ def expand_macro(system, dn, text):
env_vars = sandbox.env_vars_for_build(system)
# Force subprocess to return output, we will log after the call.
_, output, _ = sandbox.run_sandboxed(
- system, command, env_vars, run_logged=False)
+ system, command, env_vars, run_logged=False, print_command=False)
with open(system['log'], 'a') as logfile:
logfile.write(output)
return output.strip()
diff --git a/ybd/sandbox.py b/ybd/sandbox.py
index a47e319..fe8073c 100644
--- a/ybd/sandbox.py
+++ b/ybd/sandbox.py
@@ -110,10 +110,10 @@ def argv_to_string(argv):
def run_sandboxed(dn, command, env=None, allow_parallel=False,
- exit_on_error=True, run_logged=True):
+ exit_on_error=True, run_logged=True, print_command=True):
global executor
-
- app.log(dn, 'Running command:\n%s' % command)
+ if print_command:
+ app.log(dn, 'Running command:\n%s' % command)
with open(dn['log'], "a") as logfile:
logfile.write("# # %s\n" % command)