blob: 78fdb908c5ea34a88c3de26f8b4f69a20e8ad831 [file] [log] [blame]
%define _topdir @CMAKE_CURRENT_BINARY_DIR@/@GPDB_VERSION@
%define __os_install_post %{nil}
%define _rpmfilename @MADLIB_GPPKG_RPM_FILE_NAME@
%define _unpackaged_files_terminate_build 0
%define _madlib_version @MADLIB_VERSION_STRING@
BuildRoot: @MADLIB_GPPKG_RPM_SOURCE_DIR@
Summary: Apache MADlib for @GPDB_VARIANT@ Database
License: @CPACK_RPM_PACKAGE_LICENSE@
Name: madlib
Version: @MADLIB_VERSION_STRING_NO_HYPHEN@
Release: @MADLIB_GPPKG_RELEASE_NUMBER@
Group: @CPACK_RPM_PACKAGE_GROUP@
Prefix: /usr/local
AutoReq: no
AutoProv: no
BuildArch: @CPACK_RPM_PACKAGE_ARCHITECTURE@
Provides: /bin/sh
%description
@CPACK_RPM_PACKAGE_DESCRIPTION@
%prep
:
%install
# rpmbuild deprecates "BuildRoot" tag after v4.6
# Newer rpmbuild uses a default build root, which is different
# from the file directory that we use. This "if" actually checks
# whether it is the newer rpmbuild. For older versions of rpmbuild,
# we do not need to create the symbolic link.
if [ ! @MADLIB_GPPKG_RPM_SOURCE_DIR@ -ef $RPM_BUILD_ROOT ]
then
# On some systems (gpcloud), rpmbuild automatically creates the
# default build root directory, but on some other systems, rpmbuild
# does not do this. We need to make sure that this folder exists,
# and then we can proceed to create the link in the next step.
mkdir -p $RPM_BUILD_ROOT
# Newer rpmbuild ignores "BuildRoot" tag in spec file (it is deprecated)
# and uses a default build root, which can be changed in ~/.rpmrc file.
# Since we cannot change ~/.rpmrc file, we can just create a link in the
# new build root pointing to the file directory that we want to use,
# which is the ".../usr" folder.
ln -s @MADLIB_GPPKG_RPM_SOURCE_DIR@/* $RPM_BUILD_ROOT/
fi
%post
# GPPKG version is setup with underscore replacing a hyphen but
# the actual directories created on disk use the hyphenated version.
# Hence we replace the underscore to link to the right location
MADLIB_VERSION=%{_madlib_version}
ln -nsf $RPM_INSTALL_PREFIX/madlib/Versions/$MADLIB_VERSION $RPM_INSTALL_PREFIX/madlib/Current
ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/bin $RPM_INSTALL_PREFIX/madlib/bin
ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/doc $RPM_INSTALL_PREFIX/madlib/doc
# creating symlink for madpack (does not work at present)
# find $RPM_INSTALL_PREFIX/bin/madpack -type f -exec mv {} $RPM_INSTALL_PREFIX/bin/old_madpack \; 2>/dev/null
# ln -nsf $RPM_INSTALL_PREFIX/madlib/Current/bin/madpack $RPM_INSTALL_PREFIX/bin/madpack
%files
%((cd "@MADLIB_GPPKG_RPM_SOURCE_DIR@@CPACK_PACKAGING_INSTALL_PREFIX@" && find . \( -type f -or -type l \) | grep -E -v "^\./ports/.*" && find ./ports/@PORT_NAME@ \( -type f -or -type l \) | grep -E -v "^\./ports/@PORT_NAME@/[[:digit:]]+\.[[:digit:]]+.*/.*" && find ./ports/@PORT_NAME@/@GPDB_VERSION@ \( -type f -or -type l \)) | cut -c 2- | awk '{ print "\"@CPACK_PACKAGING_INSTALL_PREFIX@" $0 "\""}')