|
|
63a509 |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
63a509 |
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
|
|
63a509 |
Date: Thu, 11 Jul 2019 13:44:13 +0200
|
|
|
63a509 |
Subject: [PATCH] 00328: Restore pyc to TIMESTAMP invalidation mode as default
|
|
|
63a509 |
in rpmbuild
|
|
|
63a509 |
|
|
|
63a509 |
Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
|
|
|
63a509 |
%changelog date. This makes Python default to the CHECKED_HASH pyc
|
|
|
63a509 |
invalidation mode, bringing more reproducible builds traded for an import
|
|
|
63a509 |
performance decrease. To avoid that, we don't default to CHECKED_HASH
|
|
|
63a509 |
when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).
|
|
|
63a509 |
|
|
|
63a509 |
See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
|
|
|
63a509 |
Downstream only: only used when building RPM packages
|
|
|
63a509 |
Ideally, we should talk to upstream and explain why we don't want this
|
|
|
63a509 |
---
|
|
|
63a509 |
Lib/py_compile.py | 3 ++-
|
|
|
63a509 |
Lib/test/test_py_compile.py | 2 ++
|
|
|
63a509 |
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
63a509 |
|
|
|
63a509 |
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
|
|
|
63a509 |
index a81f493731..bba3642bf2 100644
|
|
|
63a509 |
--- a/Lib/py_compile.py
|
|
|
63a509 |
+++ b/Lib/py_compile.py
|
|
|
63a509 |
@@ -70,7 +70,8 @@ class PycInvalidationMode(enum.Enum):
|
|
|
63a509 |
|
|
|
63a509 |
|
|
|
63a509 |
def _get_default_invalidation_mode():
|
|
|
63a509 |
- if os.environ.get('SOURCE_DATE_EPOCH'):
|
|
|
63a509 |
+ if (os.environ.get('SOURCE_DATE_EPOCH') and not
|
|
|
63a509 |
+ os.environ.get('RPM_BUILD_ROOT')):
|
|
|
63a509 |
return PycInvalidationMode.CHECKED_HASH
|
|
|
63a509 |
else:
|
|
|
63a509 |
return PycInvalidationMode.TIMESTAMP
|
|
|
63a509 |
diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py
|
|
|
63a509 |
index e6791c6916..b2d3dcf7fb 100644
|
|
|
63a509 |
--- a/Lib/test/test_py_compile.py
|
|
|
63a509 |
+++ b/Lib/test/test_py_compile.py
|
|
|
63a509 |
@@ -19,6 +19,7 @@ def without_source_date_epoch(fxn):
|
|
|
63a509 |
def wrapper(*args, **kwargs):
|
|
|
63a509 |
with support.EnvironmentVarGuard() as env:
|
|
|
63a509 |
env.unset('SOURCE_DATE_EPOCH')
|
|
|
63a509 |
+ env.unset('RPM_BUILD_ROOT')
|
|
|
63a509 |
return fxn(*args, **kwargs)
|
|
|
63a509 |
return wrapper
|
|
|
63a509 |
|
|
|
63a509 |
@@ -29,6 +30,7 @@ def with_source_date_epoch(fxn):
|
|
|
63a509 |
def wrapper(*args, **kwargs):
|
|
|
63a509 |
with support.EnvironmentVarGuard() as env:
|
|
|
63a509 |
env['SOURCE_DATE_EPOCH'] = '123456789'
|
|
|
63a509 |
+ env.unset('RPM_BUILD_ROOT')
|
|
|
63a509 |
return fxn(*args, **kwargs)
|
|
|
63a509 |
return wrapper
|
|
|
63a509 |
|