enthought / pyface

pyface: traits-capable windowing framework
Other
107 stars 55 forks source link

Bug report: image_volume.py time_stamp breaks reproducible builds #1254

Closed bmwiedemann closed 1 year ago

bmwiedemann commented 1 year ago

Environment

OS: all (openSUSE-Tumbleweed-20230728) Python version: all

Description

While working on reproducible builds for openSUSE, I found that building our python-pyface package twice resulted in such diffs:

--- old//usr/lib/python3.11/site-packages/pyface/image/library/icons.zip/image_volume.py        2023-07-30 13:29:14.000000000 +0200
+++ new//usr/lib/python3.11/site-packages/pyface/image/library/icons.zip/image_volume.py        2039-09-01 02:45:16.000000000 +0200
@@ -4,7 +4,7 @@
     category='General',
     keywords=[],
     aliases=[],
-    time_stamp='20230730132924',
+    time_stamp='20390901024527',
     info=[

There should be a way to get deterministic build results, e.g. allow to override the build timestamp with SOURCE_DATE_EPOCH.

Steps to Reproduce

do a clean build twice

corranwebster commented 1 year ago

Thanks for the report, although I don't think this is an issue with Pyface. I'm not sure why your build is touching the icons.zip file. You should be able to treat that as a fixed asset from the point of view of linux packaging.

bmwiedemann commented 1 year ago

It seems, icons.zip is modified by the unittests: https://code.opensuse.org/package/python-pyface/blob/3ea62406bddb3d455d2d0cc4be6661d24d7b95ea/f/python-pyface.spec#_88 maybe in pyface/image/tests/test_image.py ?

corranwebster commented 1 year ago

Yes, I think there are tests which test the correct regeneration of the zip archives. Tests shouldn't be run on as part of actually creating a build artefact though? I'd think you'd want to run the tests on the result of the reproducible build.

bmwiedemann commented 1 year ago

This seems to be an effect of how we build with rpmbuild. There tests run before bundling up files. Will try to avoid it there.

bmwiedemann commented 11 months ago

We solved it now via https://build.opensuse.org/request/show/1131679 by copying PYTHONPATH / python_sitelib before a test.