Skip to content

Conversation

@mvo5
Copy link
Contributor

@mvo5 mvo5 commented Jul 24, 2025

distro: set distro.ID in DistroYAML by loader

By setting the parsed distro.ID into DistroYAML we can
simplify a lot of the cases where we currently use
nameVer string for the various helpers. By using the
id we avoid re-parsing the name and potentially raising
error. This will simplify the code in the comming commits.


distro: add/use DistroYAML.ID consistently

We use(d) distroNameVer a lot when accessing YAML
data because that is what we had when transitioning
from fedora/rhel distro abstraction to the generic
distro. But now that everything is a generic distro
we can actually use distro.ID everywhere which
simplifies a lot of code and avoids (re)parsing
the distroNameVer.

@mvo5 mvo5 force-pushed the distro-defs-cleanup1 branch 2 times, most recently from 2db6ed3 to ad22c3a Compare July 29, 2025 15:35
@mvo5 mvo5 marked this pull request as ready for review July 29, 2025 15:35
@mvo5 mvo5 requested a review from a team as a code owner July 29, 2025 15:35
achilleas-k
achilleas-k previously approved these changes Jul 29, 2025
Copy link
Member

@achilleas-k achilleas-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the linter is unhappy.

supakeen
supakeen previously approved these changes Jul 30, 2025
Copy link
Member

@supakeen supakeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The YAML linter seems to be complaining about a file you didn't touch.

@mvo5 mvo5 force-pushed the distro-defs-cleanup1 branch from a090d5f to ae769eb Compare July 30, 2025 06:21
@mvo5 mvo5 requested a review from achilleas-k August 1, 2025 07:23
mvo5 added 2 commits August 1, 2025 09:26
By setting the parsed distro.ID into DistroYAML we can
simplify a lot of the cases where we currently use
`nameVer string` for the various helpers. By using the
id we avoid re-parsing the name and potentially raising
error. This will simplify the code in the comming commits.
We use(d) `distroNameVer` a lot when accessing YAML
data because that is what we had when transitioning
from fedora/rhel distro abstraction to the generic
distro. But now that everything is a generic distro
we can actually use `distro.ID` everywhere which
simplifies a lot of code and avoids (re)parsing
the `distroNameVer`.
Copy link
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thanks for figuring this out.

dist, err := defs.NewDistroYAML("fedora-43")
require.NoError(t, err)
assert.Equal(t, &defs.DistroYAML{
assert.Equal(t, dist, &defs.DistroYAML{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: technically, the dist should be the third argument to Equal(), because the second is the "expected" value and the third is the "actual" value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Thank you, I will fix this in a followup (usually I get this right but sometimes I forget :)

@mvo5 mvo5 added this pull request to the merge queue Aug 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 4, 2025
@supakeen supakeen added this pull request to the merge queue Aug 4, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 4, 2025
@mvo5 mvo5 added this pull request to the merge queue Aug 4, 2025
Merged via the queue into osbuild:main with commit 6a13edd Aug 4, 2025
23 checks passed
@mvo5 mvo5 deleted the distro-defs-cleanup1 branch August 4, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants