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

Allow to override build date with SOURCE_DATE_EPOCH #76

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

bmwiedemann
Copy link
Contributor

Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good and https://reproducible-builds.org/specs/source-date-epoch/ for the definition of this variable.

This patch was done while working on reproducible builds for openSUSE.

in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.

This patch was done while working on reproducible builds for openSUSE.
@praiskup
Copy link
Owner

praiskup commented Jan 20, 2023

Thank you for the patch. Note there"s also the issue #75.

Since this patch is probably an RPM-only solution, I"d probably prefer
having this date logic, note the latter detections should beat the former:

  • time.time() by default
  • SOURCE_DATE_EPOCH env var (solves RPM builds if no better detection
    available)
  • what @ssbarnea suggests, i.e. detecting from .git
  • the --date option (explicit decision)

The first two are implemented by this PR. The third can be added later,
As such, I like the PR. @ssbarnea can you take a look?

@bmwiedemann
Copy link
Contributor Author

SOURCE_DATE_EPOCH is set by various package builds, e.g. in Debian, ArchLinux, NixOS, Guix - in addition to rpm.

If you have a .git tree instead of a release tarball, you can also extract %ct from it.

An explicit --date option is not as useful, because it requires us to patch an infinite number of callers.

@praiskup
Copy link
Owner

Ok, thank you again for the patch!

@praiskup praiskup merged commit eac5fcd into praiskup:main Jan 24, 2023
@bmwiedemann bmwiedemann deleted the date branch January 24, 2023 19:15
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.

2 participants