mariner-release: add %{dist} macro to persistent macro file.
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
- [x] The toolchain has been rebuilt successfully (or no changes were made to it)
- [x] The toolchain/worker package manifests are up-to-date
- [x] Any updated packages successfully build (or no packages were changed)
- [x] Packages depending on static components modified in this PR (Golang,
*-staticsubpackages, etc.) have had theirReleasetag incremented. - [x] Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
- [x] All package sources are available
- [x] cgmanifest files are up-to-date and sorted (
./cgmanifest.json,./toolkit/tools/cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json) - [x] LICENSE-MAP files are up-to-date (
./SPECS/LICENSES-AND-NOTICES/data/licenses.json,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON) - [x] All source files have up-to-date hashes in the
*.signatures.jsonfiles - [x]
sudo make go-tidy-allandsudo make go-test-coveragepass - [x] Documentation has been updated to match any changes to the build system
- [x] Ready to merge
Summary
When using a Mariner image to invoke rpmbuild, it is expected that %{dist} is defined (".cm2" etc). In our build tooling we explicitly pass that definition in on the command line, but this is not standard. This macro is defined in /usr/lib/rpm/macros.d/macros.dist on Fedora systems.
Change Log
- Add
/usr/lib/rpm/macros.d/macros.disttomariner-releasewhich contains a single macro%%{dist} %{dist}which matches the distro tag at the time of the build.
Does this affect the toolchain?
NO
Test Methodology
- Local build
- Full pipeline in progress
I've rerun a local build with the new changes and the %dist macro expands the same way as before.
Rebased to current main branch
Interestingly, %{dist} can be resolved by rpm on Fedora, Red Hat, but not on Mariner even after this PR:
> docker run -it fedora rpm --eval '%{dist}'
.fc37
> docker run -it registry.access.redhat.com/ubi8/ubi:8.4 rpm --eval '%{dist}'
.el8
> docker run -it mcr.microsoft.com/cbl-mariner/base/core:2.0 rpm --eval '%{dist}'
%{dist}
I had a dig around the upstream repos when looking at this change. This macro is something that is set for most (if not all) rpm distros.
If a non-standard tag is desired, this can be overridden by passing rpmbuild -D 'dist <custom_tag>' ... , or if you want to explicitly clear it you can use rpmbuild --undefine 'dist' ...