#35 F30 master merge
Merged 2 months ago by churchyard. Opened 2 months ago by churchyard.

@@ -0,0 +1,55 @@ 

+ From 746a45acd333174c3174230833b45f537bd92889 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>

+ Date: Thu, 11 Jul 2019 13:44:13 +0200

+ Subject: [PATCH] 00328: 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

+ ---

+  Lib/py_compile.py           | 3 ++-

+  Lib/test/test_py_compile.py | 2 ++

+  2 files changed, 4 insertions(+), 1 deletion(-)

+ 

+ diff --git a/Lib/py_compile.py b/Lib/py_compile.py

+ index 21736896af..310bed5620 100644

+ --- a/Lib/py_compile.py

+ +++ b/Lib/py_compile.py

+ @@ -70,7 +70,8 @@ class PycInvalidationMode(enum.Enum):

+  

+  

+  def _get_default_invalidation_mode():

+ -    if os.environ.get('SOURCE_DATE_EPOCH'):

+ +    if (os.environ.get('SOURCE_DATE_EPOCH') and not

+ +            os.environ.get('RPM_BUILD_ROOT')):

+          return PycInvalidationMode.CHECKED_HASH

+      else:

+          return PycInvalidationMode.TIMESTAMP

+ diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py

+ index d6677ab45f..88059b127e 100644

+ --- a/Lib/test/test_py_compile.py

+ +++ b/Lib/test/test_py_compile.py

+ @@ -17,6 +17,7 @@ def without_source_date_epoch(fxn):

+      def wrapper(*args, **kwargs):

+          with support.EnvironmentVarGuard() as env:

+              env.unset('SOURCE_DATE_EPOCH')

+ +            env.unset('RPM_BUILD_ROOT')

+              return fxn(*args, **kwargs)

+      return wrapper

+  

+ @@ -27,6 +28,7 @@ def with_source_date_epoch(fxn):

+      def wrapper(*args, **kwargs):

+          with support.EnvironmentVarGuard() as env:

+              env['SOURCE_DATE_EPOCH'] = '123456789'

+ +            env.unset('RPM_BUILD_ROOT')

+              return fxn(*args, **kwargs)

+      return wrapper

+  

+ -- 

+ 2.21.0

+ 

file modified
+96 -31

@@ -198,6 +198,9 @@ 

  # workaround http://bugs.python.org/issue19804 (test_uuid requires ifconfig)

  BuildRequires: /usr/sbin/ifconfig

  

+ # For %%python_provide

+ BuildRequires: python-rpm-macros

+ 

  %if %{with rpmwheels}

  BuildRequires: python-setuptools-wheel

  BuildRequires: python-pip-wheel

@@ -259,6 +262,11 @@ 

  # Upstream uses Debian-style architecture naming. Change to match Fedora.

  Patch274: 00274-fix-arch-names.patch

  

+ # 00328 #

+ # Restore pyc to TIMESTAMP invalidation mode as default in rpmbubild

+ # See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426

+ Patch328: 00328-pyc-timestamp-invalidation-mode.patch

+ 

  # (New patches go here ^^^)

  #

  # When adding new patches to "python" and "python3" in Fedora, EL, etc.,

@@ -301,6 +309,18 @@ 

  # replace python36-3.6.2.

  Obsoletes: python%{pyshortver}

  

+ # https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

+ # https://fedoraproject.org/wiki/Changes/Python_means_Python3

+ # We recommend /usr/bin/python so users get it by default

+ # Versioned recommends are problematic, and we know that the package requires

+ # python3 back with fixed version, so we just use the path here:

+ Recommends: %{_bindir}/python

+ 

+ # In Fedora 31, /usr/bin/pydoc was moved here from Python 2.

+ # Ideally we'd have an explicit conflict with "/usr/bin/pydoc < 3",

+ # but file provides aren't versioned and the file moved across packages.

+ # Instead, we rely on the conflict in python3-libs.

+ 

  # Previously, this was required for our rewheel patch to work.

  # This is technically no longer needed, but we keep it recommended

  # for the developer experience.

@@ -336,6 +356,22 @@ 

  the "%{name}-" prefix.

  

  

+ # https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

+ # https://fedoraproject.org/wiki/Changes/Python_means_Python3

+ %package -n python-unversioned-command

+ Summary: The "python" command that runs Python 3

+ BuildArch: noarch

+ 

+ # In theory this could require any python3 version

+ Requires: python3 == %{version}-%{release}

+ # But since we want to provide versioned python, we require exact version

+ Provides: python = %{version}-%{release}

+ # This also save us an explicit conflict for older python3 builds

+ 

+ %description -n python-unversioned-command

+ This package contains /usr/bin/python - the "python" command that runs Python 3.

+ 

+ 

  %package libs

  Summary:        Python runtime libraries

  

@@ -347,12 +383,26 @@ 

  Provides: bundled(python3-setuptools) = 40.8.0

  %endif

  

+ %{?python_provide:%python_provide python3-libs}

+ 

  # There are files in the standard library that have python shebang.

  # We've filtered the automatic requirement out so libs are installable without

  # the main package. This however makes it pulled in by default.

  # See https://bugzilla.redhat.com/show_bug.cgi?id=1547131

  Recommends: %{name}%{?_isa} = %{version}-%{release}

  

+ # https://fedoraproject.org/wiki/Changes/Move_usr_bin_python_into_separate_package

+ # In Fedora 31, several "unversioned" files like /usr/bin/pydoc and all the

+ # "unversioned" provides were moved from python2 to python3.

+ # So, newer python3 packages need to conflict with old Python 2 builds that

+ # still provided unversioned Python.

+ # Since all python packages, new and old, have versioned requires on

+ # python?-libs, we do it here:

+ Conflicts: python-libs < 3

+ # (We explicitly conflict with python-libs and not python2-libs, so only the

+ # old Python 2 builds that still provided unversioned Python are handled.)

+ 

+ 

  %description libs

  This package contains runtime libraries for use by Python:

  - the majority of the Python standard library

@@ -368,6 +418,8 @@ 

  Requires: python-rpm-macros

  Requires: python3-rpm-macros

  

+ %{?python_provide:%python_provide python3-devel}

+ 

  %if %{without bootstrap}

  # This is not "API" (packages that need setuptools should still BuildRequire it)

  # However some packages apparently can build both with and without setuptools

@@ -386,6 +438,10 @@ 

  

  Conflicts: %{name} < %{version}-%{release}

  

+ # In Fedora 31, several "unversioned" files were moved here from Python 2:

+ # pygettext.py, msgfmt.py, python-config, python.pc

+ Conflicts: python-devel < 3

+ 

  %description devel

  This package contains the header files and configuration needed to compile

  Python extension modules (typically written in C or C++), to embed Python

@@ -401,11 +457,17 @@ 

  Requires: %{name}-tkinter = %{version}-%{release}

  

  Provides: idle3 = %{version}-%{release}

+ Provides: idle = %{version}-%{release}

  

  Provides: %{name}-tools = %{version}-%{release}

  Provides: %{name}-tools%{?_isa} = %{version}-%{release}

  Obsoletes: %{name}-tools < %{version}-%{release}

  

+ # In Fedora 31, /usr/bin/idle was moved here from Python 2.

+ Conflicts: python-tools < 3

+ 

+ %{?python_provide:%python_provide python3-idle}

+ 

  %description idle

  IDLE is Python’s Integrated Development and Learning Environment.

  

@@ -423,6 +485,8 @@ 

  Summary: A GUI toolkit for Python

  Requires: %{name} = %{version}-%{release}

  

+ %{?python_provide:%python_provide python3-tkinter}

+ 

  %description tkinter

  The Tkinter (Tk interface) library is a graphical user interface toolkit for

  the Python programming language.

@@ -433,6 +497,8 @@ 

  Requires: %{name} = %{version}-%{release}

  Requires: %{name}-libs%{?_isa} = %{version}-%{release}

  

+ %{?python_provide:%python_provide python3-test}

+ 

  %description test

  The self-test suite for the Python interpreter.

  

@@ -455,6 +521,11 @@ 

  Requires: %{name}-tkinter%{?_isa} = %{version}-%{release}

  Requires: %{name}-idle%{?_isa} = %{version}-%{release}

  

+ # In Fedora 31, /usr/bin/python-debug was moved here from Python 2.

+ Conflicts: python-debug < 3

+ 

+ %{?python_provide:%python_provide python3-debug}

+ 

  %description debug

  python3-debug provides a version of the Python runtime with numerous debugging

  features enabled, aimed at advanced Python users such as developers of Python

@@ -531,6 +602,7 @@ 

  

  %patch251 -p1

  %patch274 -p1

+ %patch328 -p1

  

  

  # Remove files that should be generated by the build

@@ -877,6 +949,20 @@ 

  rm %{buildroot}%{_mandir}/man1/python3.1*

  rm %{buildroot}%{_libdir}/pkgconfig/python3.pc

  rm %{buildroot}%{_libdir}/pkgconfig/python3-embed.pc

+ %else

+ # Link the unversioned stuff

+ # https://fedoraproject.org/wiki/Changes/Python_means_Python3

+ ln -s ./python3 %{buildroot}%{_bindir}/python

+ ln -s ./pydoc3 %{buildroot}%{_bindir}/pydoc

+ ln -s ./pygettext3.py %{buildroot}%{_bindir}/pygettext.py

+ ln -s ./msgfmt3.py %{buildroot}%{_bindir}/msgfmt.py

+ ln -s ./idle3 %{buildroot}%{_bindir}/idle

+ ln -s ./python3-config %{buildroot}%{_bindir}/python-config

+ ln -s ./python3.1 %{buildroot}%{_mandir}/man1/python.1

+ ln -s ./python3.pc %{buildroot}%{_libdir}/pkgconfig/python.pc

+ %if %{with debug_build}

+ ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug

+ %endif

  %endif

  

  

@@ -925,12 +1011,6 @@ 

    ConfName=$1

    ConfDir=$(pwd)/build/$ConfName

  

-   # Fedora sets TLSv1 as explicit minimum version.

-   # Python's test suite assumes that the minimum protocol version is set to

-   # a magic marker. We workaround the test problem by setting:

-   export OPENSSL_CONF=/non-existing-file

-   # https://bugzilla.redhat.com/show_bug.cgi?id=1618753

- 

    echo STARTING: CHECKING OF PYTHON FOR CONFIGURATION: $ConfName

  

    # Note that we're running the tests using the version of the code in the

@@ -990,10 +1070,14 @@ 

  

  %{_bindir}/python%{pybasever}

  %{_bindir}/python%{LDVERSION_optimized}

- %{_mandir}/*/*

+ %{_mandir}/*/*3*

  

  

  %if %{without flatpackage}

+ %files -n python-unversioned-command

+ %{_bindir}/python

+ %{_mandir}/*/python.1*

+ 

  %files libs

  %license LICENSE

  %doc README.rst

@@ -1038,20 +1122,6 @@ 

  %{pylibdir}/ensurepip/_bundled/*.whl

  %endif

  

- # The majority of the test module lives in the test subpackage

- # However test.support is in libs - it contains stuff used when testing your code

- # https://bugzilla.redhat.com/show_bug.cgi?id=596258

- %if %{without flatpackage}

- %dir %{pylibdir}/test/

- %dir %{pylibdir}/test/__pycache__/

- %dir %{pylibdir}/test/support/

- %dir %{pylibdir}/test/support/__pycache__/

- %{pylibdir}/test/__init__.py

- %{pylibdir}/test/__pycache__/__init__%{bytecode_suffixes}

- %{pylibdir}/test/support/*.py

- %{pylibdir}/test/support/__pycache__/*%{bytecode_suffixes}

- %endif

- 

  %dir %{pylibdir}/concurrent/

  %dir %{pylibdir}/concurrent/__pycache__/

  %{pylibdir}/concurrent/*.py

@@ -1246,11 +1316,15 @@ 

  

  %if %{without flatpackage}

  %{_bindir}/python3-config

+ %{_bindir}/python-config

  %{_libdir}/pkgconfig/python3.pc

+ %{_libdir}/pkgconfig/python.pc

  %{_libdir}/pkgconfig/python3-embed.pc

  %{_bindir}/pathfix.py

  %{_bindir}/pygettext3.py

+ %{_bindir}/pygettext.py

  %{_bindir}/msgfmt3.py

+ %{_bindir}/msgfmt.py

  %endif

  

  %{_bindir}/pygettext%{pybasever}.py

@@ -1319,16 +1393,6 @@ 

  %{pylibdir}/tkinter/test

  %{pylibdir}/unittest/test

  

- # stuff already owned by the libs subpackage

- # test requires libs, so we are safe not owning those dirs

- %if %{without flatpackage}

- %exclude %dir %{pylibdir}/test/

- %exclude %dir %{pylibdir}/test/__pycache__/

- %exclude %{pylibdir}/test/__init__.py

- %exclude %{pylibdir}/test/__pycache__/__init__%{bytecode_suffixes}

- %exclude %{pylibdir}/test/support/

- %endif

- 

  # We don't bother splitting the debug build out into further subpackages:

  # if you need it, you're probably a developer.

  

@@ -1339,6 +1403,7 @@ 

  %if %{without flatpackage}

  %files debug

  %{_bindir}/python3-debug

+ %{_bindir}/python-debug

  %endif

  

  # Analog of the core subpackage's files: