14f8ab
From c7aae487213e464b2ee7a785d752bd8264ceb371 Mon Sep 17 00:00:00 2001
14f8ab
From: Hari Gowtham <hgowtham@redhat.com>
14f8ab
Date: Thu, 13 Jun 2019 20:12:14 +0530
14f8ab
Subject: [PATCH 190/192] Build: removing the hardcoded usage of python3
14f8ab
14f8ab
Label : DOWNSTREAM ONLY
14f8ab
14f8ab
Problem: RHEL8 needed python3 so python3 was hardcoded to be used
14f8ab
in gluster build. python2 was still being used by RHEL7 machines and
14f8ab
when the shebang was redirected to use python3 glusterfind failed.
14f8ab
It was not working from 6.0-5 downstream build.
14f8ab
14f8ab
Fix: revert back to the old mechanism where we check the python version
14f8ab
and redirect the python script according to the usage.
14f8ab
14f8ab
Change-Id: I8dc6c9185b2740e20e4c4d734cc1a9e335e9c449
14f8ab
fixes: bz#1719640
14f8ab
Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/173392
14f8ab
Reviewed-by: Kaleb Keithley <kkeithle@redhat.com>
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Aravinda Vishwanathapura Krishna Murthy <avishwan@redhat.com>
14f8ab
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
14f8ab
---
14f8ab
 glusterfs.spec.in | 6 ++++--
14f8ab
 1 file changed, 4 insertions(+), 2 deletions(-)
14f8ab
14f8ab
diff --git a/glusterfs.spec.in b/glusterfs.spec.in
14f8ab
index 9c7d7a7..0127e8e 100644
14f8ab
--- a/glusterfs.spec.in
14f8ab
+++ b/glusterfs.spec.in
14f8ab
@@ -722,10 +722,12 @@ GlusterFS Events
14f8ab
 
14f8ab
 %prep
14f8ab
 %setup -q -n %{name}-%{version}%{?prereltag}
14f8ab
+%if ( ! %{_usepython3} )
14f8ab
 echo "fixing python shebangs..."
14f8ab
-for i in `find . -type f -exec bash -c "if file {} | grep 'Python script, ASCII text executable' >/dev/null; then echo {}; fi" ';'`; do
14f8ab
-    sed -i -e 's|^#!/usr/bin/python.*|#!%{__python3}|' -e 's|^#!/usr/bin/env python.*|#!%{__python3}|' $i
14f8ab
+for f in api events extras geo-replication libglusterfs tools xlators; do
14f8ab
+find $f -type f -exec sed -i 's|/usr/bin/python3|/usr/bin/python2|' {} \;
14f8ab
 done
14f8ab
+%endif
14f8ab
 
14f8ab
 %build
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab