From e897c501d9aeb3aeeebf011dbe110cc2c0f59f0b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 13 Nov 2022 14:48:03 -0500 Subject: Fixes to installation script. Text to README.txt --- SCons/__init__.py | 8 ++++---- packaging/etc/README.txt | 10 ++++++++++ packaging/etc/reproducible_install.sh | 16 +++++++--------- packaging/etc/reproducible_site_init.py | 3 ++- 4 files changed, 23 insertions(+), 14 deletions(-) mode change 100644 => 100755 packaging/etc/reproducible_install.sh diff --git a/SCons/__init__.py b/SCons/__init__.py index de64c52..8f397bc 100644 --- a/SCons/__init__.py +++ b/SCons/__init__.py @@ -1,9 +1,9 @@ __version__="4.4.1" __copyright__="Copyright (c) 2001 - 2022 The SCons Foundation" __developer__="bdbaddog" -__date__="Mon, 15 Aug 2022 11:59:33 -0700" -__buildsys__="M1Dog2021" -__revision__="18745cfc5e75df8028682183097202f926e22134" -__build__="18745cfc5e75df8028682183097202f926e22134" +__date__="Sun, 13 Nov 2022 11:31:29 -0400" +__buildsys__="M1DOG2021" +__revision__="15379ff3b369560c4bf13459b630387bf7349bb7" +__build__="15379ff3b369560c4bf13459b630387bf7349bb7" # make sure compatibility is always in place import SCons.compat # noqa \ No newline at end of file diff --git a/packaging/etc/README.txt b/packaging/etc/README.txt index e69de29..ffb9cc1 100644 --- a/packaging/etc/README.txt +++ b/packaging/etc/README.txt @@ -0,0 +1,10 @@ +This directory contains a number of scripts/files useful when building/packageing SCons + +To force SCons to propagate SOURCE_DATE_EPOCH from the shell running SCons we're providing +a script to create a ~/.scons/site_scons/site_init.py. +Note that reproducible_install.sh will NOT overwite an existing ~/.scons/site_scons/site_init.py +This supports https://reproducible-builds.org/specs/source-date-epoch/ +If you wanted to include this in your build tree you would place in site_scons/site_init.py relative +to your SConstruct. +* reproducible_install.sh +* reproducible_site_init.py \ No newline at end of file diff --git a/packaging/etc/reproducible_install.sh b/packaging/etc/reproducible_install.sh old mode 100644 new mode 100755 index 2eb6ad1..90d9d37 --- a/packaging/etc/reproducible_install.sh +++ b/packaging/etc/reproducible_install.sh @@ -1,19 +1,17 @@ #!/usr/bin/env bash -set -e -set -x - SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +TARGET_FILE=~/.scons/site_scons/site_init.py -mkdir -p ~/.site_scons +mkdir -p ~/.scons/site_scons -if [ ! -f "~/.site_scons/site_init.py" ] +if [ ! -f "${TARGET_FILE}" ] then - echo "File ~/.site_scons/site_init.py does not exist" + echo "File ${TARGET_FILE} does not exist" echo "We will add one which supports reproducible builds" - cp ${SCRIPT_DIR}/site_init.py ~/.site_scons/site_init.py + cp ${SCRIPT_DIR}/reproducible_site_init.py ${TARGET_FILE} else - echo "File ~/.site_scons/site_init.py already exists" + echo "File ${TARGET_FILE} already exists" echo "We will not overwrite it. Please copy the content" - echo "from ${SCRIPT_DIR}/site_init.py" + echo "from ${SCRIPT_DIR}/reproducible_site_init.py" fi diff --git a/packaging/etc/reproducible_site_init.py b/packaging/etc/reproducible_site_init.py index e4672a1..2b6b42a 100644 --- a/packaging/etc/reproducible_site_init.py +++ b/packaging/etc/reproducible_site_init.py @@ -8,13 +8,14 @@ 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. """ - print("In my custom init") old_init(self, **kw) if 'SOURCE_DATE_EPOCH' in os.environ: self._dict['ENV']['SOURCE_DATE_EPOCH'] = os.environ['SOURCE_DATE_EPOCH'] -- cgit v0.12