Skip to content

Add stamp attribute to pkg_tar (in the style of cc_binary(stamp=-1,0,1) - #288

Merged
aiuto merged 19 commits into
bazelbuild:mainfrom
aiuto:stamp
May 6, 2021
Merged

Add stamp attribute to pkg_tar (in the style of cc_binary(stamp=-1,0,1)#288
aiuto merged 19 commits into
bazelbuild:mainfrom
aiuto:stamp

Conversation

@aiuto

@aiuto aiuto commented Feb 4, 2021

Copy link
Copy Markdown
Collaborator

Part 1 of #287 This is not pretty, because Bazel does not make --stamp available directly

  • add a config setting to mimic --stamp: private_stamp_detect
  • add the stamp attribute to pkg_tar
  • use combination of stamp & private_stamp_detect to invoke stamping
  • this uses an undocumented feature to get to bazel-out/volatile-status.txt
    • that is bad in theory
    • In practice Bazel will eventually have admit the cat is out of the bag and document the files.

Future work:

  • implement for all 4 package types.
  • contain a test where a stamped package is used from a workspace that includes rules_pkg.

RELNOTES: Add stamp to pkg_tar.

This is hack upon hack, because Bazel does not make --stamp available directly

- add a config setting to mimic --stamp.
  - This should be available directly from starlark ctx
  - use the setting to pass a flag to the packager to stamp
- have a genrule to copy volatile-status.txt
  We need this because the packagers can not read it otherwise.
  - genrule has the 'stamp' attribute, which makes bazel-out/volatile-status.txt availble to it
  - we can copy it to a new place that other rules can see
  - This is tedious and not portable, bazel should make it available diretly.
- have pkg_tar implicitly depend on the status file
  - if the builder gets the flag, read the status file to get a time.

But actually using the time is not implemented.
@aiuto aiuto added P3 An issue that we are not working on but will review quarterly WIP labels Feb 4, 2021
@aiuto aiuto changed the title Demonstrate how to make --stamp work Add stamp attribute to pkg_tar May 3, 2021
@aiuto aiuto changed the title Add stamp attribute to pkg_tar Add stamp attribute to pkg_tar (in the style of cc_binary(stamp=-1,0,1) May 3, 2021
@aiuto aiuto added P2 An issue that should be worked on when time is available and removed WIP P3 An issue that we are not working on but will review quarterly labels May 3, 2021
@aiuto
aiuto requested a review from nacl May 3, 2021 21:57
@aiuto

aiuto commented May 3, 2021

Copy link
Copy Markdown
Collaborator Author

@nacl This is ready now. It's not as ugly as I thought it would be.

@nacl nacl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM -- not particularly ugly, other than the private_stamp_detect attribute.

Most comments other than about private_stamp_detect are mostly nits and documentation suggestions.

Also needs a rebase/merge against main.

Comment thread examples/time_stamping/BUILD
Comment thread examples/time_stamping/WORKSPACE Outdated
Comment thread examples/time_stamping/readme.md
Comment thread examples/time_stamping/readme.md
Comment thread pkg/private/build_info.py Outdated
Comment thread pkg/pkg.bzl
Comment thread pkg/tests/stamp_test.py
Comment thread pkg/tests/stamp_test.py
Comment thread pkg/tests/stamp_test.py
Comment thread pkg/tests/BUILD
@aiuto aiuto added P1 An issue that must be resolved. Must have an assignee and removed P2 An issue that should be worked on when time is available labels May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 An issue that must be resolved. Must have an assignee

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants