feat: add stamp support for pkg_rpm Release tag#1039
Draft
wade-arista wants to merge 1 commit intobazelbuild:mainfrom
Draft
feat: add stamp support for pkg_rpm Release tag#1039wade-arista wants to merge 1 commit intobazelbuild:mainfrom
wade-arista wants to merge 1 commit intobazelbuild:mainfrom
Conversation
Contributor
Author
|
Actually, I think I should read both stable and volatile status files. Update coming. |
Allow `{VARIABLE_NAME}` placeholders in the `release` attribute of
`pkg_rpm`. When `stamp = 1` (or `stamp = -1` with `--stamp`), workspace
status variables from volatile-status.txt are substituted at build time.
- Add `get_status_vars()` to `pkg/private/build_info.py`
- Add `--volatile_status_file` and `--stable_status_file` args to
`make_rpm.py`; apply substitution in `RpmBuilder.__init__` via the
new `stamp_vars` parameter
- Add `stamp` and `private_stamp_detect` attrs to the `pkg_rpm` rule;
rename the rule to `_pkg_rpm_rule` and expose a `pkg_rpm` macro that
injects `private_stamp_detect` via `select()`, matching the pattern
used by `pkg_tar` and `pkg_zip`
- Avoid embedding template placeholders in the output filename when stamp
is active
Fixes bazelbuild#1038
aiuto
requested changes
Mar 7, 2026
| """Get BUILD_TIMESTAMP.""" | ||
| """Workspace status file utilities.""" | ||
|
|
||
| def get_status_vars(status_file, include_empty=True): |
Collaborator
There was a problem hiding this comment.
Can you lift most of the docstring from get_timestamp and add it here.
| "DEBUGINFO_TYPE_NONE", | ||
| ) | ||
|
|
||
| _stamp_condition = Label("//pkg/private:private_stamp_detect") |
Collaborator
There was a problem hiding this comment.
The way to access this changed in #1035
This might still work, but take a look at that.
| doc = """File containing RPM "Version" tag.""", | ||
| allow_single_file = True, | ||
| ), | ||
| "release": attr.string( |
Collaborator
There was a problem hiding this comment.
Can you expand the docstring here to say that that you can turn on stamping to substitution for things like $BUILD_STAMP to work.
Also, adding this to examples/rpm would be good. Otherwise no one will find the feature.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow
{VARIABLE_NAME}placeholders in thereleaseattribute ofpkg_rpm. Whenstamp = 1(orstamp = -1with--stamp), workspace status variables from volatile-status.txt are substituted at build time.get_workspace_status_vars()topkg/private/build_info.py--volatile_status_filearg tomake_rpm.py; apply substitution inRpmBuilder.__init__via the newstamp_varsparameterstampandprivate_stamp_detectattrs to thepkg_rpmrule; rename the rule to_pkg_rpm_ruleand expose apkg_rpmmacro that injectsprivate_stamp_detectviaselect(), matching the pattern used bypkg_tarandpkg_zipFixes #1038