diff --git a/ceph/ceph/centos/build_srpm b/ceph/ceph/centos/build_srpm index b7eaa7a0c..f2b810d34 100755 --- a/ceph/ceph/centos/build_srpm +++ b/ceph/ceph/centos/build_srpm @@ -249,53 +249,55 @@ if [[ ! -f "$SPEC_PATH" ]]; then exit 1 fi -BOOST_TAR=$(sed -n 's/^Source.*:\s*\(boost_.*\.tar\.bz2\)/\1/p' "$SPEC_PATH") -echo "ceph customization build_srpm : copy boost library ${DOWNLOADS_DIR}/${BOOST_TAR}to $SOURCE_PATH" -cp "${DOWNLOADS_DIR}/${BOOST_TAR}" "$SOURCE_PATH" -for submodule in $(sed -n 's/^Source.*:\s*\(.*\.tar\.gz\)/\1/p' "$SPEC_PATH"); do - echo "ceph customization build_srpm : copy submodule ${DOWNLOADS_DIR}/$(basename ${submodule}) $SOURCE_PATH" - cp "${DOWNLOADS_DIR}/$(basename ${submodule})" "$SOURCE_PATH" -done - RELEASE=`spec_find_tag Release "$SPEC_PATH" 2>> /dev/null` if [ $? -ne 0 ]; then -echo "ERROR: ceph customiztion build_srpm (${LINENO}): 'Release' not found in '$SPEC_PATH'" + echo "ERROR: ceph customiztion build_srpm (${LINENO}): 'Release' not found in '$SPEC_PATH'" fi + NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` if [ $? -ne 0 ]; then -echo "ERROR: ceph customization build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" + echo "ERROR: ceph customization build_srpm (${LINENO}): 'Name' not found in '$SPEC_PATH'" fi + SRPM="$NAME-$VERSION-$RELEASE.src.rpm" SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM" spec_validate_tis_release $SPEC_PATH if [ $? -ne 0 ]; then -echo "ceph customization build_srpm : Validation of $SPEC_PATH failed" -exit 1 + echo "ceph customization build_srpm : Validation of $SPEC_PATH failed" + exit 1 fi BUILD_NEEDED=0 if [ -e $SRPM_PATH ]; then -n=`find . -cnewer $SRPM_PATH | wc -l` -if [ $n -gt 0 ]; then + n=`find . -cnewer $SRPM_PATH | wc -l` + if [ $n -gt 0 ]; then + BUILD_NEEDED=1 + fi +else BUILD_NEEDED=1 fi -else -BUILD_NEEDED=1 -fi +RC=0 if [ $BUILD_NEEDED -gt 0 ]; then -echo "ceph customization build_srpm : ceph spec file : $SPEC_PATH" -echo "ceph customization build_srpm : SRPM build directory : $BUILD_DIR" -echo "ceph customization build_srpm : TIS_PATCH_VER : $TIS_PATCH_VER" + echo "ceph customization build_srpm : ceph spec file : $SPEC_PATH" + echo "ceph customization build_srpm : SRPM build directory : $BUILD_DIR" + echo "ceph customization build_srpm : TIS_PATCH_VER : $TIS_PATCH_VER" -sed -i -e "1 i%define _tis_build_type $BUILD_TYPE" $SPEC_PATH -sed -i -e "1 i%define tis_patch_ver $TIS_PATCH_VER" $SPEC_PATH + sed -i -e "1 i%define _tis_build_type $BUILD_TYPE" $SPEC_PATH + sed -i -e "1 i%define tis_patch_ver $TIS_PATCH_VER" $SPEC_PATH -ls -la $SOURCE_PATH + ls -la $SOURCE_PATH -echo "ceph customization build_srpm : start to build ceph SRPM " -rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis" + echo "ceph customization build_srpm : start to build ceph SRPM " + rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis" + RC=$? else -echo "SRPM build not needed" + echo "SRPM build not needed" fi + +# .git_version file is generated for ceph build. +# Remove this file after srpm is generated, to avoid srpm rebuild is triggered next time. +\rm -f ${SRC_DIR}/src/.git_version + +exit $RC diff --git a/ceph/ceph/centos/build_srpm.data b/ceph/ceph/centos/build_srpm.data index 36c89c4e3..c5b4417e0 100644 --- a/ceph/ceph/centos/build_srpm.data +++ b/ceph/ceph/centos/build_srpm.data @@ -1,6 +1,26 @@ -SRC_DIR="$CGCS_BASE/git/ceph" -DOWNLOADS_DIR="$CGCS_BASE/downloads" +SRC_DIR="$STX_BASE/git/ceph" +DOWNLOADS_DIR="$STX_BASE/downloads" COPY_LIST="files/* $DISTRO/patches/*" + +# Add to COPY_LIST any tarballs listed in spec +CEPH_SPEC_PATH="$PKG_BASE/$DISTRO/ceph.spec" + +BOOST_TAR=$(sed -n 's/^Source.*:\s*\(boost_.*\.tar\.bz2\)/\1/p' "$CEPH_SPEC_PATH") +echo "ceph COPY_LIST, adding ${DOWNLOADS_DIR}/$BOOST_TAR" +COPY_LIST+=" ${DOWNLOADS_DIR}/$BOOST_TAR" +for submodule in $(grep 'Source[0-9]*:.*[.]tar[.]gz' "$CEPH_SPEC_PATH" | \ + grep -v Source0: | \ + sed 's/^Source.*:\s*\(.*\.tar\.gz\)/\1/'); do + echo "ceph COPY_LIST, adding ${DOWNLOADS_DIR}/$(basename ${submodule})" + COPY_LIST+=" ${DOWNLOADS_DIR}/$(basename ${submodule})" +done + +# Before we exit, remove the .git_version file that is created by the build, +# and might be left behind by a prior aborted build. +if [ -f ${SRC_DIR}/src/.git_version ]; then + \rm ${SRC_DIR}/src/.git_version +fi + TIS_BASE_SRCREV=02899bfda814146b021136e9d8e80eba494e1126 TIS_PATCH_VER=GITREVCOUNT+1 BUILD_IS_BIG=40