awips2/rpms/python.site-packages/Installer.qpid/component.spec

119 lines
3 KiB
RPMSpec
Raw Normal View History

# spec file
Summary: python client commands for a qpid cluster
Name: awips2-python-qpid
Version: 0.6
Release: 4
License: APL
Group: AWIPSII
BuildRoot: %{_build_root}
Vendor: Raytheon
Packager: John Clark
AutoReq: no
requires: awips2-python
provides: awips2-python-qpid
%description
Python command line tools to manage Qpid built with cluster support
# Turn off the brp-python-bytecompile script
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%prep
# Verify That The User Has Specified A BuildRoot.
if [ "%{_build_root}" = "/tmp" ]
then
echo "An Actual BuildRoot Must Be Specified. Use The --buildroot Parameter."
echo "Unable To Continue ... Terminating"
exit 1
fi
rm -rf %{_build_root}
mkdir -p %{_build_root}
mkdir -p %{_build_root}/build-python
SRC_TAR_DIR="${WORKSPACE_DIR}/pythonPackages/qpid"
SRC_TAR="qpid-0.6.tar.gz"
SRC_BIN_DIR="${SRC_TAR_DIR}/bin"
cp -v ${SRC_TAR_DIR}/${SRC_TAR} \
%{_build_root}/build-python
if [ $? -ne 0 ]; then
exit 1
fi
pushd . > /dev/null
cd %{_build_root}/build-python
tar -xvf ${SRC_TAR}
if [ $? -ne 0 ]; then
exit 1
fi
cp -v ${SRC_BIN_DIR}/* \
%{_build_root}/build-python/qpid-0.6/python/commands
if [ $? -ne 0 ]; then
exit 1
fi
rm -fv ${SRC_TAR}
if [ $? -ne 0 ]; then
exit 1
fi
%build
# NOTE: python setup.py install -- the install is broken,
# because the amqp dtd/xml didn't get handled correctly
# that is why I am using the make build and doing the cleanup in post
cd %{_build_root}/build-python/qpid-0.6/python/
make build PREFIX=%{prefix}
if [ $? -ne 0 ]; then
exit 1
fi
%install
cd %{_build_root}/build-python/qpid-0.6/python/
make install PREFIX=%{_build_root}/awips2/python
if [ $? -ne 0 ]; then
exit 1
fi
# none of the amqp spec got installed correctly
# to resolve this manually copy the amqp dtd/xml data
mkdir -p %{_build_root}/awips2/python/share/amqp
cp -rp %{_build_root}/build-python/qpid-0.6/specs/* \
%{_build_root}/awips2/python/share/amqp/
if [ $? -ne 0 ]; then
exit 1
fi
rm -rf %{_build_root}/build-python
if [ $? -ne 0 ]; then
exit 1
fi
%pre
%post
# get the path to the awips2-python that is installed
PYDIR="/awips2/python"
# get the python version so we can fix the amqp xml/dtd
PYTHON_VERSION=$( LD_LIBRARY_PATH=${PYDIR}/lib ${PYDIR}/bin/python -c "from distutils.sysconfig import get_python_version; print get_python_version()" )
# the file ${RPM_INSTALL_PREFIX}/lib/python$PYTHON_VERSION/site-packages/qpid_config.py is wrong
# this substitution will put the correct path in the file qpid_config.py
# otherwise it will generate AMQP errors when run, it won't find the directory
sed -i "s|^AMQP_SPEC_DIR=.*/share/amqp\"|AMQP_SPEC_DIR=\"${PYDIR}/share/amqp\"|g" \
${PYDIR}/lib/python${PYTHON_VERSION}/site-packages/qpid_config.py
%preun
%postun
%clean
rm -rf ${RPM_BUILD_ROOT}
%files
%defattr(644,awips,fxalpha,755)
/awips2/python/lib/python2.7/site-packages/*
/awips2/python/share/*
%defattr(755,awips,fxalpha,755)
/awips2/python/bin/*