azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

mariner-release: add %{dist} macro to persistent macro file.

Open dmcilvaney opened this issue 3 years ago • 1 comments

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, *-static subpackages, etc.) have had their Release tag 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.json files
  • [x] sudo make go-tidy-all and sudo make go-test-coverage pass
  • [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.dist to mariner-release which 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

dmcilvaney avatar Oct 10 '22 18:10 dmcilvaney

I've rerun a local build with the new changes and the %dist macro expands the same way as before.

dmcilvaney avatar Oct 12 '22 22:10 dmcilvaney

Rebased to current main branch

dmcilvaney avatar Nov 16 '22 21:11 dmcilvaney

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}

jiasli avatar Dec 09 '22 08:12 jiasli

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' ...

dmcilvaney avatar Dec 09 '22 22:12 dmcilvaney