Disable Python hash seed randomization in %py_byte_compile
This change should help with byte-compilation reproducibility: https://bugzilla.redhat.com/show_bug.cgi?id=1686078
This commit is contained in:
parent
638f809f4c
commit
0eae1d90da
|
@ -12,9 +12,12 @@
|
|||
# use it in a subshell like this:
|
||||
# (%{py_byte_compile <interpereter> <path>}) || :
|
||||
|
||||
# Setting PYTHONHASHSEED=0 disables Python hash seed randomization
|
||||
# This should help with byte-compilation reproducibility: https://bugzilla.redhat.com/show_bug.cgi?id=1686078
|
||||
|
||||
%py_byte_compile()\
|
||||
py2_byte_compile () {\
|
||||
python_binary="%1"\
|
||||
python_binary="env PYTHONHASHSEED=0 %1"\
|
||||
bytecode_compilation_path="%2"\
|
||||
failure=0\
|
||||
find $bytecode_compilation_path -type f -a -name "*.py" -print0 | xargs -0 $python_binary -s -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("'"$RPM_BUILD_ROOT"'")[2], doraise=True) for f in sys.argv[1:]]' || failure=1\
|
||||
|
@ -23,13 +26,13 @@ py2_byte_compile () {\
|
|||
}\
|
||||
\
|
||||
py3_byte_compile () {\
|
||||
python_binary="%1"\
|
||||
python_binary="env PYTHONHASHSEED=0 %1"\
|
||||
bytecode_compilation_path="%2"\
|
||||
PYTHONPATH="%{_rpmconfigdir}/redhat" $python_binary -s -B -m compileall2 -o 0 -o 1 -s $RPM_BUILD_ROOT -p / $bytecode_compilation_path \
|
||||
}\
|
||||
\
|
||||
py39_byte_compile () {\
|
||||
python_binary="%1"\
|
||||
python_binary="env PYTHONHASHSEED=0 %1"\
|
||||
bytecode_compilation_path="%2"\
|
||||
$python_binary -s -B -m compileall -o 0 -o 1 -s $RPM_BUILD_ROOT -p / $bytecode_compilation_path \
|
||||
}\
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Name: python-rpm-macros
|
||||
Version: 3.9
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: The common Python RPM macros
|
||||
|
||||
# macros and lua: MIT, compileall2.py: PSFv2
|
||||
|
@ -107,6 +107,9 @@ install -m 644 compileall2.py %{buildroot}%{_rpmconfigdir}/redhat/
|
|||
|
||||
|
||||
%changelog
|
||||
* Fri Jul 24 2020 Lumír Balhar <lbalhar@redhat.com> - 3.9-8
|
||||
- Disable Python hash seed randomization in %%py_byte_compile
|
||||
|
||||
* Tue Jul 21 2020 Lumír Balhar <lbalhar@redhat.com> - 3.9-7
|
||||
- Make %%py3_dist respect %%python3_pkgversion
|
||||
|
||||
|
|
Loading…
Reference in New Issue