From a9616921bfd2168935c68fbb8b3815147f0bd955 Mon Sep 17 00:00:00 2001 From: liuxiaoping Date: Fri, 23 Jun 2023 10:44:30 +0800 Subject: [PATCH 1/2] update to python3x-pip-19.3.1-6.module+el8.7.0+15823+8950cfa7 --- ...se-pip-loongarch.conf-on-loongarch64.patch | 50 ----------- download | 2 +- fix-tmpdir-infinite-recursion.patch | 84 +++++++++++++++++++ pip-loongarch.conf | 8 -- python3x-pip.spec | 21 ++--- 5 files changed, 94 insertions(+), 71 deletions(-) delete mode 100644 0001-use-pip-loongarch.conf-on-loongarch64.patch create mode 100644 fix-tmpdir-infinite-recursion.patch delete mode 100644 pip-loongarch.conf diff --git a/0001-use-pip-loongarch.conf-on-loongarch64.patch b/0001-use-pip-loongarch.conf-on-loongarch64.patch deleted file mode 100644 index 2e22a76..0000000 --- a/0001-use-pip-loongarch.conf-on-loongarch64.patch +++ /dev/null @@ -1,50 +0,0 @@ -From db095b8f44332d2418aed63c745ffe117bee09c0 Mon Sep 17 00:00:00 2001 -From: Jingyun Hua -Date: Tue, 26 Jul 2022 02:40:38 +0000 -Subject: [PATCH] use pip-loongarch.conf on loongarch64. - -Signed-off-by: Jingyun Hua ---- - src/pip/_internal/configuration.py | 12 +++++++++++- - 1 file changed, 11 insertions(+), 1 deletion(-) - -diff --git a/src/pip/_internal/configuration.py b/src/pip/_internal/configuration.py -index 858c660..1d9709a 100644 ---- a/src/pip/_internal/configuration.py -+++ b/src/pip/_internal/configuration.py -@@ -19,6 +19,7 @@ import locale - import logging - import os - import sys -+import platform - - from pip._vendor.six.moves import configparser - -@@ -76,6 +77,7 @@ kinds = enum( - - CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf' - -+os_arch = platform.machine() - - def get_configuration_files(): - global_config_files = [ -@@ -84,7 +86,15 @@ def get_configuration_files(): - ] - - site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) -- legacy_config_file = os.path.join( -+ -+ if os_arch == 'loongarch64': -+ user_conf = os.path.join(expanduser('~'),'.pip/pip.conf') -+ if os.path.exists(user_conf): -+ legacy_config_file = user_conf -+ else: -+ legacy_config_file = '/etc/pip38/pip-loongarch.conf' -+ else: -+ legacy_config_file = os.path.join( - expanduser('~'), - 'pip' if WINDOWS else '.pip', - CONFIG_BASENAME, --- -2.27.0 - diff --git a/download b/download index 26f6062..1196369 100644 --- a/download +++ b/download @@ -1 +1 @@ -709cb7d682ad58a446d274807c9af731 pip-19.3.1.tar.gz +709cb7d682ad58a446d274807c9af731 pip-19.3.1.tar.gz diff --git a/fix-tmpdir-infinite-recursion.patch b/fix-tmpdir-infinite-recursion.patch new file mode 100644 index 0000000..c27ebb2 --- /dev/null +++ b/fix-tmpdir-infinite-recursion.patch @@ -0,0 +1,84 @@ +diff -up pip-19.3.1/news/7872.bugfix.pip7873 pip-19.3.1/news/7872.bugfix +--- pip-19.3.1/news/7872.bugfix.pip7873 2022-05-24 08:34:03.285054864 -0600 ++++ pip-19.3.1/news/7872.bugfix 2022-05-24 08:34:03.285054864 -0600 +@@ -0,0 +1 @@ ++Prevent an infinite recursion with ``pip wheel`` when ``$TMPDIR`` is within the source directory. +diff -up pip-19.3.1/src/pip/_internal/download.py.pip7873 pip-19.3.1/src/pip/_internal/download.py +--- pip-19.3.1/src/pip/_internal/download.py.pip7873 2019-10-17 13:32:34.000000000 -0600 ++++ pip-19.3.1/src/pip/_internal/download.py 2022-05-24 08:35:17.013833331 -0600 +@@ -350,12 +350,24 @@ def _copy2_ignoring_special_files(src, d + + def _copy_source_tree(source, target): + # type: (str, str) -> None ++ target_abspath = os.path.abspath(target) ++ target_basename = os.path.basename(target_abspath) ++ target_dirname = os.path.dirname(target_abspath) ++ + def ignore(d, names): +- # Pulling in those directories can potentially be very slow, +- # exclude the following directories if they appear in the top +- # level dir (and only it). +- # See discussion at https://github.com/pypa/pip/pull/6770 +- return ['.tox', '.nox'] if d == source else [] ++ skipped = [] # type: List[str] ++ if d == source: ++ # Pulling in those directories can potentially be very slow, ++ # exclude the following directories if they appear in the top ++ # level dir (and only it). ++ # See discussion at https://github.com/pypa/pip/pull/6770 ++ skipped += ['.tox', '.nox'] ++ if os.path.abspath(d) == target_dirname: ++ # Prevent an infinite recursion if the target is in source. ++ # This can happen when TMPDIR is set to ${PWD}/... ++ # and we copy PWD to TMPDIR. ++ skipped += [target_basename] ++ return skipped + + kwargs = dict(ignore=ignore, symlinks=True) # type: CopytreeKwargs + +diff -up pip-19.3.1/src/pip/_internal/operations/prepare.py.pip7873 pip-19.3.1/src/pip/_internal/operations/prepare.py +diff -up pip-19.3.1/tests/data/src/extension/extension.c.pip7873 pip-19.3.1/tests/data/src/extension/extension.c +diff -up pip-19.3.1/tests/data/src/extension/setup.py.pip7873 pip-19.3.1/tests/data/src/extension/setup.py +--- pip-19.3.1/tests/data/src/extension/setup.py.pip7873 2022-05-24 08:34:03.285054864 -0600 ++++ pip-19.3.1/tests/data/src/extension/setup.py 2022-05-24 08:34:03.285054864 -0600 +@@ -0,0 +1,4 @@ ++from setuptools import Extension, setup ++ ++module = Extension('extension', sources=['extension.c']) ++setup(name='extension', version='0.0.1', ext_modules = [module]) +diff -up pip-19.3.1/tests/functional/test_wheel.py.pip7873 pip-19.3.1/tests/functional/test_wheel.py +--- pip-19.3.1/tests/functional/test_wheel.py.pip7873 2019-10-17 13:32:34.000000000 -0600 ++++ pip-19.3.1/tests/functional/test_wheel.py 2022-05-24 08:34:03.285054864 -0600 +@@ -1,6 +1,7 @@ + """'pip wheel' tests""" + import os + import re ++import sys + from os.path import exists + + import pytest +@@ -228,6 +229,24 @@ def test_pip_wheel_with_user_set_in_conf + assert "Successfully built withpyproject" in result.stdout, result.stdout + + ++@pytest.mark.skipif(sys.platform.startswith('win'), ++ reason='The empty extension module does not work on Win') ++def test_pip_wheel_ext_module_with_tmpdir_inside(script, data, common_wheels): ++ tmpdir = data.src / 'extension/tmp' ++ tmpdir.mkdir() ++ script.environ['TMPDIR'] = str(tmpdir) ++ ++ # To avoid a test dependency on a C compiler, we set the env vars to "noop" ++ # The .c source is empty anyway ++ script.environ['CC'] = script.environ['LDSHARED'] = str('true') ++ ++ result = script.pip( ++ 'wheel', data.src / 'extension', ++ '--no-index', '-f', common_wheels ++ ) ++ assert "Successfully built extension" in result.stdout, result.stdout ++ ++ + @pytest.mark.network + def test_pep517_wheels_are_not_confused_with_other_files(script, tmpdir, data): + """Check correct wheels are copied. (#6196) diff --git a/pip-loongarch.conf b/pip-loongarch.conf deleted file mode 100644 index fd77def..0000000 --- a/pip-loongarch.conf +++ /dev/null @@ -1,8 +0,0 @@ -[global] -timeout = 60 -index-url = https://pypi.loongnix.cn/loongson/pypi -extra-index-url = https://pypi.org/simple -[install] -trusted-host = - pypi.loongnix.cn - pypi.org diff --git a/python3x-pip.spec b/python3x-pip.spec index 9bae93c..e0c1a4f 100644 --- a/python3x-pip.spec +++ b/python3x-pip.spec @@ -11,13 +11,12 @@ %endif %global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null) -%define anolis_release .0.1 Name: python3x-%{srcname} # When updating, update the bundled libraries versions bellow! # You can use vendor_meta.sh in the dist git repo Version: 19.3.1 -Release: 5%{anolis_release}%{?dist} +Release: 6%{?dist} Summary: A tool for installing and managing Python packages # We bundle a lot of libraries with pip, which itself is under MIT license. @@ -71,8 +70,6 @@ Source1: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_com Source2: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz %endif -Source100: pip-loongarch.conf - # Downstream only patch # Emit a warning to the user if pip install is run with root privileges # Issue upstream: https://github.com/pypa/pip/issues/4288 @@ -104,7 +101,10 @@ Patch6: CVE-2021-3572.patch # Upstream fix: https://github.com/urllib3/urllib3/commit/2d4a3fee6de2fa45eb82169361918f759269b4ec Patch7: CVE-2021-33503.patch -Patch1000: 0001-use-pip-loongarch.conf-on-loongarch64.patch +# Prevent infinite recursion with pip wheel with $TMPDIR in $PWD +# https://github.com/pypa/pip/pull/7873 +Patch8: fix-tmpdir-infinite-recursion.patch + # Downstream only patch # Users might have local installations of pip from using # `pip install --user --upgrade pip` on older/newer versions. @@ -260,7 +260,7 @@ popd %patch5 -p1 %patch6 -p1 %patch7 -p1 -%patch1000 -p1 +%patch8 -p1 # this goes together with patch4 rm src/pip/_vendor/certifi/*.pem @@ -297,9 +297,6 @@ rm docs/build/html/.buildinfo --root %{buildroot} \ --no-deps -install -d %{buildroot}%{_sysconfdir}/pip38 -install %{SOURCE100} %{buildroot}%{_sysconfdir}/pip38 - %if %{with doc} pushd docs/build/man install -d %{buildroot}%{_mandir}/man1 @@ -409,7 +406,6 @@ fi %{_bindir}/pip%{python3_version} %{_bindir}/pip-%{python3_version} %{python3_sitelib}/pip* -%{_sysconfdir}/pip38/* %dir %{bashcompdir} %{bashcompdir}/pip3.8 %ghost %{_bindir}/pip3 @@ -429,8 +425,9 @@ fi %{python_wheeldir}/%{python_wheelname} %changelog -* Fri Jul 22 2022 huajingyun - 19.3.1-5.0.1 -- Add pypi.loongnix.cn +* Tue May 24 2022 Orion Poplawski - 19.3.1-6 +- Backport patch to fix infinite recursion with pip wheel with $TMPDIR in $PWD +- Resolves: rhbz#2090006 * Thu Oct 14 2021 Charalampos Stratakis - 19.3.1-5 - Remove bundled windows executables -- Gitee From cdffcdcc0c148860525a6abf3adab8b2ca56d4c9 Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Mon, 25 Jul 2022 03:36:07 +0000 Subject: [PATCH 2/2] Default use pypi.loongnix.cn on loongarch64 Signed-off-by: Jingyun Hua # Conflicts: # python3x-pip.spec --- ...se-pip-loongarch.conf-on-loongarch64.patch | 50 +++++++++++++++++++ pip-loongarch.conf | 8 +++ python3x-pip.spec | 14 +++++- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 0001-use-pip-loongarch.conf-on-loongarch64.patch create mode 100644 pip-loongarch.conf diff --git a/0001-use-pip-loongarch.conf-on-loongarch64.patch b/0001-use-pip-loongarch.conf-on-loongarch64.patch new file mode 100644 index 0000000..2e22a76 --- /dev/null +++ b/0001-use-pip-loongarch.conf-on-loongarch64.patch @@ -0,0 +1,50 @@ +From db095b8f44332d2418aed63c745ffe117bee09c0 Mon Sep 17 00:00:00 2001 +From: Jingyun Hua +Date: Tue, 26 Jul 2022 02:40:38 +0000 +Subject: [PATCH] use pip-loongarch.conf on loongarch64. + +Signed-off-by: Jingyun Hua +--- + src/pip/_internal/configuration.py | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/src/pip/_internal/configuration.py b/src/pip/_internal/configuration.py +index 858c660..1d9709a 100644 +--- a/src/pip/_internal/configuration.py ++++ b/src/pip/_internal/configuration.py +@@ -19,6 +19,7 @@ import locale + import logging + import os + import sys ++import platform + + from pip._vendor.six.moves import configparser + +@@ -76,6 +77,7 @@ kinds = enum( + + CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf' + ++os_arch = platform.machine() + + def get_configuration_files(): + global_config_files = [ +@@ -84,7 +86,15 @@ def get_configuration_files(): + ] + + site_config_file = os.path.join(sys.prefix, CONFIG_BASENAME) +- legacy_config_file = os.path.join( ++ ++ if os_arch == 'loongarch64': ++ user_conf = os.path.join(expanduser('~'),'.pip/pip.conf') ++ if os.path.exists(user_conf): ++ legacy_config_file = user_conf ++ else: ++ legacy_config_file = '/etc/pip38/pip-loongarch.conf' ++ else: ++ legacy_config_file = os.path.join( + expanduser('~'), + 'pip' if WINDOWS else '.pip', + CONFIG_BASENAME, +-- +2.27.0 + diff --git a/pip-loongarch.conf b/pip-loongarch.conf new file mode 100644 index 0000000..fd77def --- /dev/null +++ b/pip-loongarch.conf @@ -0,0 +1,8 @@ +[global] +timeout = 60 +index-url = https://pypi.loongnix.cn/loongson/pypi +extra-index-url = https://pypi.org/simple +[install] +trusted-host = + pypi.loongnix.cn + pypi.org diff --git a/python3x-pip.spec b/python3x-pip.spec index e0c1a4f..66aa1b1 100644 --- a/python3x-pip.spec +++ b/python3x-pip.spec @@ -11,12 +11,13 @@ %endif %global bashcompdir %(pkg-config --variable=completionsdir bash-completion 2>/dev/null) +%define anolis_release .0.1 Name: python3x-%{srcname} # When updating, update the bundled libraries versions bellow! # You can use vendor_meta.sh in the dist git repo Version: 19.3.1 -Release: 6%{?dist} +Release: 6%{anolis_release}%{?dist} Summary: A tool for installing and managing Python packages # We bundle a lot of libraries with pip, which itself is under MIT license. @@ -70,6 +71,8 @@ Source1: https://github.com/pypa/pypa-docs-theme/archive/%{pypa_theme_com Source2: https://github.com/python/python-docs-theme/archive/2018.2.tar.gz %endif +Source100: pip-loongarch.conf + # Downstream only patch # Emit a warning to the user if pip install is run with root privileges # Issue upstream: https://github.com/pypa/pip/issues/4288 @@ -105,6 +108,7 @@ Patch7: CVE-2021-33503.patch # https://github.com/pypa/pip/pull/7873 Patch8: fix-tmpdir-infinite-recursion.patch +Patch1000: 0001-use-pip-loongarch.conf-on-loongarch64.patch # Downstream only patch # Users might have local installations of pip from using # `pip install --user --upgrade pip` on older/newer versions. @@ -261,6 +265,7 @@ popd %patch6 -p1 %patch7 -p1 %patch8 -p1 +%patch1000 -p1 # this goes together with patch4 rm src/pip/_vendor/certifi/*.pem @@ -297,6 +302,9 @@ rm docs/build/html/.buildinfo --root %{buildroot} \ --no-deps +install -d %{buildroot}%{_sysconfdir}/pip38 +install %{SOURCE100} %{buildroot}%{_sysconfdir}/pip38 + %if %{with doc} pushd docs/build/man install -d %{buildroot}%{_mandir}/man1 @@ -406,6 +414,7 @@ fi %{_bindir}/pip%{python3_version} %{_bindir}/pip-%{python3_version} %{python3_sitelib}/pip* +%{_sysconfdir}/pip38/* %dir %{bashcompdir} %{bashcompdir}/pip3.8 %ghost %{_bindir}/pip3 @@ -425,6 +434,9 @@ fi %{python_wheeldir}/%{python_wheelname} %changelog +* Fri Jun 23 2023 huajingyun - 19.3.1-6.0.1 +- Add pypi.loongnix.cn + * Tue May 24 2022 Orion Poplawski - 19.3.1-6 - Backport patch to fix infinite recursion with pip wheel with $TMPDIR in $PWD - Resolves: rhbz#2090006 -- Gitee