|
|
3604df |
From 398636c8bd8ac0829ca1ef6000821026f2e3c003 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Aravinda VK <avishwan@redhat.com>
|
|
|
3604df |
Date: Wed, 24 Aug 2016 14:02:08 +0530
|
|
|
3604df |
Subject: [PATCH 40/86] packaging/eventsapi: Make Python site-packages variable global
|
|
|
3604df |
|
|
|
3604df |
Python site-packages path is assigned when glupy is enabled.
|
|
|
3604df |
Eventsapi will not work as expected if glupy is disabled using
|
|
|
3604df |
./configure --disable-glupy.
|
|
|
3604df |
|
|
|
3604df |
With this patch, all the Python variables are moved out of glupy
|
|
|
3604df |
and used inside it.
|
|
|
3604df |
|
|
|
3604df |
systemd services will fail if we import gluster.cliutils python library
|
|
|
3604df |
which is installed in /usr/local/lib/python.2.7/site-packages or some
|
|
|
3604df |
other location. With this patch, Environment variable is added in
|
|
|
3604df |
systemd service file.
|
|
|
3604df |
|
|
|
3604df |
> Reviewed-on: http://review.gluster.org/15305
|
|
|
3604df |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
|
|
|
3604df |
> Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
|
|
|
3604df |
BUG: 1351589
|
|
|
3604df |
Change-Id: I9416240f03889e3bbcb4cd375e27c784fa9ca277
|
|
|
3604df |
Signed-off-by: Aravinda VK <avishwan@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/84744
|
|
|
3604df |
Reviewed-by: Milind Changire <mchangir@redhat.com>
|
|
|
3604df |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
configure.ac | 91 +++++++++++++++++------------
|
|
|
3604df |
extras/systemd/glustereventsd.service.in | 1 +
|
|
|
3604df |
2 files changed, 54 insertions(+), 38 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/configure.ac b/configure.ac
|
|
|
3604df |
index e18309d..d77f41f 100644
|
|
|
3604df |
--- a/configure.ac
|
|
|
3604df |
+++ b/configure.ac
|
|
|
3604df |
@@ -502,6 +502,51 @@ if test "x${have_umount2}" = "xyes"; then
|
|
|
3604df |
AC_DEFINE(HAVE_UMOUNT2, 1, [define if found umount2])
|
|
|
3604df |
fi
|
|
|
3604df |
|
|
|
3604df |
+dnl Check Python Availability
|
|
|
3604df |
+have_python=no
|
|
|
3604df |
+AM_PATH_PYTHON(,, [:])
|
|
|
3604df |
+if test "$PYTHON" != ":"; then
|
|
|
3604df |
+ have_python=yes
|
|
|
3604df |
+fi
|
|
|
3604df |
+
|
|
|
3604df |
+dnl Check if version matches that we require
|
|
|
3604df |
+PYTHONDEV_CPPFLAGS=
|
|
|
3604df |
+PYTHONDEV_CPPFLAGS=
|
|
|
3604df |
+BUILD_PYTHON_SITE_PACKAGES=
|
|
|
3604df |
+BUILD_PYTHON_INC=
|
|
|
3604df |
+BUILD_PYTHON_LIB=
|
|
|
3604df |
+have_python2=no
|
|
|
3604df |
+have_Python_h=no
|
|
|
3604df |
+
|
|
|
3604df |
+if echo $PYTHON_VERSION | grep ^2; then
|
|
|
3604df |
+ have_python2=yes
|
|
|
3604df |
+
|
|
|
3604df |
+ dnl Use pkg-config to get runtime search patch missing from ${PYTHON}-config
|
|
|
3604df |
+ dnl Just do "true" on failure so that configure does not bail out
|
|
|
3604df |
+ PKG_CHECK_MODULES([PYTHON], "python-$PYTHON_VERSION",,true)
|
|
|
3604df |
+
|
|
|
3604df |
+ PYTHONDEV_CPPFLAGS="`${PYTHON}-config --cflags`"
|
|
|
3604df |
+ dnl Edit out the flags that are not required or are conflicting
|
|
|
3604df |
+ PYTHONDEV_CPPFLAGS=`echo ${PYTHONDEV_CPPFLAGS} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[[0-9]]//g'`
|
|
|
3604df |
+
|
|
|
3604df |
+ dnl Find python libs at user configured libdir and also "lib" under prefix
|
|
|
3604df |
+ PYTHONDEV_LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
|
|
|
3604df |
+
|
|
|
3604df |
+ BUILD_PYTHON_SITE_PACKAGES=`$PYTHON -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix="${exec_prefix}"))'`
|
|
|
3604df |
+ BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
|
|
|
3604df |
+ BUILD_PYTHON_LIB=python$PYTHON_VERSION
|
|
|
3604df |
+
|
|
|
3604df |
+ dnl Now check for python header using the include path obtained above
|
|
|
3604df |
+ AC_CHECK_HEADERS([${BUILD_PYTHON_INC}/Python.h],[have_Python_h=yes],[])
|
|
|
3604df |
+fi
|
|
|
3604df |
+
|
|
|
3604df |
+AC_SUBST(PYTHONDEV_CPPFLAGS)
|
|
|
3604df |
+AC_SUBST(PYTHONDEV_LDFLAGS)
|
|
|
3604df |
+AC_SUBST(BUILD_PYTHON_SITE_PACKAGES)
|
|
|
3604df |
+AC_SUBST(BUILD_PYTHON_INC)
|
|
|
3604df |
+AC_SUBST(BUILD_PYTHON_LIB)
|
|
|
3604df |
+
|
|
|
3604df |
+
|
|
|
3604df |
# FUSE section
|
|
|
3604df |
AC_ARG_ENABLE([fuse-client],
|
|
|
3604df |
AC_HELP_STRING([--disable-fuse-client],
|
|
|
3604df |
@@ -713,17 +758,11 @@ AC_ARG_ENABLE([events],
|
|
|
3604df |
BUILD_EVENTS=no
|
|
|
3604df |
EVENTS_ENABLED=0
|
|
|
3604df |
EVENTS_SUBDIR=
|
|
|
3604df |
-have_python2=no
|
|
|
3604df |
if test "x$enable_events" != "xno"; then
|
|
|
3604df |
EVENTS_SUBDIR=events
|
|
|
3604df |
EVENTS_ENABLED=1
|
|
|
3604df |
|
|
|
3604df |
BUILD_EVENTS="yes"
|
|
|
3604df |
- AM_PATH_PYTHON()
|
|
|
3604df |
- dnl Check if version matches that we require
|
|
|
3604df |
- if echo $PYTHON_VERSION | grep ^2; then
|
|
|
3604df |
- have_python2=yes
|
|
|
3604df |
- fi
|
|
|
3604df |
|
|
|
3604df |
if test "x$have_python2" = "xno"; then
|
|
|
3604df |
if test "x$enable_events" = "xyes"; then
|
|
|
3604df |
@@ -1125,11 +1164,19 @@ sysconfdirtemp="${sysconfdir}"
|
|
|
3604df |
eval sysconfdirtemp=\"${sysconfdirtemp}\"
|
|
|
3604df |
SYSCONF_DIR=${sysconfdirtemp}
|
|
|
3604df |
|
|
|
3604df |
+# Eval two times to expand fully. First eval replaces $exec_prefix into $prefix
|
|
|
3604df |
+# Second eval will expand $prefix
|
|
|
3604df |
+build_python_site_packages_temp="${BUILD_PYTHON_SITE_PACKAGES}"
|
|
|
3604df |
+eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
|
|
|
3604df |
+eval build_python_site_packages_temp=\"${build_python_site_packages_temp}\"
|
|
|
3604df |
+BUILD_PYTHON_SITE_PACKAGES_EXPANDED=${build_python_site_packages_temp}
|
|
|
3604df |
+
|
|
|
3604df |
prefix=$prefix_temp
|
|
|
3604df |
exec_prefix=$exec_prefix_temp
|
|
|
3604df |
|
|
|
3604df |
AC_SUBST(SBIN_DIR)
|
|
|
3604df |
AC_SUBST(SYSCONF_DIR)
|
|
|
3604df |
+AC_SUBST(BUILD_PYTHON_SITE_PACKAGES_EXPANDED)
|
|
|
3604df |
|
|
|
3604df |
# lazy umount emulation
|
|
|
3604df |
UMOUNTD_SUBDIR=""
|
|
|
3604df |
@@ -1184,42 +1231,15 @@ fi
|
|
|
3604df |
|
|
|
3604df |
dnl glupy section
|
|
|
3604df |
BUILD_GLUPY=no
|
|
|
3604df |
-have_python2=no
|
|
|
3604df |
-have_Python_h=no
|
|
|
3604df |
|
|
|
3604df |
AC_ARG_ENABLE([glupy], AS_HELP_STRING([--enable-glupy], [build glupy]))
|
|
|
3604df |
if test "x$enable_glupy" != "xno"; then enable_glupy=yes; fi
|
|
|
3604df |
|
|
|
3604df |
if test "x$enable_glupy" = "xyes"; then
|
|
|
3604df |
- dnl Check if python exists
|
|
|
3604df |
- AM_PATH_PYTHON()
|
|
|
3604df |
- dnl Check if version matches that we require
|
|
|
3604df |
- if echo $PYTHON_VERSION | grep ^2; then
|
|
|
3604df |
- have_python2=yes
|
|
|
3604df |
- fi
|
|
|
3604df |
-
|
|
|
3604df |
- dnl Use pkg-config to get runtime search patch missing from ${PYTHON}-config
|
|
|
3604df |
- dnl Just do "true" on failure so that configure does not bail out
|
|
|
3604df |
- PKG_CHECK_MODULES([PYTHON], "python-$PYTHON_VERSION",,true)
|
|
|
3604df |
-
|
|
|
3604df |
- PYTHONDEV_CPPFLAGS="`${PYTHON}-config --cflags`"
|
|
|
3604df |
- dnl Edit out the flags that are not required or are conflicting
|
|
|
3604df |
- PYTHONDEV_CPPFLAGS=`echo ${PYTHONDEV_CPPFLAGS} | sed -e 's/-Wp,-D_FORTIFY_SOURCE=[[0-9]]//g'`
|
|
|
3604df |
-
|
|
|
3604df |
- dnl Find python libs at user configured libdir and also "lib" under prefix
|
|
|
3604df |
- PYTHONDEV_LDFLAGS="${PYTHON_LIBS} -L`${PYTHON}-config --prefix`/lib -L`${PYTHON}-config --prefix`/$libdir `${PYTHON}-config --ldflags`"
|
|
|
3604df |
-
|
|
|
3604df |
- BUILD_PYTHON_SITE_PACKAGES=`$PYTHON -c 'from distutils.sysconfig import get_python_lib; print(get_python_lib(prefix="${exec_prefix}"))'`
|
|
|
3604df |
- BUILD_PYTHON_INC=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_inc()"`
|
|
|
3604df |
- BUILD_PYTHON_LIB=python$PYTHON_VERSION
|
|
|
3604df |
-
|
|
|
3604df |
GLUPY_SUBDIR=glupy
|
|
|
3604df |
GLUPY_SUBDIR_MAKEFILE=xlators/features/glupy/Makefile
|
|
|
3604df |
GLUPY_SUBDIR_SRC_MAKEFILE=xlators/features/glupy/src/Makefile
|
|
|
3604df |
|
|
|
3604df |
- dnl Now check for python header using the include path obtained above
|
|
|
3604df |
- AC_CHECK_HEADERS([${BUILD_PYTHON_INC}/Python.h],[have_Python_h=yes],[])
|
|
|
3604df |
-
|
|
|
3604df |
if test "x$have_python2" = "xyes" -a "x$have_Python_h" = "xyes"; then
|
|
|
3604df |
case $host_os in
|
|
|
3604df |
darwin*)
|
|
|
3604df |
@@ -1240,11 +1260,6 @@ if test "x$enable_glupy" = "xyes"; then
|
|
|
3604df |
|
|
|
3604df |
echo "building glupy with -isystem $BUILD_PYTHON_INC -l $BUILD_PYTHON_LIB"
|
|
|
3604df |
|
|
|
3604df |
- AC_SUBST(PYTHONDEV_CPPFLAGS)
|
|
|
3604df |
- AC_SUBST(PYTHONDEV_LDFLAGS)
|
|
|
3604df |
- AC_SUBST(BUILD_PYTHON_SITE_PACKAGES)
|
|
|
3604df |
- AC_SUBST(BUILD_PYTHON_INC)
|
|
|
3604df |
- AC_SUBST(BUILD_PYTHON_LIB)
|
|
|
3604df |
AC_SUBST(GLUPY_SUBDIR)
|
|
|
3604df |
AC_SUBST(GLUPY_SUBDIR_MAKEFILE)
|
|
|
3604df |
AC_SUBST(GLUPY_SUBDIR_SRC_MAKEFILE)
|
|
|
3604df |
diff --git a/extras/systemd/glustereventsd.service.in b/extras/systemd/glustereventsd.service.in
|
|
|
3604df |
index 2be3f25..75cca16 100644
|
|
|
3604df |
--- a/extras/systemd/glustereventsd.service.in
|
|
|
3604df |
+++ b/extras/systemd/glustereventsd.service.in
|
|
|
3604df |
@@ -3,6 +3,7 @@ Description=Gluster Events Notifier
|
|
|
3604df |
After=syslog.target network.target
|
|
|
3604df |
|
|
|
3604df |
[Service]
|
|
|
3604df |
+Environment=PYTHONPATH=@BUILD_PYTHON_SITE_PACKAGES_EXPANDED@:$PYTHONPATH
|
|
|
3604df |
Type=simple
|
|
|
3604df |
ExecStart=@SBIN_DIR@/glustereventsd
|
|
|
3604df |
ExecReload=/bin/kill -SIGUSR2 $MAINPID
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|