Accepting request 1230184 from devel:tools:building

OBS-URL: https://build.opensuse.org/request/show/1230184
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/scons?expand=0&rev=50
This commit is contained in:
Ana Guerrero 2024-12-12 20:14:22 +00:00 committed by Git OBS Bridge
commit 9fe7fb37b5
3 changed files with 30 additions and 0 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Dec 11 09:10:56 UTC 2024 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add site_init.py to pass through SOURCE_DATE_EPOCH
-------------------------------------------------------------------
Thu Oct 24 18:52:36 UTC 2024 - Andreas Stieger <andreas.stieger@gmx.de>

View File

@ -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

20
site_init.py Normal file
View File

@ -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