diff --git a/docs/Plugin-Hooks.md b/docs/Plugin-Hooks.md index c47f240e5..fb7cb9b16 100644 --- a/docs/Plugin-Hooks.md +++ b/docs/Plugin-Hooks.md @@ -18,6 +18,7 @@ Where `HOOK_NAME` is one of: * postbuild - This hook is called just after RPM or SRPM have been build (with or without success). * postchroot - This hook is called just after exiting from command in `mock chroot` command. This action is currently being used by `root_cache` plugin. * postclean - This hook is called when the content of the chroot has been deleted. It is called after `umount_root`. E.g., `lvm_root` use this to delete the LVM volume. +* postdeps - Called when the build dependencies (both static and dynamic) are installed, but the build has not started, yet. * postinit - Chroot have been initialized and it is ready for installing SRPM dependencies. E.g., root_cache plugin now packs the chroot and put it in a cache. This action is currently being used by `bind_mount`, `lvm_root`, `mount`, `root_cache` plugins. * postshell - This hook is called just after exiting from the shell in `mock shell` command. This action is currently being used by `root_cache` plugin. * postupdate - Mock attempts to cache buildroot contents, but tries to automatically update the packages inside the buildroot in subsequent executions (so up2date packages are used during build). This hook is called anytime such update is successful and any package is updated inside the buildroot. Any plugin taking care of the buildroot caches can then react and update the cache to avoid re-updating in the subsequent mock runs. diff --git a/mock/py/mockbuild/backend.py b/mock/py/mockbuild/backend.py index 94d436a56..e0cd32413 100644 --- a/mock/py/mockbuild/backend.py +++ b/mock/py/mockbuild/backend.py @@ -300,6 +300,7 @@ def build(self, srpm, timeout, check=True, spec=None): ' See "dynamic_buildrequires" in config_opts.') self.install_external(requires) + # install the (static) BuildRequires self.installSrpmDeps(rebuilt_srpm) self.state.finish(buildsetup) buildsetup_finished = True @@ -791,6 +792,8 @@ def get_command(mode, checkdeps=False): mode = ['-ba'] mode += ['--noprep'] + self.plugins.call_hooks('postdeps') + # When we used dynamic buildrequires, the rpmbuild call will # execute the %generate_buildrequires section once again # in order to actually add the BuildRequires to the SRPM metadata. diff --git a/mock/py/mockbuild/plugins/package_state.py b/mock/py/mockbuild/plugins/package_state.py index 3328f53d8..23184a2f3 100644 --- a/mock/py/mockbuild/plugins/package_state.py +++ b/mock/py/mockbuild/plugins/package_state.py @@ -43,7 +43,7 @@ def __init__(self, plugins, conf, buildroot): self.inst_done = False self.online = self.buildroot.config['online'] plugins.add_hook("postyum", self._availablePostYumHook) - plugins.add_hook("prebuild", self._installedPreBuildHook) + plugins.add_hook("postdeps", self._installedPreBuildHook) @traceLog() def _availablePostYumHook(self): diff --git a/releng/release-notes-next/package-state-after-deps-resolved.bugfix b/releng/release-notes-next/package-state-after-deps-resolved.bugfix new file mode 100644 index 000000000..4c0ee27df --- /dev/null +++ b/releng/release-notes-next/package-state-after-deps-resolved.bugfix @@ -0,0 +1,7 @@ +The `installed_pkgs.log` — generated by the `package_state` plugin — was +[previously generated too early][issue#1429], after the static build +requirements were installed but **before** the dynamic build requirements were +resolved and installed. This led to incorrect chroot introspection for the end +user, as the full set of packages needed to build the given package was +incomplete. The new Mock version generates the `installed_pkgs.log` file after +the dynamic build requirements are installed.