Use specific python shebang

This commit is contained in:
Honza Horak 2019-01-09 21:25:26 +01:00
parent e9dc01434b
commit 4f1f8bb5b6
3 changed files with 79 additions and 3 deletions

View File

@ -0,0 +1,32 @@
Do not import commands library as it is not used
It also makes the script not work on python3, but since the script already uses
subprocess in practice, removing commands import is effectively no change and
fixes the python3 compatibility.
Upstream PR: https://github.com/MariaDB/server/pull/1080
From 9c89fd49a757a87ba5899b3548b0fb1d172c0ec3 Mon Sep 17 00:00:00 2001
From: Honza Horak <hhorak@redhat.com>
Date: Wed, 9 Jan 2019 15:05:02 +0100
Subject: [PATCH] Do not import commands library as it is not used
---
storage/rocksdb/myrocks_hotbackup.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/storage/rocksdb/myrocks_hotbackup.py b/storage/rocksdb/myrocks_hotbackup.py
index 69c75b7cbfd..906ba814776 100755
--- a/storage/rocksdb/myrocks_hotbackup.py
+++ b/storage/rocksdb/myrocks_hotbackup.py
@@ -8,7 +8,6 @@ import os
import stat
import sys
import re
-import commands
import subprocess
import logging
import logging.handlers
--
2.17.2

30
mariadb-pythonver.patch Normal file
View File

@ -0,0 +1,30 @@
Upstream PR: https://github.com/MariaDB/server/pull/1081
From d2cbf56d36e422802aa7e53ec0f4e6be8fd53cf5 Mon Sep 17 00:00:00 2001
From: Honza Horak <hhorak@redhat.com>
Date: Wed, 9 Jan 2019 20:17:29 +0100
Subject: [PATCH] Make the PYTHON_SHEBANG value configurable
In Fedora 30 it is required to specify either /usr/bin/python2 or /usr/bin/python3 in the shebang, so we need a way to say explicit shebang, ideally in the cmake call.
---
CMakeLists.txt | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a139c9e5fa4..ccccb08bef1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -342,7 +342,9 @@ MYSQL_CHECK_SSL()
MYSQL_CHECK_READLINE()
SET(MALLOC_LIBRARY "system")
-SET(PYTHON_SHEBANG "/usr/bin/env python")
+IF(NOT DEFINED PYTHON_SHEBANG)
+ SET(PYTHON_SHEBANG "/usr/bin/env python")
+ENDIF()
CHECK_PCRE()
--
2.17.2

View File

@ -109,6 +109,13 @@
%global pcre_bundled_version 8.42
%endif
# Use main python interpretter version
%if 0%{?fedora} || 0%{?rhel} > 7
%global python_path /usr/bin/python3
%else
%global python_path /usr/bin/python2
%endif
# Include systemd files
%global daemon_name %{name}
%global daemondir %{_unitdir}
@ -143,7 +150,7 @@
Name: mariadb
Version: 10.3.12
Release: 1%{?with_debug:.debug}%{?dist}
Release: 2%{?with_debug:.debug}%{?dist}
Epoch: 3
Summary: A very fast and robust SQL database server
@ -176,8 +183,10 @@ Source71: LICENSE.clustercheck
# https://jira.mariadb.org/browse/MDEV-12646
Source72: mariadb-server-galera.te
# Patch1: Fix python shebang to specificaly say the python version
Patch1: %{pkgnamepatch}-shebang.patch
# Patch1: Make the myrocks_hotbackup script python3 compatible
Patch1: %{pkgnamepatch}-myrocks-hotbackup.patch
# Patch2: Make the python interpretter be configurable
Patch2: %{pkgnamepatch}-pythonver.patch
# Patch4: Red Hat distributions specific logrotate fix
# it would be big unexpected change, if we start shipping it now. Better wait for MariaDB 10.2
Patch4: %{pkgnamepatch}-logrotate.patch
@ -680,6 +689,7 @@ sources.
find . -name "*.jar" -type f -exec rm --verbose -f {} \;
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch7 -p1
%patch9 -p1
@ -819,6 +829,7 @@ export CFLAGS CXXFLAGS
-DPLUGIN_TOKUDB=%{?with_tokudb:DYNAMIC}%{!?with_tokudb:NO} \
-DPLUGIN_CONNECT=%{?with_connect:DYNAMIC}%{!?with_connect:NO} \
-DWITH_CASSANDRA=%{?with_cassandra:TRUE}%{!?with_cassandra:FALSE} \
-DPYTHON_SHEBANG=%{python_path} \
-DPLUGIN_CACHING_SHA2_PASSWORD=%{?with_clibrary:DYNAMIC}%{!?with_clibrary:OFF} \
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
-DCONNECT_WITH_MONGO=OFF \
@ -1564,6 +1575,9 @@ fi
%endif
%changelog
* Wed Jan 09 2019 Honza Horak <hhorak@redhat.com> - 3:10.3.12-2
- Use specific python shebang
* Tue Jan 08 2019 Michal Schorm <mschorm@redhat.com> - 3:10.3.12-1
- Rebase to 10.3.12
- Disable building of the caching_sha2_password plugin, it is shipped