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 upgradeto 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
%definevariable in thespec.infile, 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
rpmbuildis 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--withor--withoutbuild 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_fullis the is the defaultRefactored
build-srpm.shandbuild-rpm.sh:getoptsto parse options so they don't positionally clashMILESTONEis not emptyFor GitHub CI, a minimal build with unit tests is used ("SNAPSHOT" in the pom.xml version string triggers a
MILESTONE=masterand that causesovirt_build_minimalto be the default option)For copr builds, use
build-srpm.sh -cto keep CI and copr srpm builds in the same placebump_release.shno longer needs to patch.copr/Makefilesince thebuild-srpm.shscript can detect snapshot vs release builds by looking at theMILESTONEMakefile varRemoved the file
milestone-config.shsince 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:
