From 11a55328e2cba7f5a8002215c34374f4f4d2348a Mon Sep 17 00:00:00 2001 From: bp-sawyers Date: Fri, 27 Jan 2012 20:40:27 +0000 Subject: [PATCH] Completed build of minimal xcat git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@11428 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- buildcore.sh | 107 ++++++++++++++++++++++++++++++--------------------- makerpm | 34 ++++++++-------- 2 files changed, 81 insertions(+), 60 deletions(-) diff --git a/buildcore.sh b/buildcore.sh index 62f821dfd..39c1bd721 100755 --- a/buildcore.sh +++ b/buildcore.sh @@ -26,6 +26,7 @@ # UP=0 or UP=1 - override the default upload behavior # SVNUP= - 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. +# EMBED= - 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 # you can change this if you need to @@ -76,6 +77,8 @@ else fi # Set variables based on which type of build we are doing +if [ -n "$EMBED" ]; then EMBEDDIR="/$EMBED" +else EMBEDDIR=""; fi XCATCORE="xcat-core" # core-snap is a sym link to xcat-core echo "svn --quiet up Version" svn --quiet up Version @@ -97,25 +100,26 @@ else TARNAME=core-rpms-snap.tar.bz2 fi fi -DESTDIR=../../$XCATCORE +DESTDIR=../..$EMBEDDIR/$XCATCORE SRCD=core-snap-srpms - -if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting -mkdir -p $DESTDIR -SRCDIR=../../$SRCD -mkdir -p $SRCDIR -if [ -n "$VERBOSEMODE" ]; then - GREP=grep -else - GREP="grep -q" -fi # currently aix builds ppc rpms, but someday it should build noarch if [ "$OSNAME" = "AIX" ]; then NOARCH=ppc else NOARCH=noarch fi + + +if [ "$PROMOTE" != 1 ]; then # very long if statement to not do builds if we are promoting +mkdir -p $DESTDIR +SRCDIR=$DESTDIR/../$SRCD +mkdir -p $SRCDIR +if [ -n "$VERBOSEMODE" ]; then + GREP=grep +else + GREP="grep -q" +fi UPLOAD=0 if [ "$OSNAME" = "AIX" ]; then source=/opt/freeware/src/packages @@ -135,18 +139,24 @@ if [ -z "$SVNUP" ]; then svn up > $SVNUP fi +# Process for making most of the rpms +function maker { + rpmname="$1" + ./makerpm $rpmname "$EMBED" + if [ $? -ne 0 ]; then + FAILEDRPMS="$FAILEDRPMS $rpmname" + else + rm -f $DESTDIR/$rpmname*rpm + rm -f $SRCDIR/$rpmname*rpm + mv $source/RPMS/$NOARCH/$rpmname-$VER*rpm $DESTDIR + mv $source/SRPMS/$rpmname-$VER*rpm $SRCDIR + fi +} + # If anything has changed, we should always rebuild perl-xCAT if ! $GREP 'At revision' $SVNUP; then # Use to be: $GREP perl-xCAT $SVNUP; then UPLOAD=1 - ./makerpm perl-xCAT - if [ $? -ne 0 ]; then - FAILEDRPMS="perl-xCAT" - else - rm -f $DESTDIR/perl-xCAT*rpm - rm -f $SRCDIR/perl-xCAT*rpm - mv $source/RPMS/$NOARCH/perl-xCAT-$VER*rpm $DESTDIR/ - mv $source/SRPMS/perl-xCAT-$VER*rpm $SRCDIR/ - fi + maker perl-xCAT fi if [ "$OSNAME" = "AIX" ]; then # For the 1st one we overwrite, not append @@ -157,15 +167,8 @@ fi for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test; do if $GREP $rpmname $SVNUP; then UPLOAD=1 - ./makerpm $rpmname - if [ $? -ne 0 ]; then - FAILEDRPMS="$FAILEDRPMS $rpmname" - else - rm -f $DESTDIR/$rpmname*rpm - rm -f $SRCDIR/$rpmname*rpm - mv $source/RPMS/$NOARCH/$rpmname-$VER*rpm $DESTDIR/ - mv $source/SRPMS/$rpmname-$VER*rpm $SRCDIR/ - fi + if [ "$EMBED" = "zvm" -a "$rpmname" != "xCAT-server" -a "$rpmname" != "xCAT-UI" ]; then break; fi # for embedded envs only need to build server special + maker $rpmname fi if [ "$OSNAME" = "AIX" ]; then if [ "$rpmname" = "xCAT-client" -o "$rpmname" = "xCAT-server" ]; then # we do not automatically install the rest of the rpms on AIX @@ -174,7 +177,7 @@ for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test; d fi done -if [ "$OSNAME" != "AIX" ]; then +if [ "$OSNAME" != "AIX" -a "$EMBED" != "zvm" ]; then if $GREP xCAT-nbroot $SVNUP; then UPLOAD=1 ORIGFAILEDRPMS="$FAILEDRPMS" @@ -193,6 +196,7 @@ fi # Build the xCAT and xCATsn rpms for all platforms for rpmname in xCAT xCATsn; do + if [ "$EMBED" = "zvm" ]; then break; fi if $GREP -E "^[UAD] +$rpmname/" $SVNUP; then UPLOAD=1 ORIGFAILEDRPMS="$FAILEDRPMS" @@ -219,6 +223,20 @@ if [ "$OSNAME" = "AIX" ]; then echo "rpm -Uvh xCAT-rmc-$SHORTSHORTVER*rpm" >> $DESTDIR/instxcat fi +# Make sym links in the embed subdirs for the rpms we do not have to build special +cd $DESTDIR +if [ "$EMBED" = "zvm" ]; then + maindir="../../$XCATCORE" + rm -f xCAT-client-$SHORTSHORTVER*rpm + ln -s $maindir/xCAT-client-$SHORTSHORTVER*rpm . + rm -f xCAT-$SHORTSHORTVER*rpm + ln -s $maindir/xCAT-$SHORTSHORTVER*.s390x.rpm . + rm -f xCATsn-$SHORTSHORTVER*rpm + ln -s $maindir/xCATsn-$SHORTSHORTVER*.s390x.rpm . +fi +cd - >/dev/null + + # Decide if anything was built or not if [ -n "$FAILEDRPMS" ]; then echo "Error: build of the following RPMs failed: $FAILEDRPMS" @@ -251,7 +269,7 @@ if [ "$OSNAME" != "AIX" ]; then echo '%_gpg_name Jarrod Johnson' >> $MACROS fi echo "Signing RPMs..." - build-utils/rpmsign.exp $DESTDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)' + build-utils/rpmsign.exp `find $DESTDIR -type f -name '*.rpm'` | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)' build-utils/rpmsign.exp $SRCDIR/*rpm | grep -v -E '(was already signed|rpm --quiet --resign|WARNING: standard input reopened)' createrepo $DESTDIR createrepo $SRCDIR @@ -285,21 +303,24 @@ chmod -R g+w $SRCDIR fi # end of very long if-not-promote - cd $DESTDIR if [ "$OSNAME" != "AIX" ]; then + # Modify the repo file to point to either xcat-core or core-snap # Always recreate it, in case the whole dir was copied from devel to 2.x + if [ -n "$1" ]; then embed="$1/" + else embed=""; fi cat >xCAT-core.repo << EOF [xcat-2-core] name=xCAT 2 Core packages -baseurl=$YUMREPOURL/$REL/$CORE +baseurl=$YUMREPOURL/$REL$EMBEDDIR/$CORE enabled=1 gpgcheck=1 -gpgkey=$YUMREPOURL/$REL/$CORE/repodata/repomd.xml.key +gpgkey=$YUMREPOURL/$REL$EMBEDDIR/$CORE/repodata/repomd.xml.key EOF + # Create the mklocalrepo script cat >mklocalrepo.sh << 'EOF2' #!/bin/sh @@ -347,33 +368,33 @@ if [ ! -e core-snap ]; then fi if [ "$REL" = "devel" -o "$PREGA" != 1 ]; then i=0 - echo "Uploading RPMs from $CORE to $YUMDIR/$YUM/$REL/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/ + echo "Uploading RPMs from $CORE to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/ do : ; done fi # Upload the individual source RPMs to sourceforge i=0 -echo "Uploading src RPMs from $SRCD to $YUMDIR/$YUM/$REL/ ..." -while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $SRCD $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/ +echo "Uploading src RPMs from $SRCD to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..." +while [ $((i+=1)) -le 5 ] && ! rsync -urLv --delete $SRCD $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/ do : ; done # Upload the tarball to sourceforge if [ "$PROMOTE" = 1 -a "$REL" != "devel" -a "$PREGA" != 1 ]; then # upload tarball to FRS area i=0 - echo "Uploading $TARNAME to $FRS/xcat/$REL.x_$OSNAME/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat/$REL.x_$OSNAME/ + echo "Uploading $TARNAME to $FRS/xcat/$REL.x_$OSNAME$EMBEDDIR/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$FRS/xcat/$REL.x_$OSNAME$EMBEDDIR/ do : ; done else i=0 - echo "Uploading $TARNAME to $YUMDIR/$YUM/$REL/ ..." - while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL/ + echo "Uploading $TARNAME to $YUMDIR/$YUM/$REL$EMBEDDIR/ ..." + while [ $((i+=1)) -le 5 ] && ! rsync -v $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:$YUMDIR/$YUM/$REL$EMBEDDIR/ do : ; done fi # Extract and upload the man pages in html format -if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 ]; then +if [ "$OSNAME" != "AIX" -a "$REL" = "devel" -a "$PROMOTE" != 1 -a -z "$EMBED" ]; then echo "Extracting and uploading man pages to htdocs/ ..." mkdir -p man cd man diff --git a/makerpm b/makerpm index 621003dc6..64ac50d43 100755 --- a/makerpm +++ b/makerpm @@ -18,11 +18,11 @@ function makenoarch { tar -X /tmp/xcat-excludes -cf $RPMROOT/SOURCES/$RPMNAME-$VER.tar $RPMNAME gzip -f $RPMROOT/SOURCES/$RPMNAME-$VER.tar rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm - echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..." rpm $QUIET -ba $RPMNAME/$RPMNAME.spec RC=$? else # linux - echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." tar --exclude .svn -czf $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz $RPMNAME rm -f $RPMROOT/SRPMS/xCAT-server-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm rpmbuild $QUIET -ta $RPMROOT/SOURCES/$RPMNAME-$VER.tar.gz @@ -35,7 +35,7 @@ function makenoarch { # Make one of the following rpms: xCAT, xCATsn function makexcat { if [ "$OSNAME" != "AIX" -a -z "$2" ]; then - echo 'Usage: makerpm []' + echo 'Usage: makerpm []' exit 1 fi @@ -63,7 +63,7 @@ function makexcat { rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/ppc/$RPMNAME-$VER*rpm cd - >/dev/null - echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/ppc/$RPMNAME-$VER-snap*.ppc.rpm $EMBEDTXT..." rpm $QUIET -ba $RPMNAME/$RPMNAME.spec RC=$? else # linux @@ -84,7 +84,7 @@ function makexcat { cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER*rpm - echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/$ARCH/$RPMNAME-$VER-snap*.$ARCH.rpm $EMBEDTXT..." rpmbuild $QUIET -ba $RPMNAME/$RPMNAME.spec --target $ARCH RC=$? fi @@ -95,7 +95,7 @@ function makexcat { # Make the xCAT-nbroot-core rpm function makenbroot { if [ -z "$2" ]; then - echo 'Usage: makerpm xCAT-nbroot-core []' + echo 'Usage: makerpm xCAT-nbroot-core []' exit 1 fi @@ -109,7 +109,7 @@ function makenbroot { cp $SPEC.spec $RPMROOT/SOURCES cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." rpmbuild $QUIET -ba $DIR/$SPEC.spec --target $ARCH } @@ -125,18 +125,18 @@ function makegenesis { cp $RPMNAME.spec $RPMROOT/SOURCES cd - >/dev/null rm -f $RPMROOT/SRPMS/$RPMNAME-$VER*rpm $RPMROOT/RPMS/noarch/$RPMNAME-$VER*rpm - echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $IMBEDTXT..." + echo "Building $RPMROOT/RPMS/noarch/$RPMNAME-$VER-snap*.noarch.rpm $EMBEDTXT..." rpmbuild $QUIET -ba $DIR/$RPMNAME.spec } -# Export the name of the imbedded system we are building for -function exportImbed { +# Export the name of the embedded system we are building for +function exportEmbed { if [ -n "$1" ]; then export "$1=1" - IMBEDTXT="for $1 " + EMBEDTXT="for $1 " else - IMBEDTXT="" + EMBEDTXT="" fi } @@ -144,7 +144,7 @@ function exportImbed { # Main code.... if [ -z "$1" ]; then - echo 'Usage: makerpm [] []' + echo 'Usage: makerpm [] []' exit 1 fi @@ -173,16 +173,16 @@ fi if [ "$1" = "xCAT" -o "$1" = "xCATsn" ]; then - exportImbed $3 + exportEmbed $3 makexcat $1 $2 elif [ "$1" = "xCAT-nbroot" -o "$1" = "xCAT-nbroot-core" ]; then - exportImbed $3 + exportEmbed $3 makenbroot xCAT-nbroot-core $2 elif [ "$1" = "xCAT-genesis-builder" ]; then - exportImbed $3 + exportEmbed $3 makegenesis $1 $2 else # must be one of the noarch rpms - exportImbed $2 + exportEmbed $2 makenoarch $1 fi