Skip to content

Provide a way to substitute values from volatile-status.txt #1008

@aiuto

Description

@aiuto

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions