Accepting request 821366 from home:gmbr3:Active

- Spec file fixes
- Re-added subprocess-raise-timeout.patch: now compatible
- Removed bpo34022-stop_hash-based_invalidation_w_SOURCE_DATE_EPOCH.patch: contained in upstream

OBS-URL: https://build.opensuse.org/request/show/821366
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python39?expand=0&rev=10
This commit is contained in:
Tomáš Chvátal 2020-07-17 06:40:44 +00:00 committed by Git OBS Bridge
parent 3049a47ee1
commit 9809d09b33
4 changed files with 33 additions and 140 deletions

View File

@ -1,130 +0,0 @@
From 2c096b513273a758b446405d9e5efe4860af1036 Mon Sep 17 00:00:00 2001
From: Elvis Pranskevichus <elvis@magic.io>
Date: Thu, 27 Sep 2018 13:05:14 -0400
Subject: [PATCH] bpo-34022: Stop forcing of hash-based invalidation with
SOURCE_DATE_EPOCH
Unconditional forcing of ``CHECKED_HASH`` invalidation was introduced in
3.7.0 in bpo-29708. The change is bad, as it unconditionally overrides
*invalidation_mode*, even if it was passed as an explicit argument to
``py_compile.compile()`` or ``compileall``. An environment variable
should *never* override an explicit argument to a library function.
That change leads to multiple test failures if the ``SOURCE_DATE_EPOCH``
environment variable is set.
This changes ``py_compile.compile()`` to only look at
``SOURCE_DATE_EPOCH`` if no explicit *invalidation_mode* was specified.
I also made various relevant tests run with explicit control over the
value of ``SOURCE_DATE_EPOCH``.
While looking at this, I noticed that ``zipimport`` does not work
with hash-based .pycs _at all_, though I left the fixes for
subsequent commits.
---
Doc/library/compileall.rst | 11 ++--
Doc/library/py_compile.rst | 13 ++--
Lib/compileall.py | 20 ++++--
Lib/py_compile.py | 13 +++-
Lib/test/test_compileall.py | 50 ++++++++++++--
.../test_importlib/source/test_file_loader.py | 15 +++++
Lib/test/test_py_compile.py | 66 +++++++++++++++++--
.../2018-09-27-13-14-15.bpo-34022.E2cl0r.rst | 3 +
8 files changed, 161 insertions(+), 30 deletions(-)
create mode 100644 Misc/NEWS.d/next/Library/2018-09-27-13-14-15.bpo-34022.E2cl0r.rst
--- a/Doc/library/py_compile.rst
+++ b/Doc/library/py_compile.rst
@@ -92,6 +92,11 @@ byte-code cache files in the directory c
.. versionchanged:: 3.8
The *quiet* parameter was added.
+ .. versionchanged:: 3.7.2
+ The :envvar:`SOURCE_DATE_EPOCH` environment variable no longer
+ overrides the value of the *invalidation_mode* argument, and determines
+ its default value instead.
+
.. class:: PycInvalidationMode
--- a/Lib/test/test_compileall.py
+++ b/Lib/test/test_compileall.py
@@ -396,6 +396,21 @@ class CompileallTestsWithoutSourceEpoch(
pass
+
+class CompileallTestsWithSourceEpoch(CompileallTestsBase,
+ unittest.TestCase,
+ metaclass=SourceDateEpochTestMeta,
+ source_date_epoch=True):
+ pass
+
+
+class CompileallTestsWithoutSourceEpoch(CompileallTestsBase,
+ unittest.TestCase,
+ metaclass=SourceDateEpochTestMeta,
+ source_date_epoch=False):
+ pass
+
+
class EncodingTest(unittest.TestCase):
"""Issue 6716: compileall should escape source code when printing errors
to stdout."""
--- a/Lib/test/test_importlib/source/test_file_loader.py
+++ b/Lib/test/test_importlib/source/test_file_loader.py
@@ -22,6 +22,9 @@ from test.support import make_legacy_pyc
from test.test_py_compile import without_source_date_epoch
from test.test_py_compile import SourceDateEpochTestMeta
+from test.test_py_compile import without_source_date_epoch
+from test.test_py_compile import SourceDateEpochTestMeta
+
class SimpleTest(abc.LoaderTests):
@@ -363,6 +366,17 @@ class SimpleTest(abc.LoaderTests):
class SourceDateEpochTestMeta(SourceDateEpochTestMeta,
+ type(Source_SimpleTest)):
+ pass
+
+
+class SourceDateEpoch_SimpleTest(Source_SimpleTest,
+ metaclass=SourceDateEpochTestMeta,
+ source_date_epoch=True):
+ pass
+
+
+class SourceDateEpochTestMeta(SourceDateEpochTestMeta,
type(Source_SimpleTest)):
pass
--- a/Lib/test/test_py_compile.py
+++ b/Lib/test/test_py_compile.py
@@ -216,5 +216,19 @@ class PyCompileTestsWithoutSourceEpoch(P
pass
+class PyCompileTestsWithSourceEpoch(PyCompileTestsBase,
+ unittest.TestCase,
+ metaclass=SourceDateEpochTestMeta,
+ source_date_epoch=True):
+ pass
+
+
+class PyCompileTestsWithoutSourceEpoch(PyCompileTestsBase,
+ unittest.TestCase,
+ metaclass=SourceDateEpochTestMeta,
+ source_date_epoch=False):
+ pass
+
+
if __name__ == "__main__":
unittest.main()
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2018-09-27-13-14-15.bpo-34022.E2cl0r.rst
@@ -0,0 +1,3 @@
+The :envvar:`SOURCE_DATE_EPOCH` environment variable no longer overrides the
+value of the *invalidation_mode* argument to :func:`py_compile.compile`, and
+determines its default value instead.

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jul 16 21:45:50 UTC 2020 - Callum Farmer <callumjfarmer13@gmail.com>
- Spec file fixes
- Re-added subprocess-raise-timeout.patch: now compatible
- Removed bpo34022-stop_hash-based_invalidation_w_SOURCE_DATE_EPOCH.patch: contained in upstream
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jul 15 09:10:42 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com> Wed Jul 15 09:10:42 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>

View File

@ -1,5 +1,5 @@
# #
# spec file for package python38 # spec file for package python39
# #
# Copyright (c) 2020 SUSE LLC # Copyright (c) 2020 SUSE LLC
# #
@ -49,7 +49,7 @@
%else %else
%define tarversion %{version} %define tarversion %{version}
%endif %endif
%define python_pkg_name python38 %define python_pkg_name python39
# Will provide the pyton3-* provides # Will provide the pyton3-* provides
# Will do the /usr/bin/python3 and all the core links # Will do the /usr/bin/python3 and all the core links
%define primary_interpreter 0 %define primary_interpreter 0
@ -124,11 +124,10 @@ Patch07: python-3.3.0b1-localpath.patch
Patch08: python-3.3.0b1-fix_date_time_compiler.patch Patch08: python-3.3.0b1-fix_date_time_compiler.patch
# POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test # POSIX_FADV_WILLNEED throws EINVAL. Use a different constant in test
Patch09: python-3.3.0b1-test-posix_fadvise.patch Patch09: python-3.3.0b1-test-posix_fadvise.patch
# Raise timeout value for test_subprocess
Patch15: subprocess-raise-timeout.patch
# skip some tests only for PowerPC # skip some tests only for PowerPC
Patch23: skip_random_failing_tests.patch Patch23: skip_random_failing_tests.patch
# Fix SOURCE_DATE_EPOCH problems (bpo#34022, bpo#29708)
# gh#python/cpython#10775 gh#python/cpython#10327
Patch24: bpo34022-stop_hash-based_invalidation_w_SOURCE_DATE_EPOCH.patch
Patch25: python3-imp-returntype.patch Patch25: python3-imp-returntype.patch
# PATCH-FIX-UPSTREAM CVE-2019-5010-null-defer-x509-cert-DOS.patch bnc#1122191 mcepl@suse.com # PATCH-FIX-UPSTREAM CVE-2019-5010-null-defer-x509-cert-DOS.patch bnc#1122191 mcepl@suse.com
# https://github.com/python/cpython/pull/11569 # https://github.com/python/cpython/pull/11569
@ -385,10 +384,10 @@ other applications.
%patch07 -p1 %patch07 -p1
%patch08 -p1 %patch08 -p1
%patch09 -p1 %patch09 -p1
%patch15 -p1
%ifarch ppc ppc64 ppc64le %ifarch ppc ppc64 ppc64le
%patch23 -p1 %patch23 -p1
%endif %endif
%patch24 -p1
%patch25 -p1 %patch25 -p1
%patch27 -p1 %patch27 -p1
%patch29 -p1 %patch29 -p1
@ -439,6 +438,7 @@ sed -e 's/-fprofile-correction//' -i Makefile.pre.in
%endif %endif
%configure \ %configure \
--with-platlibdir=%{_lib} \
--docdir=%{_docdir}/python \ --docdir=%{_docdir}/python \
--enable-ipv6 \ --enable-ipv6 \
--enable-shared \ --enable-shared \
@ -555,7 +555,7 @@ for module in \
ensurepip html http \ ensurepip html http \
importlib json logging multiprocessing pydoc_data unittest \ importlib json logging multiprocessing pydoc_data unittest \
urllib venv wsgiref lib2to3 test turtledemo \ urllib venv wsgiref lib2to3 test turtledemo \
xml xmlrpc xml xmlrpc zoneinfo
do do
rm -r %{buildroot}%{sitedir}/$module rm -r %{buildroot}%{sitedir}/$module
done done
@ -569,7 +569,7 @@ for library in \
_statistics _struct syslog termios _testbuffer _testimportmultiple \ _statistics _struct syslog termios _testbuffer _testimportmultiple \
_testmultiphase unicodedata zlib _ctypes_test _testinternalcapi _testcapi xxlimited \ _testmultiphase unicodedata zlib _ctypes_test _testinternalcapi _testcapi xxlimited \
_xxtestfuzz _xxsubinterpreters _elementtree pyexpat _md5 _sha1 \ _xxtestfuzz _xxsubinterpreters _elementtree pyexpat _md5 _sha1 \
_sha256 _sha512 _blake2 _sha3 _uuid _sha256 _sha512 _blake2 _sha3 _uuid _zoneinfo
do do
eval rm "%{buildroot}%{sitedir}/lib-dynload/$library.*" eval rm "%{buildroot}%{sitedir}/lib-dynload/$library.*"
done done
@ -632,7 +632,7 @@ ln -sf python%{python_version} %{buildroot}%{_bindir}/python3
%if !%{primary_interpreter} %if !%{primary_interpreter}
# base # base
rm %{buildroot}%{_bindir}/python3 rm %{buildroot}%{_bindir}/python3
rm %{buildroot}%{_bindir}/pydocs3 rm %{buildroot}%{_bindir}/pydoc3
rm %{buildroot}%{_mandir}/man1/python3.1 rm %{buildroot}%{_mandir}/man1/python3.1
# devel # devel
rm %{buildroot}%{_bindir}/python3-config rm %{buildroot}%{_bindir}/python3-config
@ -648,7 +648,7 @@ rm %{buildroot}%{_bindir}/idle3*
# delete the generic 2to3 binary if we are not primary # delete the generic 2to3 binary if we are not primary
%if !%{primary_interpreter} %if !%{primary_interpreter}
rm %{buildroot}%{_bindir}2to3 rm %{buildroot}%{_bindir}/2to3
%endif %endif
# replace duplicate .pyo/.pyc with hardlinks # replace duplicate .pyo/.pyc with hardlinks
@ -895,6 +895,7 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo
%{dynlib _xxsubinterpreters} %{dynlib _xxsubinterpreters}
%{dynlib _xxtestfuzz} %{dynlib _xxtestfuzz}
%{dynlib zlib} %{dynlib zlib}
%{dynlib _zoneinfo}
# hashlib fallback modules # hashlib fallback modules
%{dynlib _blake2} %{dynlib _blake2}
%{dynlib _md5} %{dynlib _md5}
@ -934,13 +935,16 @@ echo %{sitedir}/_import_failed > %{buildroot}/%{sitedir}/site-packages/zzzz-impo
%{sitedir}/wsgiref %{sitedir}/wsgiref
%{sitedir}/xml %{sitedir}/xml
%{sitedir}/xmlrpc %{sitedir}/xmlrpc
%{sitedir}/zoneinfo
%{sitedir}/__pycache__ %{sitedir}/__pycache__
# import-failed hooks # import-failed hooks
%{sitedir}/_import_failed %{sitedir}/_import_failed
%{sitedir}/site-packages/zzzz-import-failed-hooks.pth %{sitedir}/site-packages/zzzz-import-failed-hooks.pth
# symlinks # symlinks
%if %{primary_interpreter}
%{_bindir}/python3 %{_bindir}/python3
%{_bindir}/pydoc3 %{_bindir}/pydoc3
%endif
# executables # executables
%attr(755, root, root) %{_bindir}/pydoc%{python_version} %attr(755, root, root) %{_bindir}/pydoc%{python_version}
# %attr(755, root, root) %{_bindir}/python%{python_abi} # %attr(755, root, root) %{_bindir}/python%{python_abi}

View File

@ -0,0 +1,12 @@
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -230,7 +230,8 @@
"time.sleep(3600)"],
# Some heavily loaded buildbots (sparc Debian 3.x) require
# this much time to start and print.
- timeout=3)
+ # OBS might require even more
+ timeout=10)
self.fail("Expected TimeoutExpired.")
self.assertEqual(c.exception.output, b'BDFL')