On 29. 01. 21 12:25, Zbigniew Jędrzejewski-Szmek wrote:
Hello fellow packagers!
The subject of bootstrapping came up on fedora-devel recently.
I had the following idea, about which I would love to hear some feedback:
== Problem:
building packages with bootstrap currently involves doing *two*
patches to the spec file: first to add '%global _without_bootstrap 1',
then comes a rebuild, second to remove the macro, and then comes
another rebuild.
== Partial solution
Let's have an rpm that provides a single file that sets the macro for us:
$ rpm -qpl noarch/rpm-with-bootstrap-0-1.fc34.noarch.rpm
/usr/lib/rpm/macros.d/macros.rpm-with-bootstrap
$ cat rpm-macros-bootstrap/macros.rpm-with-bootstrap
# Enable %%with_bootstrap for all builds
%_with_bootstrap 1
Then we can do the following:
$ rpmdev-bumpspec 'Do rebuild w/ bootstrap'
$ mock -i rpm-with-bootstrap
$ fedpkg mockbuild
$ rpmdev-bumpspec 'Do rebuild w/o bootstrap'
$ mock -i rpm-without-bootstrap [3]
$ fedpkg mockbuild
Voilà!
The same pattern should work with side-tags in koji.
I prepared a poc implementation in [1] which builds
rpm-{with,without}-{bootstrap,tests,lto}, and a test package [2] which
prints the values of %with_bootstrap, %with_tests, %with_lto.
Honestly, this feels very magical to me. Useful maybe, but I prefer to be
explicit in the spec.
OTOH if you disable tests like this, koschei will still build with tests, so
this is excellent for temporary tests disablement :)
== Full solution
If we have automatic version bumps, this would become even simpler:
$ mock -i rpm-with-bootstrap
$ fedpkg mockbuild
$ mock --dnf-cmd remove rpm-with-bootstrap
$ fedpkg mockbuild
Not that %{with bootstrap} also mangles the dist tag (if defined before the
Release tag), so no bump needed already \o/
My idea would be to submit [1] for package-review so that it's
generally available.
Note that this works if the package we're building uses
%bcond_with bootstrap
or
%bcond_without bootstrap
I picked %{with bootstrap}, %{with lto}, %{with tests} as
generally-useful settings. I think it is worth standarizing the names
like this, and at least %{with bootstrap} and %{with tests} could be
added to packaging guidelines.
We have recently tried to standardize %{with tests} but there was some pushback.
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.o...
--
Miro Hrončok
--
Phone: +420777974800
IRC: mhroncok