diff --git a/fix-for-result-dir.patch b/fix-for-result-dir.patch new file mode 100644 index 0000000..0d353d7 --- /dev/null +++ b/fix-for-result-dir.patch @@ -0,0 +1,125 @@ +commit 02b89c1e75f0089722adf34336900ddde0a18de8 +Author: Petr Hracek +Date: Mon Nov 14 13:24:09 2016 +0100 + + Fixes #241 + + Signed-off-by: Petr Hracek + +diff --git a/rebasehelper/application.py b/rebasehelper/application.py +index 31f0889..a3bb96c 100644 +--- a/rebasehelper/application.py ++++ b/rebasehelper/application.py +@@ -60,7 +60,7 @@ class Application(object): + rebased_patches = {} + upstream_monitoring = False + +- def __init__(self, cli_conf, execution_dir, debug_log_file, report_log_file): ++ def __init__(self, cli_conf, execution_dir, results_dir, debug_log_file, report_log_file): + """ + Initialize the application + +@@ -79,8 +79,7 @@ class Application(object): + self.kwargs['workspace_dir'] = self.workspace_dir = os.path.join(self.execution_dir, + settings.REBASE_HELPER_WORKSPACE_DIR) + # Directory where results should be put +- self.kwargs['results_dir'] = self.results_dir = os.path.join(self.execution_dir, +- settings.REBASE_HELPER_RESULTS_DIR) ++ self.kwargs['results_dir'] = self.results_dir = results_dir + + self.kwargs['non_interactive'] = self.conf.non_interactive + +@@ -103,8 +102,9 @@ class Application(object): + + @staticmethod + def setup(cli_conf): +- execution_dir = cli_conf.results_dir if cli_conf.results_dir else os.getcwd() +- results_dir = os.path.join(execution_dir, settings.REBASE_HELPER_RESULTS_DIR) ++ execution_dir = os.getcwd() ++ results_dir = cli_conf.results_dir if cli_conf.results_dir else execution_dir ++ results_dir = os.path.join(results_dir, settings.REBASE_HELPER_RESULTS_DIR) + + # if not continuing, check the results dir + if not cli_conf.cont and not cli_conf.build_only and not cli_conf.comparepkgs: +@@ -119,7 +119,7 @@ class Application(object): + debug_log_file = Application._add_debug_log_file(results_dir) + report_log_file = Application._add_report_log_file(results_dir) + +- return execution_dir, debug_log_file, report_log_file ++ return execution_dir, results_dir, debug_log_file, report_log_file + + @staticmethod + def _add_debug_log_file(results_dir): +@@ -164,7 +164,7 @@ class Application(object): + + :return: + """ +- self.rebase_spec_file_path = get_rebase_name(self.spec_file_path) ++ self.rebase_spec_file_path = get_rebase_name(self.results_dir, self.spec_file_path) + + self.spec_file = SpecFile(self.spec_file_path, + self.execution_dir, +@@ -760,5 +760,5 @@ class Application(object): + + + if __name__ == '__main__': +- a = Application(None, None, None, None) ++ a = Application(None, None, None, None, None) + a.run() +diff --git a/rebasehelper/cli.py b/rebasehelper/cli.py +index 9a7b2a4..fb6c57e 100644 +--- a/rebasehelper/cli.py ++++ b/rebasehelper/cli.py +@@ -225,10 +225,10 @@ class CliHelper(object): + raise RebaseHelperError('Wrong format of --builder-options. It must be in the following form:' + ' --builder-options="--desired-builder-option".') + cli = CLI() +- execution_dir, debug_log_file, report_log_file = Application.setup(cli) ++ execution_dir, results_dir, debug_log_file, report_log_file = Application.setup(cli) + if not cli.verbose: + handler.setLevel(logging.INFO) +- app = Application(cli, execution_dir, debug_log_file, report_log_file) ++ app = Application(cli, execution_dir, results_dir, debug_log_file, report_log_file) + app.run() + except KeyboardInterrupt: + logger.info('\nInterrupted by user') +diff --git a/rebasehelper/specfile.py b/rebasehelper/specfile.py +index 258cc8a..554b472 100644 +--- a/rebasehelper/specfile.py ++++ b/rebasehelper/specfile.py +@@ -42,16 +42,16 @@ from rebasehelper.exceptions import RebaseHelperError + PATCH_PREFIX = '%patch' + + +-def get_rebase_name(name): ++def get_rebase_name(dir_name, name): + """ + Function returns a name in results directory + +- :param name: ++ :param dir_name: ++ :param name: + :return: full path to results dir with name + """ +- dir_name = os.path.dirname(name) + file_name = os.path.basename(name) +- return os.path.join(dir_name, settings.REBASE_HELPER_RESULTS_DIR, file_name) ++ return os.path.join(dir_name, file_name) + + + class PatchList(list): +diff --git a/rebasehelper/tests/test_application.py b/rebasehelper/tests/test_application.py +index 2740c2a..c11c757 100644 +--- a/rebasehelper/tests/test_application.py ++++ b/rebasehelper/tests/test_application.py +@@ -102,8 +102,8 @@ class TestApplication(BaseTest): + + try: + cli = CLI(self.cmd_line_args) +- execution_dir, debug_log_file, report_log_file = Application.setup(cli) +- app = Application(cli, execution_dir, debug_log_file, report_log_file) ++ execution_dir, results_dir, debug_log_file, report_log_file = Application.setup(cli) ++ app = Application(cli, execution_dir, results_dir, debug_log_file, report_log_file) + app.prepare_sources() + for key, val in app.kwargs.items(): + if key in expected_dict: diff --git a/rebase-helper.spec b/rebase-helper.spec index 96c00f7..8766657 100644 --- a/rebase-helper.spec +++ b/rebase-helper.spec @@ -2,7 +2,7 @@ Name: rebase-helper Version: 0.8.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The tool which helps you with rebase package License: GPLv2+ @@ -34,6 +34,7 @@ Requires: python-pyquery Patch00: rebase-helper-download-test.patch Patch01: rebase-helper-test-git.patch +Patch02: fix-for-result-dir.patch %description @@ -51,6 +52,7 @@ rm -rf %{name}.egg-info #%patch00 -p1 -b .download #%patch01 -p1 -b .test-git +%patch02 -p1 -b .fix-result-dir %build @@ -85,6 +87,9 @@ install -p rebase-helper.bash %{buildroot}%{_sysconfdir}/bash_completion.d/ %changelog +* Tue Nov 22 2016 Petr Hracek - 0.8.0-3 +- Fix for result dir (#1397312) + * Wed Aug 17 2016 Petr Hracek - 0.8.0-2 - Fix bug caused by dependency to python-pyquery (#1363777)