diff --git a/scons.changes b/scons.changes index 64aa4c2..30ec51f 100644 --- a/scons.changes +++ b/scons.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Dec 11 09:10:56 UTC 2024 - Bernhard Wiedemann + +- Add site_init.py to pass through SOURCE_DATE_EPOCH + ------------------------------------------------------------------- Thu Oct 24 18:52:36 UTC 2024 - Andreas Stieger diff --git a/scons.spec b/scons.spec index 212b6df..dca7b73 100644 --- a/scons.spec +++ b/scons.spec @@ -27,6 +27,8 @@ License: MIT Group: Development/Tools/Building URL: https://www.scons.org/ Source: http://prdownloads.sourceforge.net/scons/SCons-%{version}.tar.gz +# site_init based on https://github.com/SCons/scons/pull/4261 for reproducible builds +Source2: site_init.py BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -51,11 +53,14 @@ sed -i -e '/QT3_LIBPATH = os.path.join.*QT3DIR/s/lib/%{_lib}/' \ %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +mkdir -p %{buildroot}%{_datadir}/scons/site_scons +install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/scons/site_scons/site_init.py %files %license LICENSE %{_bindir}/* %{python_sitelib}/SCons %{python_sitelib}/SCons-%{version}-py*.egg-info +%{_datadir}/scons %changelog diff --git a/site_init.py b/site_init.py new file mode 100644 index 0000000..5281195 --- /dev/null +++ b/site_init.py @@ -0,0 +1,20 @@ + +import os +import SCons.Environment + +old_init = SCons.Environment.Base.__init__ + +print("Adding logic to propagate SOURCE_DATE_EPOCH from the shell environment when building with SCons") + + +def new_init(self, **kw): + """ + This logic will add SOURCE_DATE_EPOCH to the execution environment used to run + all the build commands. + """ + old_init(self, **kw) + if 'SOURCE_DATE_EPOCH' in os.environ: + self._dict['ENV']['SOURCE_DATE_EPOCH'] = os.environ['SOURCE_DATE_EPOCH'] + + +SCons.Environment.Base.__init__ = new_init