Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plugin hook to nfpm backend so plugins can inject nfpm package field values #21822

Merged
merged 7 commits into from
Jan 16, 2025

Conversation

cognifloyd
Copy link
Member

With the nfpm backend, I need to inject some field values, like version and version_release from an in-repo plugin. In particular, I need to retrieve the version from a file in the repo, and the version_release needs to be calculated using some API calls to the remote package repository.

I could inject version using .pants.bootstrap as described here: https://www.pantsbuild.org/blog/2024/04/27/simple-versioning-with-git-tags However, looking up the value for version_release requires some of the parametrized values of the package target's fields (like platform, arch, and a custom field for distribution major version). So, I need a way to dynamically inject some of these metadata values.

This hook (InjectNfpmPackageFieldsRequest -> InjectedNfpmPackageFields)
is modeled based on the setup kwargs hook in the python backend
(SetupKwargsRequest -> SetupKwargs).
@cognifloyd cognifloyd requested a review from a team January 10, 2025 01:05
@cognifloyd cognifloyd self-assigned this Jan 10, 2025
I ran into this error message once, and it did not show me
the message, instead it said something about the lambda.
The lambda is not actually needed so drop it.
@cognifloyd cognifloyd merged commit 48f4713 into main Jan 16, 2025
24 checks passed
@cognifloyd cognifloyd deleted the cognifloyd/nfpm-inject-fields branch January 16, 2025 18:41
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.

2 participants