guix: SOURCE_DATE_EPOCH is already set in some environments #29935

issue laanwj openend this issue on April 22, 2024
  1. laanwj commented at 6:38 pm on April 22, 2024: member

    The environment variable SOURCE_DATE_EPOCH allows overriding the date that will be used inside the archives for guix-built binaries. This is an intentional feature, as documented in contrib/guix/README.md:

    • SOURCE_DATE_EPOCH

      Override the reference UNIX timestamp used for bit-for-bit reproducibility, the variable name conforms to [standard][r12e/source-date-epoch].

      (defaults to the output of $(git log --format=%at -1))

    However, some environments, as apparently Nix, set SOURCE_DATE_EPOCH by default. This can be extremely confusing, as it results in mismatches. i see three options:

    • Show a big red warning when the Guix build scripts are called with an existing SOURCE_DATE_EPOCH. Most likely it’s not what the user wanted, but they can continue if they wanted.
    • Disallow overriding SOURCE_DATE_EPOCH - unset it at start.
    • Rename our SOURCE_DATE_EPOCH to something non-standard that doesn’t conflict with Nix.

    The first one has my preference.

    See bitcoin-core/guix.sigs#1201 which prompted this.

  2. laanwj added the label Build system on Apr 22, 2024
  3. hebasto commented at 7:30 pm on April 22, 2024: member
    • Rename our SOURCE_DATE_EPOCH to something non-standard that doesn’t conflict with Nix.

    As we run Guix shell in a container, it seems reasonable to rename SOURCE_DATE_EPOCH in the guix-build and guix-codesign scripts, and pass it to the container using its original name:

    0--env SOURCE_DATE_EPOCH="${BITCOIN_SOURCE_DATE_EPOCH:?unable to determine value}"
    
  4. laanwj commented at 2:19 pm on April 23, 2024: member
    Sounds good to me. I think it’s fine to rename it, I think there’s really very few edge cases in which one would really want to pass in a custom epoch to the guix build?
  5. fanquake commented at 10:53 am on April 24, 2024: member

    As we run Guix shell in a container, it seems reasonable to rename SOURCE_DATE_EPOCH in the guix-build and guix-codesign scripts, and pass it to the container using its original name:

    Not sure. We already have FORCE_DIRTY_WORKTREE. Seems fine to just make SOURCE_DATE_EPOCH function in the same way, rather than new variables / more build options / things being less-standard.

  6. laanwj commented at 11:03 am on April 24, 2024: member
    That sounds like a good approach to me too. So, fail when SOURCE_DATE_EPOCH is set, unless FORCE_SOURCE_DATE_EPOCH is also set?
  7. laanwj commented at 2:24 pm on April 29, 2024: member
    Or could cover SOURCE_DATE_EPOCH being set under FORCE_DIRTY_WORKTREE, it’s not strictly the same, but it’s also an intentionally introduced mismatch, and would avoid adding another build option.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-06-29 07:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me