Fix problem with python version in the byte compilation script

Resolves: #1984598
This commit is contained in:
Honza Horak 2021-07-23 09:14:00 +02:00
parent e1f29dd5f9
commit c6115a7f58
3 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From 2fd4caf035c1883ae1fd9574f26dcf3fc12dc79b Mon Sep 17 00:00:00 2001
From: Honza Horak <hhorak@redhat.com>
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

View File

@ -0,0 +1,31 @@
From 56e77e7ec51ac610b5cc263bd2de058714bbd3e8 Mon Sep 17 00:00:00 2001
From: Jun Aruga <jaruga@redhat.com>
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

View File

@ -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 <hhorak@redhat.com> - 1:2.0.2-20
- Fix problem with python version in the byte compilation script
Resolves: #1984598
* Wed May 12 2021 Michal Domonkos <mdomonko@redhat.com> - 1:2.0.2-19
- Fix dist tag syntax
- Resolves: #1958982