Merge "Ceph build script improvements to prevent needless rebuilds"

This commit is contained in:
Zuul 2019-05-29 04:21:20 +00:00 committed by Gerrit Code Review
commit 05bf7be027
2 changed files with 50 additions and 28 deletions

View File

@ -249,22 +249,16 @@ if [[ ! -f "$SPEC_PATH" ]]; then
exit 1 exit 1
fi 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` RELEASE=`spec_find_tag Release "$SPEC_PATH" 2>> /dev/null`
if [ $? -ne 0 ]; then 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 fi
NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null` NAME=`spec_find_tag Name "$SPEC_PATH" 2>> /dev/null`
if [ $? -ne 0 ]; then 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 fi
SRPM="$NAME-$VERSION-$RELEASE.src.rpm" SRPM="$NAME-$VERSION-$RELEASE.src.rpm"
SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM" SRPM_PATH="$BUILD_DIR/SRPMS/$SRPM"
@ -284,6 +278,7 @@ else
BUILD_NEEDED=1 BUILD_NEEDED=1
fi fi
RC=0
if [ $BUILD_NEEDED -gt 0 ]; then if [ $BUILD_NEEDED -gt 0 ]; then
echo "ceph customization build_srpm : ceph spec file : $SPEC_PATH" 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 : SRPM build directory : $BUILD_DIR"
@ -296,6 +291,13 @@ ls -la $SOURCE_PATH
echo "ceph customization build_srpm : start to build ceph SRPM " echo "ceph customization build_srpm : start to build ceph SRPM "
rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis" rpmbuild -bs $SPEC_PATH --define="%_topdir $BUILD_DIR" --undefine=dist --define="_tis_dist .tis"
RC=$?
else else
echo "SRPM build not needed" echo "SRPM build not needed"
fi 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

View File

@ -1,6 +1,26 @@
SRC_DIR="$CGCS_BASE/git/ceph" SRC_DIR="$STX_BASE/git/ceph"
DOWNLOADS_DIR="$CGCS_BASE/downloads" DOWNLOADS_DIR="$STX_BASE/downloads"
COPY_LIST="files/* $DISTRO/patches/*" 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_BASE_SRCREV=02899bfda814146b021136e9d8e80eba494e1126
TIS_PATCH_VER=GITREVCOUNT+1 TIS_PATCH_VER=GITREVCOUNT+1
BUILD_IS_BIG=40 BUILD_IS_BIG=40