diff options
| author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2018-01-06 17:18:11 +0200 |
|---|---|---|
| committer | Alexandru Ardelean <ardeleanalex@gmail.com> | 2018-01-08 15:32:47 +0200 |
| commit | c54b312043d4bb373d82c45c77e7a7ee48e9b0ac (patch) | |
| tree | 9bf67c6ea2a1fbfc542a2ae339cc3f733f22d572 /lang/python/python3/patches | |
| parent | bc631e861c742191465df09912dd959dff2626b2 (diff) | |
python,python3: honour the SOURCE_DATE_EPOCH for the build-info
The Modules/getbuildinfo.c allows the use of DATE and TIME
macros to be defined via CFLAGS.
These vars, control the build date & time when the
interpreter is opened, and can be read via the
`platform._sys_version()` function.
So, a conversion from SOURCE_DATE_EPOCH to DATE & TIME
is required at build-time.
This is especially needed for `platform._sys_version()`
to work.
The installation of pip seems to rely on this.
The logic has been adapted from:
https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Makefile
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/python3/patches')
| -rw-r--r-- | lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch b/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch new file mode 100644 index 000000000..340e302d8 --- /dev/null +++ b/lang/python/python3/patches/013-getbuildinfo-date-time-source-date-epoch.patch @@ -0,0 +1,28 @@ +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -725,6 +725,16 @@ regen-all: regen-opcode regen-opcode-tar + ############################################################################ + # Special rules for object files + ++DATE_FMT = %b %d %Y ++TIME_FMT = %H:%M:%S ++ifdef SOURCE_DATE_EPOCH ++ BUILD_DATE ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(DATE_FMT)" 2>/dev/null || date -u "+$(DATE_FMT)") ++ BUILD_TIME ?= $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+$(TIME_FMT)" 2>/dev/null || date -u "+$(TIME_FMT)") ++else ++ BUILD_DATE ?= $(shell date "+$(DATE_FMT)") ++ BUILD_TIME ?= $(shell date "+$(TIME_FMT)") ++endif ++ + Modules/getbuildinfo.o: $(PARSER_OBJS) \ + $(OBJECT_OBJS) \ + $(PYTHON_OBJS) \ +@@ -732,6 +742,8 @@ Modules/getbuildinfo.o: $(PARSER_OBJS) \ + $(MODOBJS) \ + $(srcdir)/Modules/getbuildinfo.c + $(CC) -c $(PY_CORE_CFLAGS) \ ++ -DDATE="\"$(BUILD_DATE)\"" \ ++ -DTIME="\"$(BUILD_TIME)\"" \ + -DGITVERSION="\"`LC_ALL=C $(GITVERSION)`\"" \ + -DGITTAG="\"`LC_ALL=C $(GITTAG)`\"" \ + -DGITBRANCH="\"`LC_ALL=C $(GITBRANCH)`\"" \ |
