From e5debd54ab74805dffb9c1c17462bcbd1b5f2851 Mon Sep 17 00:00:00 2001 From: Dean Troyer Date: Fri, 15 Feb 2019 14:25:12 -0600 Subject: [PATCH] Set a fixed install dir and add specific prereqs * Install build artifacts to a fixed dir rather than attempting to infer a location based on the Python binary location. That was intended to work seamlessly in venvs, we'll burn that bridge when we come to it, for now just put it all in $DEST/usr/{bin|include|lib}. This also removed the need for root access for these files to allow the build steps to be performed on laptops that may not otherwise run DevStack. * Handle some side-effects of a non-default install location for the build artifacts. * Add missing CentOS prereqs for base image builds: fm-common: - libuuid-devel - postgresql-devel * Add the declarations to settings for the devstack playbook to handle plugin precedence order properly. Change-Id: I8ec59f83dff522fcec0be4e0a650e402a2747a98 Signed-off-by: Dean Troyer --- devstack/files/rpms/stx-fault | 2 + devstack/lib/stx-fault | 71 +++++++++++++++++------------------ devstack/settings | 6 +++ 3 files changed, 43 insertions(+), 36 deletions(-) create mode 100644 devstack/files/rpms/stx-fault diff --git a/devstack/files/rpms/stx-fault b/devstack/files/rpms/stx-fault new file mode 100644 index 00000000..d82e657a --- /dev/null +++ b/devstack/files/rpms/stx-fault @@ -0,0 +1,2 @@ +libuuid-devel +postgresql-devel diff --git a/devstack/lib/stx-fault b/devstack/lib/stx-fault index 2a04343a..89918664 100644 --- a/devstack/lib/stx-fault +++ b/devstack/lib/stx-fault @@ -40,7 +40,9 @@ FM_RESTAPI_SERVICE_HOST=${FM_RESTAPI_SERVICE_HOST:-$SERVICE_HOST} FM_RESTAPI_SERVICE_PORT=${FM_RESTAPI_SERVICE_PORT:-18002} FM_RESTAPI_WORKERS=${FM_RESTAPI_WORKERS:-4} -STX_BIN_DIR=$(get_python_exec_prefix) +# STX_INST_DIR should be a non-root-writable place to install build artifacts +STX_INST_DIR=${STX_INST_DIR:-$DEST/usr} +STX_BIN_DIR=$STX_INST_DIR/bin PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") # Functions @@ -86,7 +88,9 @@ function build_fm_mgr { fi # build - make MAJOR=$major MINOR=$minor + CPATH=$STX_INST_DIR/include LIBRARY_PATH=$STX_INST_DIR/lib make \ + MAJOR=$major \ + MINOR=$minor popd } @@ -112,24 +116,23 @@ function cleanup_fm_common { read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO) local major=${version%%.*} local minor=${version##*.} - local prefix=${STX_BIN_DIR%/*} sudo rm /etc/ld.so.conf.d/stx-fault.conf pushd $STX_FAULT_DIR/fm-common/sources - sudo make \ - DEST_DIR=$prefix \ - BIN_DIR=/bin \ - LIB_DIR=/lib \ - INC_DIR=/include \ + make \ + DESTDIR=$STX_INST_DIR \ + BINDIR=/bin \ + LIBDIR=/lib \ + INCDIR=/include \ MAJOR=$major \ MINOR=$minor \ clean - sudo rm $prefix/bin/fm_db_sync_event_suppression.py \ - $prefix/include/fmConfig.h \ - $prefix/include/fmLog.h + rm $STX_BIN_DIR/fm_db_sync_event_suppression.py \ + $STX_INST_DIR/include/fmConfig.h \ + $STX_INST_DIR/include/fmLog.h popd } @@ -144,10 +147,9 @@ function cleanup_fm_mgr { pushd $STX_FAULT_DIR/fm-mgr/sources - sudo make \ - BIN_DIR=/bin \ - LIB_DIR=/lib \ - INC_DIR=/include \ + make \ + DESTDIR=$STX_INST_DIR \ + BINDIR=/bin \ MAJOR=$major \ MINOR=$minor \ clean @@ -277,16 +279,13 @@ function install_fm_common { build_fm_common $major $minor - # Set up the destinations - # Making an assumption here about STX_BIN_DIR having ../include be valid - local prefix=${STX_BIN_DIR%/*} - - # install - sudo make \ - DEST_DIR=$prefix \ - BIN_DIR=/bin \ - LIB_DIR=/lib \ - INC_DIR=/include \ + # install to STX_INST_DIR + # Note that DESTDIR prefixes the other locations in the Makefile + make \ + DESTDIR=$STX_INST_DIR \ + BINDIR=/bin \ + LIBDIR=/lib \ + INCDIR=/include \ MAJOR=$major \ MINOR=$minor \ install @@ -297,17 +296,17 @@ function install_fm_common { --prefix=/usr \ --install-data=/usr/share \ - # This _is_ nasty, clean it up - sudo install -m 755 fm_db_sync_event_suppression.py \ - $prefix/bin/fm_db_sync_event_suppression.py + # This _is_ still a little nasty, clean it up + install -m 755 fm_db_sync_event_suppression.py \ + $STX_INST_DIR/bin/fm_db_sync_event_suppression.py # install the headers that used by fm-mgr package - sudo install -m 644 -p -D fmConfig.h $prefix/include/fmConfig.h - sudo install -m 644 -p -D fmLog.h $prefix/include/fmLog.h + install -m 644 -p -D fmConfig.h $STX_INST_DIR/include/fmConfig.h + install -m 644 -p -D fmLog.h $STX_INST_DIR/include/fmLog.h # Make sure we can find it later # TODO: this should be managed better - echo /usr/local/lib64 | sudo tee /etc/ld.so.conf.d/stx-fault.conf + echo $STX_INST_DIR/lib | sudo tee /etc/ld.so.conf.d/stx-fault.conf sudo ldconfig popd } @@ -324,11 +323,11 @@ function install_fm_mgr { build_fm_mgr $major $minor - # install - sudo make \ - BIN_DIR=/bin \ - LIB_DIR=/lib \ - INC_DIR=/include \ + # install to STX_INST_DIR + # Note that DESTDIR prefixes the other locations in the Makefile + make \ + DESTDIR=$STX_INST_DIR \ + BINDIR=/bin \ MAJOR=$major \ MINOR=$minor \ install diff --git a/devstack/settings b/devstack/settings index a081308f..7e45d393 100644 --- a/devstack/settings +++ b/devstack/settings @@ -17,6 +17,11 @@ STX_FAULT_NAME=stx-fault ######### Plugin Specific ########## enable_service $STX_FAULT_NAME +# This must not use any variables to work properly in OpenStack's DevStack playbook +define_plugin stx-fault +# This works for Zuul jobs using OpenStack's DevStack roles +plugin_requires stx-fault stx-update + # Circular dependencies are fun! # fm-rest-api has an undeclared dependency on cgtsclient from stx-config # so if that is not present we can't install it @@ -25,6 +30,7 @@ if ! is_service_enabled stx-config; then fi # but fm-rest-api has its own (declared!) external dependencies too if is_service_enabled fm-rest-api; then + # stx-update enable_service tsconfig fi