From 27e6af14115ba0dd0e6f8976e6e9645b7ad339c3 Mon Sep 17 00:00:00 2001 From: Kamil Dudka Date: Tue, 5 Nov 2024 18:18:37 +0100 Subject: [PATCH] csmock: try harder to install missing packages ... with `--keep-going` --- py/csmock | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/py/csmock b/py/csmock index 62c509f..0fd54ac 100755 --- a/py/csmock +++ b/py/csmock @@ -354,12 +354,16 @@ echo \"$self_pid\" > \"$lock_file\"'" \ cmd = ["--installdeps", srpm] + cmd_add return (self.exec_mock_cmd(cmd, quiet=quiet) == 0) - def emergency_install_deps(self, srpm): - (_, raw_deps) = self.results.get_cmd_output("rpm -qp '%s' --requires" % srpm) - for dep in raw_deps.split("\n"): + def emergency_install_pkgs(self, pkgs): + for dep in pkgs: if (dep): self.try_install([dep]) + def emergency_install_deps(self, srpm): + (_, raw_deps) = self.results.get_cmd_output("rpm -qp '%s' --requires" % srpm) + pkgs = raw_deps.split("\n") + self.emergency_install_pkgs(pkgs) + def remove(self, pkgs): return (self.exec_mock_cmd(["--remove"] + pkgs) == 0) @@ -404,6 +408,11 @@ echo \"$self_pid\" > \"$lock_file\"'" \ if try_only: return False + if keep_going: + # try to install the missing packages one by one + self.emergency_install_pkgs(missing_deps) + missing_deps = find_missing_pkgs(pkgs, self.results, self) + self.results.error(f"failed to install required packages ({strlist_to_shell_cmd(missing_deps)})", ec=ec_by_scrub)