Refactor dist, azl macros#8013
Conversation
3b1528e to
95d5d39
Compare
|
I would really prefer my PR over this one #8028 |
specifically, i don't want to see the mariner-rpm-macros package get bigger, it should get split up into separate packages. And the macros.dist file absolutely should belong to the azurelinux-release package, not mariner-rpm-macros (or a subpackage). |
I'm happy to merge these changes together somehow, I'm not married to the exact implementation. Especially given I've now realized that the tools will need to define these macros independently of the actual macro file (at least for the toolchain build) the exact location of the macros isn't important to me anymore. |
|
@ddstreetmicrosoft Ok, what I'll do is remove my changes to The one wrinkle there is that we need to set all the macros we care about inside the tools. How many of the new dist macros are critical? I'll leave |
I think I also like the idea of
With that in mind and Daniel's revert of the
What do you think? |
I don't particularly care what the toolkit does, as long as it results in rpms that are identical to what a 'normal' (i.e. non-toolkit) build produces.
%azure only please. No %azl nor %azl3. |
If this is only changing the toolkit then go for it, as I said I don't care about changes to the toolkit. Please remove the systemd.spec changes though.
|
To clarify - %azl seems like we're doing the acronym thing like %rhel, but while %rhel shortens 'red hat enterprise linux' and there isn't really any part of that that makes sense standalone (e.g. %redhat or %enterprise wouldn't really make sense as far as referring to a specific product), we have 'azure linux' so %azl isn't even acronymming correctly, and we also can simply use %azure like %fedora does - e.g. 'fedora linux' uses %fedora' and 'azure linux' can use %azure. That's what makes the most sense to me. But if we really don't want to use %azure then just %azl is the next best option IMHO. For sure it makes no sense at all to have %azl3. Guess we should also see what @christopherco @jslobodzian think |
|
I feel like As for |
500baed to
711e473
Compare
|
I've... broken GitHub... |
I don't have any problem with defining %azl3, I just think using it is a mistake in 99% of cases (instead, the unversioned %azure or %azl macro should be used). |
100% agree, seems very specialized and personally I'm always going to recommend using the numerical value of If we want to omit it I'm certainly not too hung up on it, if you don't see any real value I'll go ahead and remove it. Any maybe by the time I'm done GH will fix itself... |
|
Had a chat, going with |
ddstreetmicrosoft
left a comment
There was a problem hiding this comment.
LGTM but probably should get a review from someone else more familiar with the toolkit also
Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com>
| err := fmt.Errorf("failed to set distro defines (%s, %d), invalid name or version", nameAbreviation, majorVersion) | ||
| return "", 0, err | ||
| } | ||
| return nameAbreviation, majorVersion, nil |
There was a problem hiding this comment.
We're not setting or updating these values here, so no need to return them. I think we might as well completely drop this function and just move the if majorVersion < 0 || nameAbreviation == "" directly to the caller. Alternatively, the function could return a boolean and leave it to the caller to construct a proper error message.
There was a problem hiding this comment.
Both loadLdDistroFlags() and SetDistroMacros() call it, but I agree it doesn't need to return the values (hold over from when it was calling atoi).
| } | ||
| } | ||
|
|
||
| func TestDistroDefines(t *testing.T) { |
There was a problem hiding this comment.
Would it be possible to test one scenario per test function? It's going to be clearer what we're checking for and what exactly failed in case of a failure.
There was a problem hiding this comment.
Basically, instead of a comment line for each test case in this one function, my suggestion is to have a separate test function with a name that reflects what it's testing.
Co-authored-by: Pawel Winogrodzki <pawelwi@microsoft.com> Co-authored-by: Tobias Brick <39196763+tobiasb-ms@users.noreply.github.com>
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-staticsubpackages, etc.) have had theirReleasetag incremented../cgmanifest.json,./toolkit/scripts/toolchain/cgmanifest.json,.github/workflows/cgmanifest.json)./SPECS/LICENSES-AND-NOTICES/data/licenses.json,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON)*.signatures.jsonfilessudo make go-tidy-allandsudo make go-test-coveragepassSummary
We define
%distas.azl3(previously.cm2) in/usr/lib/rpm/macros.d/dist.macros. This is currently part ofmariner-rpm-macrospackage. This has a few issues:rpm-buildetc.%distcan't be used easily for conditional flags in spec files (%if 0%{?rhel}is a common pattern).Define a new macro
%azl 3(which will be defined inmacros.distin the future). Since theDIST_TAGcan be customized we set this macro explicitly from values baked into the go tools.https://microsoft.sharepoint.com/:w:/t/Mariner/EQ5GV3mMEZRLsLNIwxFXj-gBxBalfkJpba-xHiz-iOJc-Q?e=Dw2Min
Change Log
%azlto build macrosDoes this affect the toolchain?
YES
Test Methodology
https://dev.azure.com/mariner-org/mariner/_build/results?buildId=510616&view=resultshttps://dev.azure.com/mariner-org/mariner/_build/results?buildId=515509&view=results