Bug 2133850

Summary: Downstream-only patch in Python 3: #328 Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild
Product: [Fedora] Fedora Reporter: Tomas Orsava <torsava>
Component: python3.12Assignee: Miro Hrončok <mhroncok>
Status: CLOSED RAWHIDE QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: cstratak, mhroncok, pviktori, python-maint, python-packagers-sig, thrnciar, torsava, vstinner
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python3.12-3.12.0~a3-2.fc38 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-01-06 14:23:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tomas Orsava 2022-10-11 15:08:34 UTC
From python3.11.spec:

# 00328 # 318e500c98f5e59eb1f23e0fcd32db69b9bd17e1
# Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild
#
# Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
# %%changelog date. This makes Python default to the CHECKED_HASH pyc
# invalidation mode, bringing more reproducible builds traded for an import
# performance decrease. To avoid that, we don't default to CHECKED_HASH
# when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).
#
# See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
# Downstream only: only used when building RPM packages
# Ideally, we should talk to upstream and explain why we don't want this
Patch328: 00328-pyc-timestamp-invalidation-mode.patch

Comment 1 Tomas Orsava 2022-10-11 15:10:47 UTC
Previously tracked in BZ#1287556.

Comment 2 Petr Viktorin (pviktori) 2022-10-12 12:26:49 UTC
This should be solved by __pysource__, if accepted upstream: https://discuss.python.org/t/pysource-file-layout-for-installed-modules/14594

Comment 3 Miro Hrončok 2022-12-19 11:01:58 UTC
I figured out we can pass --invalidation-mode=timestamp to compilall when we byte-compile explicitly and we don't need to care about other use cases that much.

See https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/154 and https://src.fedoraproject.org/rpms/python3.12/pull-request/17