bazelbuild / bazelbuild/rules_pkg
Provide a way to substitute values from volatile-status.txt
- Dominant language
- Starlark
- Stars
- 253
- Forks
- 221
- Avg merge
- 10h 33m
- Merged PRs (30d)
- 1
Description
# Use case
- I have a build that creates binary with a versioned name. E.g. `server.YYYYMMDD`
- I want the .deb file to include that time stamp in the name
- Within the deb package, I have an /etc/init script that has a symlink to server.yymmdd.
- How can I get pkg_mklink() to do that? Likewise for pkg_mkdirs.
Obvious constraint:
- You can't read bazel-out/volatile-status.txt at analysis time, when much of mappings takes place
# Idea 1
Have all the writers be able to read volatile-status and late substitute
Yeech. That fan out is infinite.
# Idea 2
Add a manifest rewriter step that can do that. If any of the providers have a need substitute bit, invoke it
# Idea 3
Do it at analysis time by
- having the tool that creates workspace status also write a .bzl file with a well known name.
- custom pkg_* rules that load the .bzl file and do the substitution.
Could we generalize that so people don't need their own rules?
Maybe:
- add PackageVariablesInfo as an input to more rules.
- user creates custom rule to load that .bzl file and return the provider.
Contributor guide
Research direction
Start by reading the workspace-status handling around volatile-status.txt and the existing pkg_mklink() and pkg_mkdirs() entry points. Compare the proposed manifest rewriter, generated .bzl file, and PackageVariablesInfo approaches. Done means the project has an agreed mechanism for substituting volatile values in both package paths and symlink targets without reading volatile-status.txt at analysis time.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100