Newer
Older
#!/bin/bash -xe
# Cleaning pre compilation
/usr/bin/rm -rf ${TOP_DIR}/BUILD/* ${TOP_DIR}/RPMS/* ${TOP_DIR}/SRPMS/* ${TOP_DIR}/SOURCES/* ${TOP_DIR}/BUILDROOT/*
# retrieving sources
/usr/bin/git clone -b ${SSP_VERSION} ${SSP_URL} ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}
/usr/bin/sed -i "s|^Name:.*|Name: slurm-spank-plugins|g" ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}/slurm-spank-plugins.spec
/usr/bin/sed -i "s|^Version:.*|Version: ${SSP_VERSION_SPEC}|g" ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}/slurm-spank-plugins.spec
/usr/bin/sed -i "s|^Release:.*|Release: ${SSP_RELEASE_SPEC}|g" ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}/slurm-spank-plugins.spec
/usr/bin/sed -i "/^BuildRequires: libbitmask libcpuset/d" ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}/slurm-spank-plugins.spec
/usr/bin/cp ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}/slurm-spank-plugins.spec ${TOP_DIR}/SPECS/slurm-spank-plugins.spec
tar --exclude-vcs --totals --create --verbose --gz --file ${TOP_DIR}/SOURCES/slurm-spank-plugins-${SSP_VERSION}.tar.gz -C ${TOP_DIR}/SOURCES/ slurm-spank-plugins-${SSP_VERSION}
# installing dependencies
/bin/yum makecache fast
/usr/bin/touch /var/lib/rpm/*
/usr/bin/cp ${TOP_DIR}/rpmmacros ~/.rpmmacros
/usr/bin/echo "${SSP_BUILD_DEP_OPTIONS}" | /usr/bin/xargs /bin/yum-builddep -y ${TOP_DIR}/SPECS/slurm-spank-plugins.spec
# compiling rpm
/usr/bin/rpmbuild --clean --target=${SSP_DEST_ARCH} ${SSP_BUILD_OPTIONS} -ba ${TOP_DIR}/SPECS/slurm-spank-plugins.spec
# moving rpms to artifacts directories
/usr/bin/find ${TOP_DIR}/RPMS/ -type f -iname "*.rpm" -exec /usr/bin/cp -v {} ${TOP_DIR}/ARTIFACTS/ \;
# installing result to be used when compiling SSP
/usr/bin/yum install -y ${TOP_DIR}/ARTIFACTS/*
# Cleaning post compilation
/usr/bin/rm -rf ${TOP_DIR}/BUILD/* ${TOP_DIR}/RPMS/* ${TOP_DIR}/SRPMS/* ${TOP_DIR}/SOURCES/* ${TOP_DIR}/BUILDROOT/*