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

Cherry-pick to earlgrey_es_sival: Rework how bazel stamping work in the repository #21168

Merged
merged 10 commits into from
Feb 20, 2024

Conversation

github-actions[bot]
Copy link

@github-actions github-actions bot commented Feb 2, 2024

This is an automatic cherry-pick of #20881 to branch earlgrey_es_sival.

Several tools need to extract some information from bazel's version
file so create small library for that purpose to avoid duplicating
code.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit adebfaa)
The purpose of this module is to enabled rules to detect whether
stamping is enabled on the command-line or not. It requires some
hackery inspired by a bazel bug thread and which is very similar
to how rules_rust handles this as well.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit bc4fd07)
Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 62dcd3f)
With this change, `autogen_hjson_header` will now only pass
stamping information to regtool if required on the command-line.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit f0ec914)
With this change, `autogen_chip_info_src` will only pass version
information if stamping is enabled on the command-line. This
commit changes the meaning of the `--ot_version_file` flag of
`//util:rom_chip_info`. Previously, it was a path to a file
that contains the git sha. It is now a path to the bazel version
info file which is parsed using the `version_info` library.

Note: with this change, unless stamping is enabled, the ROM will
not contained the git sha in the chip_info anymore.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 375a037)
This dependency is not used because the version information
comes from `stamp-env.txt` which is handled directly by
`rust_binary`.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 4df546f)
With the previous changes, those targets have become useless and
can be removed.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit bc22e8b)
If stamping is disable, version_stamp will be an empty dictionary
and the code will print something like
```
// Generated register constants for rv_plic.
// Built for <unknown>
// https://github.com/lowRISC/opentitan/tree/<unknown>
// Tree status: <unknown>
// Build date: <current date>
```
This is unhelpful and still prints the current time which is defeats
the point of not stamping. The new code will not print anything
when a piece of information is not available.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 24903e9)
Instead of treating version_stamp like a dictionary with specific
name entries, turn it into a class with proper accessors so that
the particular representation of the version information is
abstracted.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 595d28c)
Allow opentitantool to be built with stamping disabled, and disable
it by default. Update the `version` command to handle the case of
missing information. The build time/date is removed since it adds
no useful information.

Signed-off-by: Amaury Pouly <[email protected]>
(cherry picked from commit 97cf2c7)
@msfschaffner
Copy link
Contributor

msfschaffner commented Feb 5, 2024

~~CC @andreaskurth ~~

We should probably coordinate with @neeraj-rv on this change.

Sorry I misread this - this is going to the sival branch, so LGTM.

@msfschaffner msfschaffner requested review from andreaskurth and neeraj-rv and removed request for andreaskurth and neeraj-rv February 5, 2024 17:30
@jwnrt jwnrt merged commit adfe118 into earlgrey_es_sival Feb 20, 2024
23 of 28 checks passed
@a-will a-will deleted the backport-20881-to-earlgrey_es_sival branch February 20, 2024 15:52
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.

3 participants