diff --git a/behave/features/dnf4.feature b/behave/features/dnf4.feature new file mode 100644 index 000000000..1e484d658 --- /dev/null +++ b/behave/features/dnf4.feature @@ -0,0 +1,8 @@ +Feature: Mock is able to work with dnf4 chroots + + @dnf4 + Scenario: Building a DNF4 chroot without bootstrap chroot + Given an unique mock namespace + And mock is always executed with "--no-bootstrap-chroot" + When an online source RPM is rebuilt against centos-stream+epel-9-x86_64 + Then the build succeeds diff --git a/behave/features/steps/other.py b/behave/features/steps/other.py index fa8d5b629..337d7c4da 100644 --- a/behave/features/steps/other.py +++ b/behave/features/steps/other.py @@ -168,12 +168,17 @@ def step_impl(context, expected_message): assert_that(err, has_length(1)) assert_that(err[0], contains_string(expected_message)) +def _rebuild_online(context, chroot=None): + url = context.test_storage + "mock-test-bump-version-1-0.src.rpm" + context.mock.rebuild([url], chroot) @when('an online source RPM is rebuilt') def step_impl(context): - url = context.test_storage + "mock-test-bump-version-1-0.src.rpm" - context.mock.rebuild([url]) + _rebuild_online(context) +@when('an online source RPM is rebuilt against {chroot}') +def step_impl(context, chroot): + _rebuild_online(context, chroot) @then('{output} contains "{text}"') def step_impl(context, output, text): @@ -301,3 +306,7 @@ def step_impl(context): break assert_that(tarball.group(), equal_to("mock")) assert_that(tarball.owner(), equal_to(context.current_user)) + +@given('mock builds against {chroot} chroot') +def step_impl(context, chroot): + context.mock.chroot = chroot diff --git a/behave/testlib.py b/behave/testlib.py index 8f463211b..f6cbf4c0f 100644 --- a/behave/testlib.py +++ b/behave/testlib.py @@ -97,11 +97,14 @@ def init(self): }] return out, err - def rebuild(self, srpms): + def rebuild(self, srpms, chroot=None): """ Rebuild source RPM(s) """ chrootspec = [] - if self.context.custom_config: + if chroot: + chrootspec += ["-r", chroot] + self.context.chroot = chroot + elif self.context.custom_config: config_file = Path(self.context.workdir) / "custom.cfg" with config_file.open("w") as fd: fd.write(f"include('{self.context.chroot}.cfg')\n")