-
Notifications
You must be signed in to change notification settings - Fork 401
Allow SOURCE_DATE_EPOCH to override file timestamps #144
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
I am not too keen on the use of global variable(s) here. May be we can renew loading the environ variable for each build and store it in the spec or package variable instead. Other than that the patch looks good from a code POV. I wonder how we want to address the Python .pyc file issue (and probably others). Not that this is a prerequisite for getting this patch in. We could try to leverage the file attribute mechanism or have a list of REs matching the FILECLASS tag. Resulting files could be given an mtime of SOURCE_DATE_EPOCH+1 |
On 2017-02-02 13:46, Florian Festi wrote:
I am not too keen on the use of global variable
Do you refer to "oneshot" or "SOURCE_DATE_EPOCH"?
I wonder how we want to address the Python .pyc file issue
I was thinking that it would be better to do it like Debian and generate
those in %post
which also reduces the size of rpms and allows it to be noarch
The alternative approach would be to change the macro generating them and first touch source .py files to set their date to $SOURCE_DATE_EPOCH so that this gets embedded in .pyc headers
|
Yes that would be good. Here is the relevant debian policy for that: https://www.debian.org/doc/packaging-manuals/python-policy/ch-module_packages.html#s-byte_compilation |
@toabctl I'm not particularly a fan of the late byte-compilation technique Debian uses, and I'd rather not propagate that down to everyone. For one thing, we're trying to reduce the number of scripts run outside of the realm of the package manager, not increase it. Having even fewer files known by the package manager is just crazy and stupid. However, @bmwiedemann's idea of getting the .py files set to |
@bmwiedemann wrote:
I doubt that RPM can do this without delayed script execution because the bytecode generator is not necessarily installed when the %post runs. |
Limit the maximum date to SOURCE_DATE_EPOCH or use origtime if not defined similar to the tar --clamp-mtime option based on a patch by Nicolas Vigier <boklm at torproject.org>
@ffesti I restructured the code to get rid of the ugly 'static' globals. |
@fweimer Wouldn't that happen during the package build, rather than at runtime? It seems like that's a package build-time action. |
I quoted the wrong part (Github doesn't seem to support automated quoting). I was actually referring to this:
|
@fweimer I see, that makes much more sense. |
Thanks for the patch! |
on the semi-offtopic python .pyc timestamp issue see: python/cpython#296 |
…ng in make_rpm.py This change makes experimental/rpm.bzl support setting [`SOURCE_DATE_EPOCH`] when packaging rpms, sourced either directly inline Bazel or from a rule, as in the existing `pkg_rpm` rule. The code is largely identical. Additionally, it was discovered that `SOURCE_DATE_EPOCH` only affects the RPM's build time (not the files) unless you explicitly tell it otherwise. This seems to be the `%clamp_mtime_to_source_date_epoch` macro, first added in [this PR]. It is now set automatically in RPMs when `SOURCE_DATE_EPOCH` is set in both `pkg_rpm` rules. Tests are also provided for `experimental/rpm.bzl` only. Tests for the existing/legacy `pkg_rpm` rule can be added if so desired. Additionally: - Command debugging in `make_rpm.py` was expanded to include printing out the environment. - The test helper routines were made even more generic -- now users can specify the exact CSV manifest formats they want. This is used to check for mtimes for this particular use case which are otherwise not checked. - Documentation fixes where noted. Some of the TODOs will be tagged with tickets when opportune (soon). [`SOURCE_DATE_EPOCH`]: https://reproducible-builds.org/docs/source-date-epoch/ [this PR]: rpm-software-management/rpm#144
…ng in make_rpm.py (#322) This change makes experimental/rpm.bzl support setting [`SOURCE_DATE_EPOCH`] when packaging rpms, sourced either directly inline Bazel or from a rule, as in the existing `pkg_rpm` rule. The code is largely identical. Additionally, it was discovered that `SOURCE_DATE_EPOCH` only affects the RPM's build time (not the files) unless you explicitly tell it otherwise. This seems to be the `%clamp_mtime_to_source_date_epoch` macro, first added in [this PR]. It is now set automatically in RPMs when `SOURCE_DATE_EPOCH` is set in both `pkg_rpm` rules. Tests are also provided for `experimental/rpm.bzl` only. Tests for the existing/legacy `pkg_rpm` rule can be added if so desired. Additionally: - Command debugging in `make_rpm.py` was expanded to include printing out the environment. - The test helper routines were made even more generic -- now users can specify the exact CSV manifest formats they want. This is used to check for mtimes for this particular use case which are otherwise not checked. - Documentation fixes where observed. Some of the TODOs will be tagged with tickets when opportune (soon). [`SOURCE_DATE_EPOCH`]: https://reproducible-builds.org/docs/source-date-epoch/ [this PR]: rpm-software-management/rpm#144
Limit the maximum date to SOURCE_DATE_EPOCH, if defined
similar to the tar --clamp-mtime option
based on a patch by
Nicolas Vigier <boklm at torproject.org>
together with previously merged
#143
b8a54d6 from @boklm
2258825
This allows rpmbuild to produce bit-by-bit identical rpms on different hosts when setting rpmmacros to
macro is needed, because not everyone might want it, as it is known to affect python packages that include .pyc files which reference the original timestamp. Those will still work but re-compile on demand.