From f7af62ecd893bd977cebc4e6586f1e524b36561b Mon Sep 17 00:00:00 2001 From: "Kaleb S. KEITHLEY" Date: Mon, 24 Sep 2018 14:12:45 -0400 Subject: 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 --- Makefile.am | 1 - configure.ac | 13 ------------- glusterfs.spec.in | 6 ++++++ tests/bugs/distribute/overlap.py | 1 - tests/bugs/nfs/socket-as-fifo.py | 1 - tests/bugs/nfs/socket-as-fifo.t | 2 +- tests/features/ipctest.py | 1 - tests/utils/changelogparser.py | 1 - tests/utils/create-files.py | 1 - tests/utils/getfattr.py | 1 - tests/utils/gfid-access.py | 1 - tests/utils/pidof.py | 1 - tests/utils/setfattr.py | 1 - 13 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Makefile.am b/Makefile.am index 274f71030c0..613382f9809 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/configure.ac b/configure.ac index db88ff1d8b1..bc4cf9342b4 100644 --- a/configure.ac +++ b/configure.ac @@ -1686,19 +1686,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]) diff --git a/glusterfs.spec.in b/glusterfs.spec.in index 550e80b6f69..e4551c320d2 100644 --- a/glusterfs.spec.in +++ b/glusterfs.spec.in @@ -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 ) diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py index 5416991b7a3..0941d377624 100755 --- a/tests/bugs/distribute/overlap.py +++ b/tests/bugs/distribute/overlap.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 from __future__ import print_function import sys diff --git a/tests/bugs/nfs/socket-as-fifo.py b/tests/bugs/nfs/socket-as-fifo.py index 2c8ef26a804..eb507e1d30b 100755 --- a/tests/bugs/nfs/socket-as-fifo.py +++ b/tests/bugs/nfs/socket-as-fifo.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 # # Create a unix domain socket and test if it is a socket (and not a fifo/pipe). # diff --git a/tests/bugs/nfs/socket-as-fifo.t b/tests/bugs/nfs/socket-as-fifo.t index ca5f2af6f2b..db64bbb303b 100644 --- a/tests/bugs/nfs/socket-as-fifo.t +++ b/tests/bugs/nfs/socket-as-fifo.t @@ -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 diff --git a/tests/features/ipctest.py b/tests/features/ipctest.py index 9ff7a271cf2..f6f699cf5c4 100755 --- a/tests/features/ipctest.py +++ b/tests/features/ipctest.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 from __future__ import print_function import ctypes diff --git a/tests/utils/changelogparser.py b/tests/utils/changelogparser.py index e8b8c6d6a6a..e8e252d195f 100644 --- a/tests/utils/changelogparser.py +++ b/tests/utils/changelogparser.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Why? diff --git a/tests/utils/create-files.py b/tests/utils/create-files.py index 6b72a853509..b2a19610d63 100755 --- a/tests/utils/create-files.py +++ b/tests/utils/create-files.py @@ -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 diff --git a/tests/utils/getfattr.py b/tests/utils/getfattr.py index e2357901a93..3eb40e1c887 100755 --- a/tests/utils/getfattr.py +++ b/tests/utils/getfattr.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 from __future__ import print_function import os diff --git a/tests/utils/gfid-access.py b/tests/utils/gfid-access.py index 377c504270f..556d2b4c65b 100755 --- a/tests/utils/gfid-access.py +++ b/tests/utils/gfid-access.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 # # Copyright (c) 2011-2014 Red Hat, Inc. # This file is part of GlusterFS. diff --git a/tests/utils/pidof.py b/tests/utils/pidof.py index 19deeb1fe21..4b7071c0a48 100755 --- a/tests/utils/pidof.py +++ b/tests/utils/pidof.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 from __future__ import print_function import sys diff --git a/tests/utils/setfattr.py b/tests/utils/setfattr.py index 364ad8b6966..8b7b6abacc0 100755 --- a/tests/utils/setfattr.py +++ b/tests/utils/setfattr.py @@ -1,4 +1,3 @@ -#!/usr/bin/python3 import os import sys -- cgit