mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	update build script to build from git
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@17032 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
		
							
								
								
									
										117
									
								
								buildcore.sh
									
									
									
									
									
								
							
							
						
						
									
										117
									
								
								buildcore.sh
									
									
									
									
									
								
							| @@ -18,7 +18,8 @@ | ||||
| #  - Run this script from the local svn repository you just created.  It will create the other | ||||
| #    directories that are needed. | ||||
|  | ||||
| # Usage:  buildcore.sh [attr=value attr=value ...] | ||||
| # Usage:  buildcore.sh BRANCH=<branch> [attr=value attr=value ...] | ||||
| #       BRANCH=<branch> - the branch within the git repo that should be built.  This arg is required for git. | ||||
| #		PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release.  This does not | ||||
| #					actually build xcat, just uploads the most recent snap build to https://sourceforge.net/projects/xcat/files/xcat/ . | ||||
| #					If not specified, a snap build is assumed, which uploads to https://sourceforge.net/projects/xcat/files/yum/ | ||||
| @@ -31,7 +32,7 @@ | ||||
| #		BUILDALL=1 - build all rpms, whether they changed or not.  Should be used for snap builds that are in prep for a release. | ||||
| # 		UP=0 or UP=1 - override the default upload behavior  | ||||
| # 		SVNUP=<filename> - control which rpms get built by specifying a coresvnup file | ||||
| #       FRSYUM=0 - put the yum repo and snap builds in the old project web area instead of the FRS area. | ||||
| # 		GITUP=<filename> - control which rpms get built by specifying a coregitup file | ||||
| #		EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex | ||||
| #		VERBOSE=1 - to see lots of verbose output | ||||
|  | ||||
| @@ -69,6 +70,10 @@ if [ -z "$REL" ]; then | ||||
| 	D=${curdir%/src/xcat-core} | ||||
| 	REL=`basename $D` | ||||
| fi | ||||
| if [ "$REL" = "xcat-core" -a -z "$BRANCH" ]; then			# using git but they didnt specify BRANCH | ||||
| 	echo "Error: must specify BRANCH=<branch> when building a git repository.  Exiting...." | ||||
| 	exit 1 | ||||
| fi | ||||
| OSNAME=$(uname) | ||||
|  | ||||
| if [ "$OSNAME" != "AIX" ]; then | ||||
| @@ -84,14 +89,8 @@ if [ "$OSNAME" != "AIX" ]; then | ||||
| 	export HOME=/root		# This is so rpm and gpg will know home, even in sudo | ||||
| fi | ||||
|  | ||||
| # this is needed only when we are transitioning the yum over to frs | ||||
| if [ "$FRSYUM" != 0 ]; then | ||||
| 	YUMDIR=$FRS | ||||
| 	YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum" | ||||
| else | ||||
| 	YUMDIR=htdocs | ||||
| 	YUMREPOURL="http://xcat.sourceforge.net/yum" | ||||
| fi | ||||
| YUMDIR=$FRS | ||||
| YUMREPOURL="https://sourceforge.net/projects/xcat/files/yum" | ||||
|  | ||||
| # Set variables based on which type of build we are doing | ||||
| if [ -n "$EMBED" ]; then | ||||
| @@ -116,26 +115,7 @@ else | ||||
| fi | ||||
|  | ||||
| XCATCORE="xcat-core"		# core-snap is a sym link to xcat-core | ||||
| echo "svn --quiet up Version" | ||||
| svn --quiet up Version | ||||
| VER=`cat Version` | ||||
| SHORTVER=`cat Version|cut -d. -f 1,2` | ||||
| SHORTSHORTVER=`cat Version|cut -d. -f 1` | ||||
| if [ "$PROMOTE" = 1 ]; then | ||||
| 	CORE="xcat-core" | ||||
| 	if [ "$OSNAME" = "AIX" ]; then | ||||
| 		TARNAME=core-aix-$VER.tar.gz | ||||
| 	else | ||||
| 		TARNAME=xcat-core-$VER.tar.bz2 | ||||
| 	fi | ||||
| else | ||||
| 	CORE="core-snap" | ||||
| 	if [ "$OSNAME" = "AIX" ]; then | ||||
| 		TARNAME=core-aix-snap.tar.gz | ||||
| 	else | ||||
| 		TARNAME=core-rpms-snap.tar.bz2 | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
| DESTDIR=../..$EMBEDDIR/$XCATCORE | ||||
| SRCD=core-snap-srpms | ||||
|  | ||||
| @@ -148,6 +128,13 @@ fi | ||||
|  | ||||
|  | ||||
| if [ "$PROMOTE" != 1 ]; then      # very long if statement to not do builds if we are promoting | ||||
| # we are doing a snap build | ||||
| CORE="core-snap" | ||||
| if [ "$OSNAME" = "AIX" ]; then | ||||
| 	TARNAME=core-aix-snap.tar.gz | ||||
| else | ||||
| 	TARNAME=core-rpms-snap.tar.bz2 | ||||
| fi | ||||
| mkdir -p $DESTDIR | ||||
| SRCDIR=$DESTDIR/../$SRCD | ||||
| mkdir -p $SRCDIR | ||||
| @@ -168,17 +155,51 @@ else | ||||
| 	#echo "source=$source" | ||||
| fi | ||||
|  | ||||
| # If they have not given us a premade update file, do an svn update and capture the results | ||||
| if [ -z "$SVNUP" ]; then | ||||
| 	SVNUP=../coresvnup | ||||
| 	echo "svn up > $SVNUP" | ||||
| 	svn up > $SVNUP | ||||
| fi | ||||
| # for the git case, set the current branch and also set REL (changing master to devel if necessary) | ||||
| function setbranch { | ||||
| 	git checkout $BRANCH | ||||
| 	#REL=`git rev-parse --abbrev-ref HEAD` | ||||
| 	REL=$BRANCH | ||||
| 	if [ "$REL" = "master" ]; then | ||||
| 		REL="devel" | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| # If they have not given us a premade update file, do an svn update or git pull and capture the results | ||||
| SOMETHINGCHANGED=0 | ||||
| if ! $GREP 'At revision' $SVNUP; then | ||||
| 	SOMETHINGCHANGED=1 | ||||
| if [ "$REL" = "xcat-core" ]; then			# using git | ||||
| 	GIT=1 | ||||
| 	setbranch | ||||
| 	if [ -z "$GITUP" ]; then | ||||
| 		GITUP=../coregitup | ||||
| 		echo "git pull > $GITUP" | ||||
| 		git pull > $GITUP | ||||
| 	fi | ||||
| 	if ! $GREP 'Already up-to-date' $GITUP; then | ||||
| 		SOMETHINGCHANGED=1 | ||||
| 	fi | ||||
| else		# using svn | ||||
| 	GIT=0 | ||||
| 	if [ -z "$SVNUP" ]; then | ||||
| 		SVNUP=../coresvnup | ||||
| 		echo "svn up > $SVNUP" | ||||
| 		svn up > $SVNUP | ||||
| 	fi | ||||
| 	if ! $GREP 'At revision' $SVNUP; then | ||||
| 		SOMETHINGCHANGED=1 | ||||
| 	fi | ||||
| 	# copy the SVNUP variable to GITUP so the rest of the script doesnt have to worry whether we did svn or git | ||||
| 	GITUP=$SVNUP | ||||
| fi | ||||
|  | ||||
| function setversionvars { | ||||
| 	VER=`cat Version` | ||||
| 	SHORTVER=`cat Version|cut -d. -f 1,2` | ||||
| 	SHORTSHORTVER=`cat Version|cut -d. -f 1` | ||||
| } | ||||
|  | ||||
| setversionvars | ||||
|  | ||||
| # Function for making the noarch rpms | ||||
| function maker { | ||||
| 	rpmname="$1" | ||||
| @@ -194,7 +215,7 @@ function maker { | ||||
| } | ||||
|  | ||||
| # If anything has changed, we should always rebuild perl-xCAT | ||||
| if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then		# Use to be:  $GREP perl-xCAT $SVNUP; then | ||||
| if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then		# Use to be:  $GREP perl-xCAT $GITUP; then | ||||
| 	if [[ " $EMBEDBUILD " = *\ perl-xCAT\ * ]]; then | ||||
| 		UPLOAD=1 | ||||
| 		maker perl-xCAT | ||||
| @@ -210,7 +231,7 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xC | ||||
| 	#if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then continue; fi		# for zvm embedded env only need to build server and UI | ||||
| 	if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi | ||||
| 	if [ "$OSNAME" = "AIX" -a "$rpmname" = "xCAT-buildkit" ]; then continue; fi		# do not build xCAT-buildkit on aix | ||||
| 	if $GREP $rpmname $SVNUP || [ "$BUILDALL" == 1 ]; then | ||||
| 	if $GREP $rpmname $GITUP || [ "$BUILDALL" == 1 ]; then | ||||
| 		UPLOAD=1 | ||||
| 		maker $rpmname | ||||
| 	fi | ||||
| @@ -225,7 +246,7 @@ done | ||||
| # The mknb cmd combines them at install time. | ||||
| if [ "$OSNAME" != "AIX" ]; then | ||||
| 	if [[ " $EMBEDBUILD " = *\ xCAT-genesis-scripts\ * ]]; then | ||||
| 		if $GREP xCAT-genesis-scripts $SVNUP || [ "$BUILDALL" == 1 ]; then | ||||
| 		if $GREP xCAT-genesis-scripts $GITUP || [ "$BUILDALL" == 1 ]; then | ||||
| 			UPLOAD=1 | ||||
| 			ORIGFAILEDRPMS="$FAILEDRPMS" | ||||
| 			./makerpm xCAT-genesis-scripts x86_64 "$EMBED" | ||||
| @@ -244,7 +265,7 @@ fi | ||||
| for rpmname in xCAT xCATsn xCAT-OpenStack; do | ||||
| 	#if [ "$EMBED" = "zvm" ]; then break; fi | ||||
| 	if [[ " $EMBEDBUILD " != *\ $rpmname\ * ]]; then continue; fi | ||||
| 	if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then		# used to be:  if $GREP -E "^[UAD] +$rpmname/" $SVNUP; then | ||||
| 	if [ $SOMETHINGCHANGED == 1 -o "$BUILDALL" == 1 ]; then		# used to be:  if $GREP -E "^[UAD] +$rpmname/" $GITUP; then | ||||
| 		UPLOAD=1 | ||||
| 		ORIGFAILEDRPMS="$FAILEDRPMS" | ||||
| 		if [ "$OSNAME" = "AIX" ]; then | ||||
| @@ -356,7 +377,17 @@ chmod -R g+w $DESTDIR | ||||
| chgrp -R xcat $SRCDIR | ||||
| chmod -R g+w $SRCDIR | ||||
|  | ||||
| fi		# end of very long if-not-promote | ||||
| else		# end of very long if-not-promote | ||||
| 	# we are only promoting (not building) | ||||
| 	setversionvars | ||||
| 	setbranch | ||||
| 	CORE="xcat-core" | ||||
| 	if [ "$OSNAME" = "AIX" ]; then | ||||
| 		TARNAME=core-aix-$VER.tar.gz | ||||
| 	else | ||||
| 		TARNAME=xcat-core-$VER.tar.bz2 | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
| cd $DESTDIR | ||||
|  | ||||
|   | ||||
| @@ -1,33 +1,20 @@ | ||||
| #!/bin/sh | ||||
| # Put the version, svn revision #, and build date into the Version function in Version.pm | ||||
|  | ||||
| if [ -z "$2" ] | ||||
| if [ -z "$1" ] | ||||
| 	then | ||||
| 	echo "modifyUtils:  Error:  must specify the xCAT version and svn revision number as arguments" >&2 | ||||
| 	echo "modifyUtils:  Error:  must specify the xCAT version as an argument" >&2 | ||||
| 	exit | ||||
| fi | ||||
|  | ||||
| VER=$1 | ||||
| SVNREF="svn r$2, " | ||||
|  | ||||
| #SVNINFO=`svn info 2>/dev/null|grep Revision` | ||||
| #/bin/echo -e $SVNINFO | ||||
| #if [ $? -ne 0 -a -f .svninfo ]; then | ||||
| #    SVNINFO=`cat .svninfo 2>/dev/null|grep Revision` | ||||
| #fi | ||||
| #if [ $? -eq 0 ] | ||||
| #	then | ||||
| #		SVNREF="svn r"`echo $SVNINFO|awk '{print $2}'`", " | ||||
| #	else | ||||
| #		SVNREF="" | ||||
| #	fi | ||||
|  | ||||
| BUILDDATE=`date` | ||||
| #echo ". '(${SVNREF}built $BUILDDATE)'" | ||||
| #echo ". '(built $BUILDDATE)'" | ||||
|  | ||||
| if [ "$(uname)" = "AIX" ] | ||||
| then | ||||
| 	sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new | ||||
| 	sed -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ xCAT/Version.pm >xCAT/Version.pm.new | ||||
| 	mv xCAT/Version.pm.new xCAT/Version.pm | ||||
| else | ||||
|         if [ -f "/etc/debian_version" ];then | ||||
| @@ -35,5 +22,5 @@ else | ||||
|         else | ||||
|             FILENAME="xCAT/Version.pm" | ||||
|         fi | ||||
| 	sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (${SVNREF}built $BUILDDATE)'"/ $FILENAME | ||||
| 	sed -i -e s/"#XCATVERSIONSUBHERE"/". '$VER'"/ -e s/"#XCATSVNBUILDSUBHERE"/". ' (built $BUILDDATE)'"/ $FILENAME | ||||
| fi | ||||
|   | ||||
| @@ -25,7 +25,6 @@ Includes xCAT::Table, xCAT::NodeRange, among others. | ||||
|  | ||||
| %define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi) | ||||
| %define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi) | ||||
| %define svninfo %(svn info | grep Revision | awk '{print $2}') | ||||
|  | ||||
| %prep | ||||
| %setup -q -n perl-xCAT | ||||
| @@ -37,7 +36,7 @@ Includes xCAT::Table, xCAT::NodeRange, among others. | ||||
| %if %fsm | ||||
| %else | ||||
| # Modify the Version() function in xCAT/Utils.pm to automatically have the correct version | ||||
| ./modifyUtils %{version} %{svninfo} | ||||
| ./modifyUtils %{version} | ||||
|  | ||||
| # Build the pod version of the man pages for each DB table.  It puts them in the man5 and man7 subdirs. | ||||
| # Then convert the pods to man pages and html pages. | ||||
|   | ||||
		Reference in New Issue
	
	Block a user