FullBuild #1

  • //
  • guest/
  • yariv_sheizaf/
  • scripts/
  • FullBuild
  • View
  • Commits
  • Open Download .zip Download (8 KB)
#!/bin/sh
############################################################################################
# Name		: /public/scripts/FullBuild
# Purpose	: A script to run a full Globecom software build, Based on perforce system
# By		: Yariv Sheizaf
# Date		: 28-Aug-2001 
# Argumnets	:
#			1 - configuration name
#			2 - Build number
#

if [ "$USER" != "cmadm" ]
then
	echo ""
	echo "$0 should be run with user cmadm. Exit..."
	echo ""
	exit 1
fi


HOSTN=`hostname`
if [ "$HOSTN" != "tavola" ]
then
	echo ""
	echo "$0 should be run from host tavola. Exit..."
	echo ""
	exit 1
fi

## Define servers
SUNSRVR="tavola"
LNXSRVR="panino"
INTLSRVR="beygel"

if [ $# -lt 2 ]
then
	echo "Usage: $0 configuration-name Build-number"
	echo "Example: $0 prd_2.0 1.8.6"
	exit 1
fi


CNFNAME=$1

## Check configuration existing in P4 DB
ISCNF="n"
for i in `p4 dirs //Globecom/\* | awk -F/ '{print $NF}'`
do
	if [ "$i" = "$CNFNAME" ]
	then
		ISCNF="y"
	fi
done
if [ "$ISCNF" = "n" ]
then
	echo ""
	echo $CNFNAME" is not a valid configuration. Exit..."
	echo ""
	exit 1
fi

INSDIR="/public/"$CNFNAME"/ins"
if [ ! -d $INSDIR ]
then
	echo ""
	echo $INSDIR" is not exist. Exit..."
	echo "" 
	exit 1
fi

## Set Weblogic deployment server. Actually, tavola for WL-5.1, barbaree for WL-4.5.1
if [ "$CNFNAME" = "dev" ]
then
	WEBLOGICSRVR="tavola"
else
	WEBLOGICSRVR="barbaree"
fi	


BUILDNUM=$2

## Check Z2H label existance
#p4 files @Z2H_Build_$BUILDNUM 1>/dev/null 2>&1
#if [ "$?" != "0" ]
#then
#	echo ""
#	echo "Label Z2H_Build_"$BUILDNUM" not exist. Exit..."
#	echo ""
#	exit 1
#fi

WRKROOTDIR=$HOME"/p4client/Globecom/"$CNFNAME"/Globecom"

# Synchornize to correct Z2H build label
#echo ""
#echo "Synchronize Z2H_Build_"$BUILDNUM
#p4 sync //Globecom/$CNFNAME/Globecom/Z2H/...#none > /dev/null
#rm -rf $WRKROOTDIR/Z2H
#p4 sync //Globecom/$CNFNAME/Globecom/Z2H/...@Z2H_Build_$BUILDNUM > /dev/null

## Prevent write into P4 DB
echo "Set P4 protect to open-only mode"
p4 protect -o > /tmp/$$.p4protect
p4 protect -o | sed 's/write/open/' | p4 protect -i


## Clean working directorties, then put head revision's source files
echo ""
echo "Remove old Globecom source files"
p4 sync //Globecom/$CNFNAME/Globecom/...#none > /dev/null
rm -rf $WRKROOTDIR
echo "Synchronize head revision of Globecom sources"
p4 sync //Globecom/$CNFNAME/Globecom/... > /dev/null
echo ""


## Clean working directorties, then put head revision's source files
#for i in GIN globalsale html jars public scripts servlets Z2H
#do
#	echo "Remove old "$i" source files"
#	p4 sync //Globecom/$CNFNAME/Globecom/$i/...#none > /dev/null
#	echo "Remove old "$i" directories"
#	rm -rf $WRKROOTDIR/$i
#	echo "Synchronize head revision of "$i
#	p4 sync //Globecom/$CNFNAME/Globecom/$i/... > /dev/null
#	echo ""
#done

## REmove old Linux and INTL files and directories
echo "Remove old GIN-LNX directories"
rm -rf $WRKROOTDIR/GIN-LNX
echo "Remove old GIN-INTL directories"
rm -rf $WRKROOTDIR/GIN-INTL




## Update version (build No.) JAVA program

VERPROG=$WRKROOTDIR/globalsale/util/Version.java
sed 's/xyz/'$BUILDNUM'/' $VERPROG > $VERPROG.tmp
chmod u+w $VERPROG
mv $VERPROG.tmp $VERPROG
chmod u-w $VERPROG


## Update Project Build identification File (PBF)
## Note: Changelist 612 is a template changelist for this order 
CHG=612
p4 change -o $CHG | sed 's/'$CHG'/new/' | p4 change -i > $$.newchg

NEWCHG=`awk '{print $2}' $$.newchg`
rm -f $$.newchg

p4 sync //Globecom/$CNFNAME/Globecom/PBF.txt#none > /dev/null
p4 sync //Globecom/$CNFNAME/Globecom/PBF.txt > /dev/null
p4 edit -c $NEWCHG //Globecom/$CNFNAME/Globecom/PBF.txt
echo $BUILDNUM > $WRKROOTDIR/PBF.txt
p4 submit -c $NEWCHG


## Put Z2H files in GIN working directories
echo "Copying Z2H files into GIN environment"
/public/scripts/cpz2h $CNFNAME

## Prepare Linux and SUN-Intel working directories
echo "Duplicate GIN to GIN-LNX"
cp -r $WRKROOTDIR/GIN $WRKROOTDIR/GIN-LNX
echo "Duplicate GIN to GIN-INTL"
cp -r $WRKROOTDIR/GIN $WRKROOTDIR/GIN-INTL

SUNDIR=$WRKROOTDIR"/GIN"
LNXDIR=$WRKROOTDIR"/GIN-LNX"
INTLDIR=$WRKROOTDIR"/GIN-INTL"

echo "Run BuildGin via rsh"

## Sun Solaris GIN build
rsh $SUNSRVR "cd $SUNDIR; /public/scripts/BuildGin > $$.BuildGin" &

## Sun intel GIN build
rsh $INTLSRVR  "cd $INTLDIR; /public/scripts/BuildGin > $$.BuildGinIntl" &

## Linux GIN build
## GRB is not in use anymore - 6-nov-2001. Yariv
#echo "Modify GRB Apache include files for Linux configuration"
#CURPWD=`pwd`
#cd $WRKROOTDIR/GIN-LNX/GRB
#for i in `ls -l *_Apache.h | awk '{print $NF}'`
#do
#	cp $i $i.orig
#	sed 's?\#include \"http?\#include \"/usr/local/apache/include/http?' $i | sed 's?\#include \"util?\#include \"/usr/local/apache/include/util?' > $i.tmp
#	chmod u+w $i
#	mv $i.tmp $i
#	chmod u-w $i
#done
#cd $CURPWD

rsh $LNXSRVR "cd $LNXDIR; /public/scripts/BuildGin > $$.BuildGinLnx" &

wait

echo "End GIN Build"
echo""

## CC Build
echo "Remove old classes directory content"
rm -rf $WRKROOTDIR/classes 

echo "move startuprecovery and weblogiclicense java files !!!!!!!"
mv $WRKROOTDIR/globalsale/scheduler/StartUpRecovery.java $WRKROOTDIR/globalsale/scheduler/StartUpRecovery.java_tmp
mv $WRKROOTDIR/public/ins/conf/GLB/WebLogicLicense.java $WRKROOTDIR/public/ins/conf/GLB/WebLogicLicense.java_tmp

echo "Run CC Build"

ANTDIR=/usr/local/jakarta-ant-1.3/bin

# Set build.xml template files according to weblogic version
rm -f $ANTDIR/build.xml.tmpl
if [ "$CNFNAME" = "dev" ]
then
	ln -s $ANTDIR/build.xml.tmpl_5.1 $ANTDIR/build.xml.tmpl
else
	ln -s $ANTDIR/build.xml.tmpl_4.5.1 $ANTDIR/build.xml.tmpl
fi	


rsh $WEBLOGICSRVR "$ANTDIR/antRun $ANTDIR $ANTDIR/ant $CNFNAME /install/weblogic" 
for i in `ls -l $WRKROOTDIR/classes | grep -v globecom | grep -v lib | awk '{print $NF}'`
do
	rm -rf $WRKROOTDIR/classes/$i
done

echo "move startuprecovery and weblogiclicense java files !!!!!!!"
mv $WRKROOTDIR/globalsale/scheduler/StartUpRecovery.java_tmp $WRKROOTDIR/globalsale/scheduler/StartUpRecovery.java
mv $WRKROOTDIR/public/ins/conf/GLB/WebLogicLicense.java_tmp $WRKROOTDIR/public/ins/conf/GLB/WebLogicLicense.java


CNFN=`echo $CNFNAME | awk -F. '{print $1}'`
if [ "$CNFN" = "prd_2" ]
then
	echo "Copy ser files into classes directory"
	CURPWD=`pwd`
	cd $WRKROOTDIR/globalsale/ejbs
	for i in `find . -name "*.ser"`
	do
		cp $i $WRKROOTDIR/classes/globecom/globalsale/ejbs/$i
	done
else
	echo "Copy jar files into classes directory"
	CURPWD=`pwd`
	rm -rf $WRKROOTDIR/classes/deploy
	cp -r $WRKROOTDIR/globalsale/ejbs/deploy $WRKROOTDIR/classes
fi


echo "Copy gif files into classes directory"
cp -r $WRKROOTDIR/globalsale/util/Images $WRKROOTDIR/classes/globecom/globalsale/util

cd $CURPWD


## Pack tar.gz files from build product files into /public/<configuration>/ins
echo "Pack product files into "$INSDIR"/*"$BUILDNUM".tar.gz"
/public/scripts/CollectRelease $SUNDIR Build$BUILDNUM $CNFNAME

## Deploy the Java classes
echo "Deploy Java classes. Run on "$WEBLOGICSRVR
rsh $WEBLOGICSRVR -l weblogic "/public/scripts/CCBuildUnix.sh Build$BUILDNUM $CNFNAME"

## Remove pre-deploy classes
echo "Remove pre-deploy classes from installation directory"
rm -rf $INSDIR/Java/globecom

## Compress globalsale Java classes into CC.jar file
echo "Compress globalsale Java classes into CC.jar"
cd $INSDIR
TARFILE="JavaClasses-SUN-Rel-Build"$BUILDNUM".tar"
gunzip $TARFILE.gz
tar xvf $TARFILE


# Set ccjar.xml template files according to weblogic version
rm -f $ANTDIR/ccjar.xml.tmpl
if [ "$CNFNAME" = "dev" ]
then
	ln -s $ANTDIR/ccjar.xml.tmpl_5.1 $ANTDIR/ccjar.xml.tmpl
else
	ln -s $ANTDIR/ccjar.xml.tmpl_4.5.1 $ANTDIR/ccjar.xml.tmpl
fi	

rsh $WEBLOGICSRVR "$ANTDIR/CCJarantRun $ANTDIR $ANTDIR/ant $CNFNAME /install/weblogic"
rm -rf $INSDIR/globecom
gzip $TARFILE

## Copy final jar files from WebLogic server to installation directory
echo "Remove pre-deploy jars from installation directory"
rm -f $INSDIR/deploy/*_src.jar
echo "Copy deployed jars from Weblogic server into installation directory"
rsh $WEBLOGICSRVR "cd /install/weblogic/classes/deploy; cp *.jar $INSDIR/deploy"



## Define and load build label
echo "Define and load Globecom_Build_"$BUILDNUM" label"
p4 label -d -f Globecom_Build_$BUILDNUM
p4 label -o Globecom_Build_$BUILDNUM | sed 's?//Globecom?//Globecom/'$CNFNAME'/Globecom?' | grep -v tici | grep -v "\/\/depot" | p4 label -i
p4 labelsync -l Globecom_Build_$BUILDNUM > /dev/null
p4 label -o Globecom_Build_$BUILDNUM | sed 's/Options:	unlocked/Options:	locked/' | p4 label -i



## Reopen P4 protect for write to programmers
echo "Reconstruct P4 protect to write-mode"
p4 protect -i < /tmp/$$.p4protect
rm -f /tmp/$$.p4protect

echo ""

exit 0
# Change User Description Committed
#1 1472 Yariv Sheizaf scripts dir