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 <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2019-02-15 14:25:12 -06:00
parent b217f4c87c
commit e5debd54ab
3 changed files with 43 additions and 36 deletions

View File

@ -0,0 +1,2 @@
libuuid-devel
postgresql-devel

View File

@ -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_SERVICE_PORT=${FM_RESTAPI_SERVICE_PORT:-18002}
FM_RESTAPI_WORKERS=${FM_RESTAPI_WORKERS:-4} 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())") PYTHON_SITE_DIR=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
# Functions # Functions
@ -86,7 +88,9 @@ function build_fm_mgr {
fi fi
# build # build
make MAJOR=$major MINOR=$minor CPATH=$STX_INST_DIR/include LIBRARY_PATH=$STX_INST_DIR/lib make \
MAJOR=$major \
MINOR=$minor
popd popd
} }
@ -112,24 +116,23 @@ function cleanup_fm_common {
read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO) read x version <<< $(grep '^Version: ' $STX_FAULT_DIR/fm-common/PKG-INFO)
local major=${version%%.*} local major=${version%%.*}
local minor=${version##*.} local minor=${version##*.}
local prefix=${STX_BIN_DIR%/*}
sudo rm /etc/ld.so.conf.d/stx-fault.conf sudo rm /etc/ld.so.conf.d/stx-fault.conf
pushd $STX_FAULT_DIR/fm-common/sources pushd $STX_FAULT_DIR/fm-common/sources
sudo make \ make \
DEST_DIR=$prefix \ DESTDIR=$STX_INST_DIR \
BIN_DIR=/bin \ BINDIR=/bin \
LIB_DIR=/lib \ LIBDIR=/lib \
INC_DIR=/include \ INCDIR=/include \
MAJOR=$major \ MAJOR=$major \
MINOR=$minor \ MINOR=$minor \
clean clean
sudo rm $prefix/bin/fm_db_sync_event_suppression.py \ rm $STX_BIN_DIR/fm_db_sync_event_suppression.py \
$prefix/include/fmConfig.h \ $STX_INST_DIR/include/fmConfig.h \
$prefix/include/fmLog.h $STX_INST_DIR/include/fmLog.h
popd popd
} }
@ -144,10 +147,9 @@ function cleanup_fm_mgr {
pushd $STX_FAULT_DIR/fm-mgr/sources pushd $STX_FAULT_DIR/fm-mgr/sources
sudo make \ make \
BIN_DIR=/bin \ DESTDIR=$STX_INST_DIR \
LIB_DIR=/lib \ BINDIR=/bin \
INC_DIR=/include \
MAJOR=$major \ MAJOR=$major \
MINOR=$minor \ MINOR=$minor \
clean clean
@ -277,16 +279,13 @@ function install_fm_common {
build_fm_common $major $minor build_fm_common $major $minor
# Set up the destinations # install to STX_INST_DIR
# Making an assumption here about STX_BIN_DIR having ../include be valid # Note that DESTDIR prefixes the other locations in the Makefile
local prefix=${STX_BIN_DIR%/*} make \
DESTDIR=$STX_INST_DIR \
# install BINDIR=/bin \
sudo make \ LIBDIR=/lib \
DEST_DIR=$prefix \ INCDIR=/include \
BIN_DIR=/bin \
LIB_DIR=/lib \
INC_DIR=/include \
MAJOR=$major \ MAJOR=$major \
MINOR=$minor \ MINOR=$minor \
install install
@ -297,17 +296,17 @@ function install_fm_common {
--prefix=/usr \ --prefix=/usr \
--install-data=/usr/share \ --install-data=/usr/share \
# This _is_ nasty, clean it up # This _is_ still a little nasty, clean it up
sudo install -m 755 fm_db_sync_event_suppression.py \ install -m 755 fm_db_sync_event_suppression.py \
$prefix/bin/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 # install the headers that used by fm-mgr package
sudo install -m 644 -p -D fmConfig.h $prefix/include/fmConfig.h install -m 644 -p -D fmConfig.h $STX_INST_DIR/include/fmConfig.h
sudo install -m 644 -p -D fmLog.h $prefix/include/fmLog.h install -m 644 -p -D fmLog.h $STX_INST_DIR/include/fmLog.h
# Make sure we can find it later # Make sure we can find it later
# TODO: this should be managed better # 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 sudo ldconfig
popd popd
} }
@ -324,11 +323,11 @@ function install_fm_mgr {
build_fm_mgr $major $minor build_fm_mgr $major $minor
# install # install to STX_INST_DIR
sudo make \ # Note that DESTDIR prefixes the other locations in the Makefile
BIN_DIR=/bin \ make \
LIB_DIR=/lib \ DESTDIR=$STX_INST_DIR \
INC_DIR=/include \ BINDIR=/bin \
MAJOR=$major \ MAJOR=$major \
MINOR=$minor \ MINOR=$minor \
install install

View File

@ -17,6 +17,11 @@ STX_FAULT_NAME=stx-fault
######### Plugin Specific ########## ######### Plugin Specific ##########
enable_service $STX_FAULT_NAME 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! # Circular dependencies are fun!
# fm-rest-api has an undeclared dependency on cgtsclient from stx-config # fm-rest-api has an undeclared dependency on cgtsclient from stx-config
# so if that is not present we can't install it # so if that is not present we can't install it
@ -25,6 +30,7 @@ if ! is_service_enabled stx-config; then
fi fi
# but fm-rest-api has its own (declared!) external dependencies too # but fm-rest-api has its own (declared!) external dependencies too
if is_service_enabled fm-rest-api; then if is_service_enabled fm-rest-api; then
# stx-update
enable_service tsconfig enable_service tsconfig
fi fi