From c6115a7f58bddaabface65f654d56a01512d73d1 Mon Sep 17 00:00:00 2001 From: Honza Horak Date: Fri, 23 Jul 2021 09:14:00 +0200 Subject: [PATCH] Fix problem with python version in the byte compilation script Resolves: #1984598 --- ...ke-the-python3-be-the-default-choice.patch | 32 +++++++++++++++++++ 0001-Replace-__python-with-__python3.patch | 31 ++++++++++++++++++ scl-utils.spec | 8 ++++- 3 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 0001-Make-the-python3-be-the-default-choice.patch create mode 100644 0001-Replace-__python-with-__python3.patch diff --git a/0001-Make-the-python3-be-the-default-choice.patch b/0001-Make-the-python3-be-the-default-choice.patch new file mode 100644 index 0000000..0942a22 --- /dev/null +++ b/0001-Make-the-python3-be-the-default-choice.patch @@ -0,0 +1,32 @@ +From 2fd4caf035c1883ae1fd9574f26dcf3fc12dc79b Mon Sep 17 00:00:00 2001 +From: Honza Horak +Date: Fri, 23 Jul 2021 08:32:12 +0200 +Subject: [PATCH] Make the python3 be the default choice + +This default is likely never used but since it is there, let's make it valid. + +scl-utils 2.x are included only in RHEL-8, so it is likely safe to expect +python3 being available everywhere where 2.x version of scl-utils is +used. + +Related: https://bugzilla.redhat.com/show_bug.cgi?id=1984598 +--- + rpm/brp-scl-python-bytecompile | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rpm/brp-scl-python-bytecompile b/rpm/brp-scl-python-bytecompile +index ef00064..c91b952 100755 +--- a/rpm/brp-scl-python-bytecompile ++++ b/rpm/brp-scl-python-bytecompile +@@ -10,7 +10,7 @@ fi + [ "0$scl_path" = "0" ] && exit 0 + + # If we don't have a python interpreter, avoid changing anything. +-default_python=${1:-/usr/bin/python} ++default_python=${1:-/usr/bin/python3} + if [ ! -x "$default_python" ]; then + exit 0 + fi +-- +2.26.3 + diff --git a/0001-Replace-__python-with-__python3.patch b/0001-Replace-__python-with-__python3.patch new file mode 100644 index 0000000..8276c48 --- /dev/null +++ b/0001-Replace-__python-with-__python3.patch @@ -0,0 +1,31 @@ +From 56e77e7ec51ac610b5cc263bd2de058714bbd3e8 Mon Sep 17 00:00:00 2001 +From: Jun Aruga +Date: Mon, 21 Dec 2020 13:41:40 +0100 +Subject: [PATCH] Replace %{__python} with %{__python3}. + +To fix the following error. + +``` +$ rhpkg srpm +error: attempt to use unversioned python, define %__python to /usr/bin/python2 or /usr/bin/python3 explicitly +``` +--- + rpm/macros.scl | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/rpm/macros.scl b/rpm/macros.scl +index 550243e..f1ee5f2 100644 +--- a/rpm/macros.scl ++++ b/rpm/macros.scl +@@ -90,7 +90,7 @@ package or when debugging this package. + /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} + } + /usr/lib/rpm/brp-strip-static-archive %{__strip} +- /usr/lib/rpm/brp-scl-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} %{_scl_root} ++ /usr/lib/rpm/brp-scl-python-bytecompile %{__python3} %{?_python_bytecompile_errors_terminate_build} %{_scl_root} + /usr/lib/rpm/brp-python-hardlink + %{nil}} + BuildRequires: scl-utils-build +-- +2.26.3 + diff --git a/scl-utils.spec b/scl-utils.spec index ba2f81f..7b28a13 100644 --- a/scl-utils.spec +++ b/scl-utils.spec @@ -4,7 +4,7 @@ Name: scl-utils Epoch: 1 Version: 2.0.2 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Utilities for alternative packaging License: GPLv2+ @@ -17,6 +17,8 @@ Buildrequires: rpm-devel Requires: %{_bindir}/modulecmd Patch1: 0003-Scl-utils-layout-patch-from-fedora-famillecollet.com.patch +Patch2: 0001-Make-the-python3-be-the-default-choice.patch +Patch3: 0001-Replace-__python-with-__python3.patch # https://github.com/sclorg/scl-utils/pull/25 Patch100: scl-utils-2.0.2-rhbz-1728450.patch @@ -78,6 +80,10 @@ ln -s prefixes conf %{_rpmconfigdir}/brp-scl-python-bytecompile %changelog +* Fri Jul 23 2021 Honza Horak - 1:2.0.2-20 +- Fix problem with python version in the byte compilation script + Resolves: #1984598 + * Wed May 12 2021 Michal Domonkos - 1:2.0.2-19 - Fix dist tag syntax - Resolves: #1958982