2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Check for uncommitted and modified files in the git repository before

running the build and abort if the build repo is not clean

Add a check for xCAT-UI to undo the sed that is done during the build
to leave the build repo clean
This commit is contained in:
Victor Hu 2015-05-26 10:30:48 -04:00
parent e63a398bfc
commit f3bfa70f94
2 changed files with 21 additions and 0 deletions

View File

@ -189,6 +189,22 @@ fi
SOMETHINGCHANGED=0
if [ "$GIT" = "1" ]; then
# using git
# Do some error checking for the build before starting...
# check if there's any modifications to git current repo
MODIFIED_FILES=`git ls-files --modified | tr '\n' ', '`
if [ $MODIFIED_FILES ]; then
echo "The following files have been modified in the local repository: $MODIFIED_FILES..."
echo "Not a clean build, aborting..."
exit 3
fi
# check if there's any modifications to git current repo
UNTRACKED_FILES=`git ls-files --others | tr '\n' ', '`
if [ -n $UNTRACKED_FILES ]; then
echo "The following files are not tracked in git: $UNTRACKED_FILES..."
echo "Not a clean build, aborting..."
exit 3
fi
if [ -z "$GITUP" ]; then
GITUP=../coregitup
echo "git pull > $GITUP"

View File

@ -45,6 +45,11 @@ function makenoarch {
rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm
rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz
RC=$?
if [ $RPMNAME = "xCAT-UI" ]; then
# undo the modifications above to leave the sandbox prestine on the build machine
git checkout xCAT-UI/xCAT-UI.spec
fi
fi
}