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