python3: assume python3 unless building _packages_ on sys without py3

The jenkins release-new job runs on a CentOS 7 box, which does not
have python3. As a result it runs (autogen.sh and) configure before
producing the dist tar file, converting all the python3 shebangs to
python2 shebangs in the dist tar file.

Then when that tar file is "carried" to, e.g. Fedora koji build
system to build packages, the shebangs are incorrect, despite having
originally been correct in the git repo.

Change-Id: I5154baba3f6d29d3c4823bafc2b57abecbf90e5b
updates: #411
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
This commit is contained in:
Kaleb S. KEITHLEY 2018-09-24 14:12:45 -04:00 committed by Amar Tumballi
parent 4756e27bbc
commit 5b91555a58
13 changed files with 7 additions and 24 deletions

View File

@ -7,7 +7,6 @@ EXTRA_DIST = autogen.sh \
run-tests.sh \
build-aux/pkg-version \
contrib/umountd \
python-shebangs \
$(shell find $(top_srcdir)/tests -type f -print)
SUBDIRS = $(ARGP_STANDALONE_DIR) rpc/xdr/gen libglusterfs rpc api xlators \

View File

@ -1717,19 +1717,6 @@ AC_SUBST(GFAPI_EXTRA_LDFLAGS)
GFAPI_LIBS="${ACL_LIBS}"
AC_SUBST(GFAPI_LIBS)
pushd $(dirname $0) &> /dev/null
if test ! -e python-shebangs; then
touch python-shebangs
if test "x${PYTHON}" = "x/usr/bin/python2"; then
echo "fixing python shebangs..."
for f in api events extras geo-replication libglusterfs tests tools xlators; do
find $f -type f -exec sed -i 's|/usr/bin/python3|/usr/bin/python2|' {} \;
done
echo "...done"
fi
fi
popd &> /dev/null
dnl this change necessary for run-tests.sh
AC_CONFIG_FILES([tests/env.rc],[ln -s ${ac_abs_builddir}/env.rc ${ac_abs_srcdir}/env.rc 2>/dev/null])

View File

@ -723,6 +723,12 @@ GlusterFS Events
%prep
%setup -q -n %{name}-%{version}%{?prereltag}
%if ( ! %{_usepython3} )
echo "fixing python shebangs..."
for f in api events extras geo-replication libglusterfs tools xlators; do
find $f -type f -exec sed -i 's|/usr/bin/python3|/usr/bin/python2|' {} \;
done
%endif
%build
%if ( 0%{?rhel} && 0%{?rhel} < 6 )

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
from __future__ import print_function
import sys

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
#
# Create a unix domain socket and test if it is a socket (and not a fifo/pipe).
#

View File

@ -16,7 +16,7 @@ EXPECT_WITHIN $NFS_EXPORT_TIMEOUT "1" is_nfs_export_available;
TEST mount_nfs $H0:/$V0 $N0 nolock
# this is the actual test
TEST $(dirname $0)/socket-as-fifo.py $N0/not-a-fifo.socket
TEST $PYTHON $(dirname $0)/socket-as-fifo.py $N0/not-a-fifo.socket
TEST umount_nfs $N0

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
from __future__ import print_function
import ctypes

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Why?

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
# This script was developed by Vijaykumar Koppad (vkoppad@redhat.com)
# The latest version of this script can found at

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
from __future__ import print_function
import os

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
#
# Copyright (c) 2011-2014 Red Hat, Inc. <http://www.redhat.com>
# This file is part of GlusterFS.

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
from __future__ import print_function
import sys

View File

@ -1,4 +1,3 @@
#!/usr/bin/python3
import os
import sys