-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make build reproducible by reading envvar SOURCE_DATE_EPOCH if set
#3430
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
Conversation
SOURCE_DATE_EPOCH if set
justinmayer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Vincent! Thank you for the submission. As it turns out, datetime.datetime.utcfromtimestamp() is deprecated, so I made a suggested change. Would you please take a look and let me know your thoughts?
| year = datetime.datetime.now().date().year | ||
| year = datetime.datetime.utcfromtimestamp( | ||
| int(os.environ.get("SOURCE_DATE_EPOCH", time.time())) | ||
| ).year |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change yields the following deprecation warning:
DeprecationWarning:
datetime.datetime.utcfromtimestamp()is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC:datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
Perhaps the following instead?
year = datetime.datetime.fromtimestamp(
int(os.environ.get("SOURCE_DATE_EPOCH", time.time())), datetime.timezone.utc
).yearSee also:
justinmayer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and made my suggested change so I could include this PR in an imminent new release. Thanks again, Vincent.
|
I just released Pelican 4.11.0, which includes the changes in this pull request. |
|
Thank you! |
As part of the ongoing Reproducible Builds project, packages in Debian/Ubuntu are routinely scanned and tested for build reproducibility. A bug was filed against the
pelicanpackage in Debian, so I'm just forwarding the patch that we've applied there to make it build reproducibly, i.e. by attempting to get the current datetime from a standard envvar, SOURCE_DATE_EPOCH, if it's available. Thanks for considering this change!