blob: 78fdb908c5ea34a88c3de26f8b4f69a20e8ad831 [file] [log] [blame]
%define __os_install_post %{nil}
%define _rpmfilename @MADLIB_GPPKG_RPM_FILE_NAME@
%define _unpackaged_files_terminate_build 0
%define _madlib_version @MADLIB_VERSION_STRING@
Summary: Apache MADlib for @GPDB_VARIANT@ Database
Name: madlib
Prefix: /usr/local
AutoReq: no
AutoProv: no
Provides: /bin/sh
# 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.
# 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.
# 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
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
%((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 "\""}')