108 lines
3.5 KiB
Bash
108 lines
3.5 KiB
Bash
#!/bin/bash
|
|
# We Have Been Created To Automate The Building Of The AWIPS II Python Site-Package RPMs.
|
|
|
|
# !! NOTE !! - We Assume That We Are In A Workspace With The Installer Projects
|
|
# And The pythonPackages Project.
|
|
export WORKSPACE_DIR=`cd ../../../; pwd;`
|
|
export RPM_SITE_PACKAGE_LOG_FILE="rpm-build.log"
|
|
export UFRAME_ECLIPSE="/opt/uframe-eclipse"
|
|
export AWIPSCM_SHARE="/awipscm"
|
|
|
|
source ${WORKSPACE_DIR}/Installer.rpm/awips2.core/deploy.builder/env.sh
|
|
|
|
if [ "${RPM_TOP_DIR}" = "" ]; then
|
|
echo "ERROR: You Must Set The RPM_TOP_DIR Environment Variable."
|
|
echo "Unable To Continue ... Terminating."
|
|
exit 1
|
|
fi
|
|
|
|
export AWIPSII_VERSION=`cat ${WORKSPACE_DIR}/Installer.rpm/version.txt`
|
|
export AWIPSII_RELEASE=`date +"%Y%m%d"`
|
|
|
|
export CPPFLAGS="-m32"
|
|
export PYTHON_EXE="/awips2/python/bin/python"
|
|
export LD_LIBRARY_PATH="/awips2/python/lib"
|
|
|
|
# Just In Case python-devel 2.7 is not installed. scipy ignored
|
|
# C++ environment flags.
|
|
if [ ! -f /usr/local/lib/libpython2.7.so ]; then
|
|
# We use to create this; but, we cannot create it as tomcat.
|
|
|
|
# Without this, we will not be able to build every python site-package.
|
|
echo "ERROR: There Is No lpython2.7 In /usr/local/lib."
|
|
echo "Unable To Continue ... Terminating."
|
|
exit 1
|
|
fi
|
|
|
|
# Arguments
|
|
# ${1} == The Directory With The Specs File And Possibly Other Custom
|
|
# Scripts That May Need To Be Merged Into A Component.
|
|
function buildRPM()
|
|
{
|
|
export BUILDROOT_DIR=/tmp/awips-component
|
|
|
|
COMPONENT_DIR=${1}
|
|
COMPONENT_SPECS=${COMPONENT_DIR}/component.spec
|
|
|
|
# We Need To Delete The 'BuildRoot' Directory After Each RPM Is
|
|
# Built Whether The Build Is Successful Or Not.
|
|
rm -rf ${BUILDROOT_DIR}
|
|
|
|
# We Build The List Of Files That Need To Be Installed On-Demand Now.
|
|
# If One Exists From A Previous Build, Delete It.
|
|
if [ -f ${RPM_TOP_DIR}/BUILD/component-files.txt ]; then
|
|
rm -f ${RPM_TOP_DIR}/BUILD/component-files.txt
|
|
fi
|
|
|
|
# Build The RPM.
|
|
rpmbuild -ba --target=i386 \
|
|
--define '_topdir %(echo ${RPM_TOP_DIR})' \
|
|
--define '_baseline_workspace %(echo ${WORKSPACE_DIR})' \
|
|
--define '_uframe_eclipse %(echo ${UFRAME_ECLIPSE})' \
|
|
--define '_awipscm_share %(echo ${AWIPSCM_SHARE})' \
|
|
--define '_build_root %(echo ${BUILDROOT_DIR})' \
|
|
--define '_component_version %(echo ${AWIPSII_VERSION})' \
|
|
--define '_component_release %(echo ${AWIPSII_RELEASE})' \
|
|
--buildroot ${BUILDROOT_DIR} ${COMPONENT_SPECS}
|
|
RC="$?"
|
|
if [ ! "${RC}" = "0" ]; then
|
|
if [ "${COMPONENT_DIR}" = "Installer.dynamciserialize" ] ||
|
|
[ "${COMPONENT_DIR}" = "Installer.ufpy" ]; then
|
|
echo ""
|
|
echo "ERROR: Unable To Build The RPM Defined In: ${COMPONENT_DIR}."
|
|
echo "Unable To Continue ... Terminating."
|
|
exit 1
|
|
fi
|
|
fi
|
|
}
|
|
|
|
function logSuccessOrFailure()
|
|
{
|
|
RC="${1}"
|
|
RPM_COMPONENT="${2}"
|
|
|
|
if [ "${RC}" = "0" ]; then
|
|
echo "SUCCESS: ${RPM_COMPONENT}" >> ${RPM_SITE_PACKAGE_LOG_FILE}
|
|
else
|
|
echo "FAILURE: ${RPM_COMPONENT}" >> ${RPM_SITE_PACKAGE_LOG_FILE}
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
# Note: Presently, We Are In ../../../python.site-packages/deploy.builder
|
|
|
|
# Adjust Our Execution Position.
|
|
cd ../
|
|
|
|
if [ -f ${RPM_SITE_PACKAGE_LOG_FILE} ]; then
|
|
rm -f ${RPM_SITE_PACKAGE_LOG_FILE}
|
|
fi
|
|
touch ${RPM_SITE_PACKAGE_LOG_FILE}
|
|
|
|
# For Now, We Will Only Build The Important RPMs. Will Add An Env Flag That Can Be
|
|
# Set To Force A Build Of Everything.
|
|
buildRPM "Installer.ufpy"
|
|
buildRPM "Installer.dynamicserialize"
|
|
buildRPM "Installer.cherrpy"
|
|
buildRPM "Installer.h5py"
|