Ceph build script improvements to prevent needless rebuilds
Problem: The file $SRC_DIR/src/.git_version is created by the custom build script and is not cleaned upon exit. The presence of the new file under $SRC_DIR will trigger a rebuild on the next iteration. Solution: Add a cleanup of the file to cover the normal exit case. This means $SRC_DIR/src/.git_version will not be present at the start of the next build. Problem: A lot of tarballs are copied into the build by the build script, rather than being listed in the COPY_LIST. This breaks the md5 checksum mechanism used to determine if a rebuild is required. A change to a tarball will be ignored and not trigger a rebuild. Solution: Move the code that generates the list of input tarballs into build_srpm.data. The file is sourced, so COPY_LIST can be populated dynamically. Problem: Script returns success when rpmbuild fails. Solution: Propogate the error code to the final exit. Change-Id: I2e760c24ecd3ce2d237863b948863c2a876d24fa Closes-Bug: 1830130 Co-authored-by: Shuicheng Lin <shuicheng.lin@intel.com> Signed-off-by: Scott Little <scott.little@windriver.com>
This commit is contained in:
parent
6bd45c96dd
commit
663edb4567
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user