Specifically in this case, wouldn’t it make sense to constrain the required version in RPM spec of your package? As in BuildRequires: (package) <= (version)
. If it doesn’t build with newer version, then I would find it natural having it expressed explicitly.
More generally, it is possible to use the no-pull-build-requires
configuration option to disable the implied installation/update of build time dependencies. But this is meant more as a way to speed up the edit-build-test cycle. If some extra steps are needed to pull build time dependencies in, the [pre-|post-]pull-build-requires
hooks are the right tool to use.
So, should it be impossible to constrain the required version in .spec, then I would recommend you to use the pre-pull-build-requires
hook to invoke zypper with the arguments you found.