From 6243084b0c51d540b2e09a44686bebf71fe658c0 Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Fri, 31 Jul 2009 20:36:29 +0000 Subject: [PATCH] Add argument processing and rsync retry to linux build script git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3915 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- buildcore.sh | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 40a11714f..162c89db0 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -1,19 +1,25 @@ -#!/bin/sh +#!/bin/bash # Build and upload the xcat-core code. This script and the rest of the xcat-core source should # be in a dir called /src/xcat-core, where is the same as the release dir it will be # uploaded to in sourceforge (e.g. devel, or 2.2). -# Usage: buildcore.sh [promote] -# promote - if the keyword "promote" is specified, means an official dot release. +# Usage: buildcore.sh [attr=value attr=value ...] +# PROMOTE=1 - if the attribute "PROMOTE" is specified, means an official dot release. # Otherwise, and snap build is assumed. -# You can override the default upload behavior by specifying env var: UP=0 or UP=1 -# You can control which rpms get built by specifying a coresvnup file env var: SVNUP= +# UP=0 or UP=1 - override the default upload behavior +# SVNUP= - control which rpms get built by specifying a coresvnup file # you can change this if you need to UPLOADUSER=bp-sawyers set -x + +# Process cmd line variable assignments +for i in $*; do + declare `echo $i|cut -d '=' -f 1`=`echo $i|cut -d '=' -f 2` +done + export HOME=/root cd `dirname $0` @@ -23,7 +29,7 @@ D=${CURDIR/\/src\/xcat-core/} REL=`basename $D` VER=`cat Version` -if [ "$1" = "promote" ]; then +if [ "$PROMOTE" = 1 ]; then CORE="xcat-core" TARNAME=xcat-core-$VER.tar.bz2 else @@ -33,7 +39,7 @@ fi DESTDIR=../../$CORE -if [ "$1" != "promote" ]; then # very long if statement to not do builds if we are promoting +if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting mkdir -p $DESTDIR SRCDIR=../../core-snap-srpms mkdir -p $SRCDIR @@ -172,7 +178,7 @@ fi # end of very long if-not-promote # Modify the repo file to point to either xcat-core or core-snap cd $DESTDIR -if [ "$1" = "promote" ]; then +if [ "$PROMOTE" = 1 ]; then sed -e 's|/core-snap|/xcat-core|' xCAT-core.repo > xCAT-core.repo.new mv -f xCAT-core.repo.new xCAT-core.repo else @@ -186,24 +192,29 @@ tar -hjcvf $TARNAME $CORE chgrp xcat $TARNAME chmod g+w $TARNAME -# Upload the tarball and individual RPMs to sourceforge -rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/ -if [ "$1" = "promote" -a "$REL" != "devel" ]; then +# Upload the individual RPMs to sourceforge +while ! rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/ +do : ; done + +# Upload the tarball to sourceforge +if [ "$PROMOTE" = 1 -a "$REL" != "devel" ]; then # upload tarball to FRS area #scp $TARNAME $UPLOADUSER@web.sourceforge.net:uploads/ echo "$TARNAME has been built. Remember to upload it to sourceforge using its File Manager." else - rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/ + while ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/ + do : ; done fi # Extract and upload the man pages in html format -if [ "$REL" = "devel" -a "$1" != "promote" ]; then +if [ "$REL" = "devel" -a "$PROMOTE" != 1 ]; then mkdir -p man cd man rm -rf opt rpm2cpio ../$CORE/xCAT-client-*.noarch.rpm | cpio -id '*.html' rpm2cpio ../$CORE/perl-xCAT-*.noarch.rpm | cpio -id '*.html' # Note: for some reason scp kept getting "Connection reset by peer" part way thru - rsync -rv opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/ + while ! rsync -rv opt/xcat/share/doc/man1 opt/xcat/share/doc/man3 opt/xcat/share/doc/man5 opt/xcat/share/doc/man7 opt/xcat/share/doc/man8 $UPLOADUSER,xcat@web.sourceforge.net:htdocs/ + do : ; done cd .. fi