From 459b377a3dbbc24b9705c352f825330b395887b4 Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Wed, 25 Jan 2017 14:44:11 -0500 Subject: [PATCH 1/2] Print command debugging information only once When debugging is turned on and a command is run that fails or with `print_on_success` on, the output for the command execution ends up being printed twice. This change ensures that only one set of output is printed at any point. Signed-off-by: Steve Kuznetsov --- src/tito/common.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tito/common.py b/src/tito/common.py index 722932a..948bd9c 100644 --- a/src/tito/common.py +++ b/src/tito/common.py @@ -413,12 +413,6 @@ def run_command(command, print_on_success=False): If command fails, print status code and command output. """ (status, output) = getstatusoutput(command) - - # ISSUE 253 - allow for better debug output - debug("Command: %s" % command) - debug("Status code: %s" % status) - debug("Command output: %s\n" % output) - if status > 0: msgs = [ "Error running command: %s\n" % command, @@ -431,6 +425,11 @@ def run_command(command, print_on_success=False): print("Command: %s\n" % command) print("Status code: %s\n" % status) print("Command output: %s\n" % output) + else: + debug("Command: %s" % command) + debug("Status code: %s" % status) + debug("Command output: %s\n" % output) + return output From 66a0a9edacf25a39f1b087fbeb98009f637c998e Mon Sep 17 00:00:00 2001 From: Steve Kuznetsov Date: Wed, 25 Jan 2017 15:09:52 -0500 Subject: [PATCH 2/2] Improved debugging for RPM build step Signed-off-by: Steve Kuznetsov --- src/tito/builder/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tito/builder/main.py b/src/tito/builder/main.py index 5a77d1e..f681ba6 100644 --- a/src/tito/builder/main.py +++ b/src/tito/builder/main.py @@ -248,7 +248,7 @@ class BuilderBase(object): '--define "_binary_filedigest_algorithm md5" %s %s %s %s ' '-ba %s' % (rpmbuild_options, self._get_rpmbuild_dir_options(), define_dist, self._get_clean_option(), self.spec_file)) - debug(cmd) + debug("Building RPMs with: \n%s".format(cmd)) try: output = run_command_print(cmd) except (KeyboardInterrupt, SystemExit):