Skip to content

Commit

Permalink
build(core): use deterministic git rev-parse
Browse files Browse the repository at this point in the history
The output may differ in shallow vs. full repo.

[no changelog]
  • Loading branch information
mmilata committed Dec 4, 2024
1 parent 61ebb19 commit 2635e4c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions core/embed/projects/firmware/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@

#define MP_STATE_PORT MP_STATE_VM

// by default contains nearest git tag, which may not be present in shallow
// repo, breaking reproducibility
#define MICROPY_BANNER_NAME_AND_VERSION ""

// ============= this ends common config section ===================


Expand Down
4 changes: 4 additions & 0 deletions core/embed/projects/unix/mpconfigport.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ extern const struct _mp_print_t mp_stderr_print;

#define MP_STATE_PORT MP_STATE_VM

// by default contains nearest git tag, which may not be present in shallow
// repo, breaking reproducibility
#define MICROPY_BANNER_NAME_AND_VERSION ""

// ============= this ends common config section ===================

// For size_t and ssize_t
Expand Down
4 changes: 2 additions & 2 deletions core/site_scons/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ def get_git_revision_hash() -> str:

def get_git_revision_short_hash() -> str:
return (
subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
subprocess.check_output(["git", "rev-parse", "--verify", "HEAD"])
.decode("ascii")
.strip()
.strip()[:7]
)


Expand Down

0 comments on commit 2635e4c

Please sign in to comment.