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_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

View File

@ -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