build: Add conditional builds for rpm build customization and related build script refactoring #541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
When working with a community member on the new Georgian translations, I created a custom copr repo to distribute translation updates as rpms. This allowed the translator to use my copr repo and just
dnf upgrade
to test his translations. The problem was that I could not enable a full build on a snapshot releases. Instead of just pointing my copr repo to my branch with updated translation files, I also needed to patch the spec file.With the conditional builds, I can enable a full build (with not unit tests) on my copr repo and point the build directly to my translation update PR.
Summary
Instead of sed swapping in a 0 or 1 for a
%define
variable in thespec.in
file, or running rpmbuild with a--define
, use conditional builds. See rpm conditional build docs for how they work.With a conditional build, source rpms retain the ability to build with different options depending on how
rpmbuild
is called. This allows a minimal (en_US, Firefox, Safari) or full (all locales, all browsers) build from srpm to be selected at build time using--with
or--without
build options.Since at least copr builds chroots directly from a srpm, conditional builds can be used to change build options. With this change, a "full build" can be forced simply by configuring the target chroot setting "without" to include "ovirt_build_full".
Details
A
ovirt_build_full
is the is the defaultRefactored
build-srpm.sh
andbuild-rpm.sh
:getopts
to parse options so they don't positionally clashMILESTONE
is not emptyFor GitHub CI, a minimal build with unit tests is used ("SNAPSHOT" in the pom.xml version string triggers a
MILESTONE=master
and that causesovirt_build_minimal
to be the default option)For copr builds, use
build-srpm.sh -c
to keep CI and copr srpm builds in the same placebump_release.sh
no longer needs to patch.copr/Makefile
since thebuild-srpm.sh
script can detect snapshot vs release builds by looking at theMILESTONE
Makefile varRemoved the file
milestone-config.sh
since it is not used anywhere in the codebaseExample
My translation testing copr repo: https://copr.fedorainfracloud.org/coprs/sdickers/enUS_kaGE/
ovirt-engine package referencing my PR branch:
Settings for the centos8-stream chroot: