2009-12-05 20:55:00 +00:00
# The shell is commented out so that it will run in bash on linux and ksh on aix
# !/bin/bash
# Build and upload the xcat-core code, on either linux or aix.
2009-02-23 21:03:18 +00:00
2009-11-06 16:11:05 +00:00
# Getting Started:
# - Check out the xcat-core svn repository (either the trunk or a branch) into
# a dir called <rel>/src/xcat-core, where <rel> is the same as the release dir it will be
# uploaded to in sourceforge (e.g. devel, or 2.3).
# - You probably also want to put root's pub key from the build machine onto sourceforge for
# the upload user listed below, so you don't have to keep entering pw's. You can do this
2009-11-06 16:38:13 +00:00
# at https://sourceforge.net/account/ssh
2009-12-05 20:55:00 +00:00
# - On Linux: make sure createrepo is installed on the build machine
2011-08-25 19:54:25 +00:00
# - On AIX: Install openssl and openssh installp pkgs and run updtvpkg. Install from http://www.perzl.org/aix/ :
2009-12-05 20:55:00 +00:00
# apr, apr-util, bash, bzip2, db4, expat, gdbm, gettext, glib2, gmp, info, libidn, neon, openssl (won't
2011-08-25 19:54:25 +00:00
# conflict with the installp version - but i don't think you need this), pcre, perl-DBD-SQLite, perl-DBI,
# popt, python, readline, rsynce, sqlite, subversion, unixODBC, zlib. Install wget from http://www-03.ibm.com/systems/power/software/aix/linux/toolbox/alpha.html
2009-11-06 19:26:12 +00:00
# - Run this script from the local svn repository you just created. It will create the other
# directories that are needed.
2009-02-23 21:03:18 +00:00
2013-07-29 15:36:37 +00:00
# Usage: buildcore.sh [attr=value attr=value ...]
# Before running buildcore.sh, you must change the local git repo to the branch you want built, using: git checkout <branch>
2012-08-23 20:04:13 +00:00
# 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/
# or https://sourceforge.net/projects/xcat/files/aix/.
# PREGA=1 - use this option with PROMOTE=1 on a branch that already has a released dot release, but this build is
# a GA candidate build, not to be released yet. This will result in the tarball being uploaded to
# https://sourceforge.net/projects/xcat/files/yum/ or https://sourceforge.net/projects/xcat/files/aix/
# (but the tarball file name will be like a released tarball, not a snap build). When you are ready to
# release this build, use PROMOTE=1 without PREGA
2012-04-24 23:07:13 +00:00
# BUILDALL=1 - build all rpms, whether they changed or not. Should be used for snap builds that are in prep for a release.
2009-07-31 20:36:29 +00:00
# UP=0 or UP=1 - override the default upload behavior
# SVNUP=<filename> - control which rpms get built by specifying a coresvnup file
2013-07-26 18:29:23 +00:00
# GITUP=<filename> - control which rpms get built by specifying a coregitup file
2012-01-27 20:40:27 +00:00
# EMBED=<embedded-environment> - the environment for which a minimal version of xcat should be built, e.g. zvm or flex
2011-12-19 17:01:18 +00:00
# VERBOSE=1 - to see lots of verbose output
2009-02-26 21:48:23 +00:00
2009-02-23 21:03:18 +00:00
# you can change this if you need to
UPLOADUSER = bp-sawyers
2011-12-19 17:01:18 +00:00
FRS = /home/frs/project/x/xc/xcat
2009-02-23 21:03:18 +00:00
2012-11-08 21:47:50 +00:00
# These are the rpms that should be built for each kind of xcat build
2014-03-03 20:01:37 +00:00
ALLBUILD = "perl-xCAT xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT xCATsn xCAT-genesis-scripts xCAT-OpenStack xCAT-SoftLayer xCAT-OpenStack-baremetal"
2012-11-08 21:47:50 +00:00
ZVMBUILD = "perl-xCAT xCAT-server xCAT-UI"
ZVMLINK = "xCAT-client xCAT xCATsn"
2014-04-04 19:46:26 +00:00
# xCAT has PCM specific configuration - conserver-xcat, syslinux-xcat
# xCAT-server has PCM specific configuration - RESTAPI(perl-JSON)
2014-08-12 09:41:40 +00:00
PCMBUILD = "xCAT xCAT-server xCATsn"
2014-04-04 19:46:26 +00:00
PCMLINK = "perl-xCAT xCAT-client xCAT-buildkit xCAT-genesis-scripts-x86_64"
2012-11-09 14:42:42 +00:00
# Note: for FSM, the FlexCAT rpm is built separately from gsa/git
FSMBUILD = "perl-xCAT xCAT-client xCAT-server"
FSMLINK = ""
# If you add more embed cases, also change the if [ -n "$EMBED" ]... below
2012-11-08 21:47:50 +00:00
2011-12-19 17:01:18 +00:00
# Process cmd line variable assignments, assigning each attr=val pair to a variable of same name
for i in $* ; do
2011-12-21 12:21:31 +00:00
# upper case the variable name
2012-03-24 13:27:52 +00:00
varstring = ` echo " $i " | cut -d '=' -f 1| tr '[a-z]' '[A-Z]' ` = ` echo " $i " | cut -d '=' -f 2`
2011-12-21 12:21:31 +00:00
export $varstring
2011-12-19 17:01:18 +00:00
done
if [ " $VERBOSE " = "1" -o " $VERBOSE " = "yes" ] ; then
set -x
VERBOSEMODE = 1
fi
2009-12-05 20:55:00 +00:00
2011-12-19 17:01:18 +00:00
# Find where this script is located to set some build variables
2010-04-23 19:29:08 +00:00
cd ` dirname $0 `
2011-12-19 17:01:18 +00:00
# strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release
2011-12-22 10:56:44 +00:00
if [ -z " $REL " ] ; then
2011-12-19 17:01:18 +00:00
curdir = ` pwd `
D = ${ curdir %/src/xcat-core }
REL = ` basename $D `
fi
OSNAME = $( uname)
2010-04-23 19:29:08 +00:00
2010-04-16 14:37:03 +00:00
if [ " $OSNAME " != "AIX" ] ; then
2009-12-05 20:55:00 +00:00
GSA = http://pokgsa.ibm.com/projects/x/xcat/build/linux
2010-04-23 19:29:08 +00:00
# Get a lock, so can not do 2 builds at once
exec 8>/var/lock/xcatbld-$REL .lock
2010-04-23 19:33:19 +00:00
if ! flock -n 8; then
2010-04-23 19:29:08 +00:00
echo " Can't get lock /var/lock/xcatbld- $REL .lock. Someone else must be doing a build right now. Exiting.... "
exit 1
fi
2011-12-19 17:01:18 +00:00
export HOME = /root # This is so rpm and gpg will know home, even in sudo
2009-12-05 20:55:00 +00:00
fi
2009-11-06 20:53:22 +00:00
2013-08-13 22:29:42 +00:00
# for the git case, query the current branch and set REL (changing master to devel if necessary)
function setbranch {
#git checkout $BRANCH
2013-08-27 15:23:22 +00:00
#REL=`git rev-parse --abbrev-ref HEAD`
2013-08-27 16:49:04 +00:00
REL = ` git name-rev --name-only HEAD`
2013-08-13 22:29:42 +00:00
if [ " $REL " = "master" ] ; then
REL = "devel"
fi
}
if [ " $REL " = "xcat-core" ] ; then # using git
GIT = 1
setbranch # this changes the REL variable
fi
2013-07-26 18:29:23 +00:00
YUMDIR = $FRS
YUMREPOURL = "https://sourceforge.net/projects/xcat/files/yum"
2009-05-08 16:31:57 +00:00
2011-12-19 17:01:18 +00:00
# Set variables based on which type of build we are doing
2012-11-08 21:47:50 +00:00
if [ -n " $EMBED " ] ; then
EMBEDDIR = " / $EMBED "
if [ " $EMBED " = "zvm" ] ; then
EMBEDBUILD = $ZVMBUILD
EMBEDLINK = $ZVMLINK
elif [ " $EMBED " = "pcm" ] ; then
EMBEDBUILD = $PCMBUILD
EMBEDLINK = $PCMLINK
2012-11-09 14:42:42 +00:00
elif [ " $EMBED " = "fsm" ] ; then
EMBEDBUILD = $FSMBUILD
EMBEDLINK = $FSMLINK
2012-11-08 21:47:50 +00:00
else
echo " Error: EMBED setting $EMBED not recognized. "
exit 2
fi
else
EMBEDDIR = ""
EMBEDBUILD = $ALLBUILD
EMBEDLINK = ""
fi
2011-12-19 17:01:18 +00:00
XCATCORE = "xcat-core" # core-snap is a sym link to xcat-core
2013-07-26 18:29:23 +00:00
2013-08-13 22:29:42 +00:00
if [ " $GIT " = "1" ] ; then # using git - need to include REL in the path where we put the built rpms
DESTDIR = ../../$REL $EMBEDDIR /$XCATCORE
else
DESTDIR = ../..$EMBEDDIR /$XCATCORE
fi
2009-11-06 16:11:05 +00:00
SRCD = core-snap-srpms
2009-04-07 00:43:03 +00:00
2012-01-27 20:40:27 +00:00
# currently aix builds ppc rpms, but someday it should build noarch
if [ " $OSNAME " = "AIX" ] ; then
NOARCH = ppc
2013-11-06 15:15:13 +00:00
SYSGRP = system
2012-01-27 20:40:27 +00:00
else
NOARCH = noarch
2013-11-06 15:15:13 +00:00
SYSGRP = root
2012-01-27 20:40:27 +00:00
fi
2013-10-09 23:54:10 +00:00
function setversionvars {
VER = ` cat Version`
SHORTVER = ` cat Version| cut -d. -f 1,2`
SHORTSHORTVER = ` cat Version| cut -d. -f 1`
}
2009-04-17 14:25:21 +00:00
2009-07-31 20:36:29 +00:00
if [ " $PROMOTE " != 1 ] ; then # very long if statement to not do builds if we are promoting
2013-07-26 18:29:23 +00:00
# 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
2009-04-07 00:43:03 +00:00
mkdir -p $DESTDIR
2012-01-27 20:40:27 +00:00
SRCDIR = $DESTDIR /../$SRCD
2009-04-07 00:43:03 +00:00
mkdir -p $SRCDIR
2011-12-19 17:01:18 +00:00
if [ -n " $VERBOSEMODE " ] ; then
GREP = grep
else
GREP = "grep -q"
fi
2008-03-04 18:10:05 +00:00
UPLOAD = 0
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " = "AIX" ] ; then
source = /opt/freeware/src/packages
2008-03-04 18:10:05 +00:00
else
2011-12-19 17:01:18 +00:00
source = ` rpmbuild --eval '%_topdir' xCATsn/xCATsn.spec`
if [ $? -gt 0 ] ; then
echo "Error: Could not determine rpmbuild's root directory."
exit 2
2009-12-05 20:55:00 +00:00
fi
2011-12-19 17:01:18 +00:00
#echo "source=$source"
2008-03-04 18:10:05 +00:00
fi
2013-07-26 18:29:23 +00:00
# If they have not given us a premade update file, do an svn update or git pull and capture the results
2012-04-24 23:07:13 +00:00
SOMETHINGCHANGED = 0
2013-08-13 22:29:42 +00:00
if [ " $GIT " = "1" ] ; then # using git
2013-07-26 18:29:23 +00:00
if [ -z " $GITUP " ] ; then
GITUP = ../coregitup
echo " git pull > $GITUP "
git pull > $GITUP
2013-10-31 16:57:33 +00:00
if [ [ $? != 0 ] ] ; then
# do not continue so we do not build with old files
echo "The 'git pull' command failed. Exiting the build."
exit 3
fi
2013-07-26 18:29:23 +00:00
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
2012-04-24 23:07:13 +00:00
fi
2009-11-06 16:11:05 +00:00
2013-07-26 18:29:23 +00:00
setversionvars
2012-11-08 21:47:50 +00:00
# Function for making the noarch rpms
2012-01-27 20:40:27 +00:00
function maker {
rpmname = " $1 "
./makerpm $rpmname " $EMBED "
2011-12-19 17:01:18 +00:00
if [ $? -ne 0 ] ; then
2012-01-27 20:40:27 +00:00
FAILEDRPMS = " $FAILEDRPMS $rpmname "
2011-12-19 17:01:18 +00:00
else
2012-01-27 20:40:27 +00:00
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
2011-12-19 17:01:18 +00:00
fi
2012-01-27 20:40:27 +00:00
}
# If anything has changed, we should always rebuild perl-xCAT
2013-07-26 18:29:23 +00:00
if [ $SOMETHINGCHANGED = = 1 -o " $BUILDALL " = = 1 ] ; then # Use to be: $GREP perl-xCAT $GITUP; then
2012-11-08 21:47:50 +00:00
if [ [ " $EMBEDBUILD " = *\ perl-xCAT\ * ] ] ; then
UPLOAD = 1
maker perl-xCAT
fi
2009-12-23 11:09:48 +00:00
fi
if [ " $OSNAME " = "AIX" ] ; then
2010-01-11 23:25:00 +00:00
# For the 1st one we overwrite, not append
2010-04-19 13:57:55 +00:00
echo " rpm -Uvh perl-xCAT- $SHORTSHORTVER *rpm " > $DESTDIR /instxcat
2009-05-08 15:09:15 +00:00
fi
2009-01-28 15:42:14 +00:00
2011-12-19 17:01:18 +00:00
# Build the rest of the noarch rpms
2014-03-03 20:01:37 +00:00
for rpmname in xCAT-client xCAT-server xCAT-IBMhpc xCAT-rmc xCAT-UI xCAT-test xCAT-buildkit xCAT-SoftLayer; do
2012-11-08 21:47:50 +00:00
#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
2012-11-02 14:19:47 +00:00
if [ " $OSNAME " = "AIX" -a " $rpmname " = "xCAT-buildkit" ] ; then continue ; fi # do not build xCAT-buildkit on aix
2014-04-07 16:58:53 +00:00
if [ " $OSNAME " = "AIX" -a " $rpmname " = "xCAT-SoftLayer" ] ; then continue ; fi # do not build xCAT-SoftLayer on aix
2013-07-26 18:29:23 +00:00
if $GREP $rpmname $GITUP || [ " $BUILDALL " = = 1 ] ; then
2011-12-19 17:01:18 +00:00
UPLOAD = 1
2012-01-27 20:40:27 +00:00
maker $rpmname
2011-12-19 17:01:18 +00:00
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
echo " rpm -Uvh $rpmname - $SHORTSHORTVER *rpm " >> $DESTDIR /instxcat
fi
fi
done
2010-09-21 14:28:10 +00:00
2013-01-09 22:48:54 +00:00
# Build xCAT-genesis-scripts for xcat-core. xCAT-genesis-base gets built by hand and put in xcat-dep.
# The mknb cmd combines them at install time.
if [ " $OSNAME " != "AIX" ] ; then
if [ [ " $EMBEDBUILD " = *\ xCAT-genesis-scripts\ * ] ] ; then
2013-07-26 18:29:23 +00:00
if $GREP xCAT-genesis-scripts $GITUP || [ " $BUILDALL " = = 1 ] ; then
2013-01-09 22:48:54 +00:00
UPLOAD = 1
ORIGFAILEDRPMS = " $FAILEDRPMS "
./makerpm xCAT-genesis-scripts x86_64 " $EMBED "
if [ $? -ne 0 ] ; then FAILEDRPMS = " $FAILEDRPMS xCAT-genesis-scripts-x86_64 " ; fi
if [ " $FAILEDRPMS " = " $ORIGFAILEDRPMS " ] ; then # all succeeded
rm -f $DESTDIR /xCAT-genesis-scripts*rpm
rm -f $SRCDIR /xCAT-genesis-scripts*rpm
mv $source /RPMS/noarch/xCAT-genesis-scripts-*rpm $DESTDIR
mv $source /SRPMS/xCAT-genesis-scripts-*rpm $SRCDIR
fi
fi
fi
fi
2009-12-05 20:55:00 +00:00
2011-12-19 17:01:18 +00:00
# Build the xCAT and xCATsn rpms for all platforms
2014-03-03 20:11:48 +00:00
for rpmname in xCAT xCATsn xCAT-OpenStack xCAT-OpenStack-baremetal; do
2012-11-08 21:47:50 +00:00
#if [ "$EMBED" = "zvm" ]; then break; fi
if [ [ " $EMBEDBUILD " != *\ $rpmname \ * ] ] ; then continue ; fi
2013-07-26 18:29:23 +00:00
if [ $SOMETHINGCHANGED = = 1 -o " $BUILDALL " = = 1 ] ; then # used to be: if $GREP -E "^[UAD] +$rpmname/" $GITUP; then
2011-12-19 17:01:18 +00:00
UPLOAD = 1
ORIGFAILEDRPMS = " $FAILEDRPMS "
if [ " $OSNAME " = "AIX" ] ; then
2014-03-03 20:11:48 +00:00
if [ " $rpmname " = "xCAT-OpenStack" ] || [ " $rpmname " = "xCAT-OpenStack-baremetal" ] ; then continue ; fi # do not bld openstack on aix
2013-01-08 17:40:34 +00:00
./makerpm $rpmname " $EMBED "
2011-12-19 17:01:18 +00:00
if [ $? -ne 0 ] ; then FAILEDRPMS = " $FAILEDRPMS $rpmname " ; fi
else
2013-06-05 21:01:34 +00:00
for arch in x86_64 ppc64 s390x; do
2014-03-03 20:11:48 +00:00
if [ " $rpmname " = "xCAT-OpenStack" -a " $arch " != "x86_64" ] || [ " $rpmname " = "xCAT-OpenStack-baremetal" -a " $arch " != "x86_64" ] ; then continue ; fi # only bld openstack for x86_64 for now
2013-01-08 17:40:34 +00:00
./makerpm $rpmname $arch " $EMBED "
2011-12-19 17:01:18 +00:00
if [ $? -ne 0 ] ; then FAILEDRPMS = " $FAILEDRPMS $rpmname - $arch " ; fi
done
fi
2011-12-22 01:32:48 +00:00
if [ " $FAILEDRPMS " = " $ORIGFAILEDRPMS " ] ; then # all succeeded
rm -f $DESTDIR /$rpmname -$SHORTSHORTVER *rpm
rm -f $SRCDIR /$rpmname -$SHORTSHORTVER *rpm
2011-12-19 17:01:18 +00:00
mv $source /RPMS/*/$rpmname -$VER *rpm $DESTDIR
mv $source /SRPMS/$rpmname -$VER *rpm $SRCDIR
fi
2009-12-05 20:55:00 +00:00
fi
2011-12-19 17:01:18 +00:00
done
2013-01-07 17:57:01 +00:00
# no longer put in xCAT-rmc
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " = "AIX" ] ; then
2010-04-19 13:30:22 +00:00
echo " rpm -Uvh xCAT- $SHORTSHORTVER *rpm " >> $DESTDIR /instxcat
2008-03-04 18:10:05 +00:00
fi
2009-02-26 21:48:23 +00:00
2012-01-27 20:40:27 +00:00
# Make sym links in the embed subdirs for the rpms we do not have to build special
2012-11-09 14:42:42 +00:00
if [ -n " $EMBED " -a -n " $EMBEDLINK " ] ; then
2012-11-08 21:47:50 +00:00
cd $DESTDIR
2012-01-27 20:40:27 +00:00
maindir = " ../../ $XCATCORE "
2012-11-08 21:47:50 +00:00
for rpmname in $EMBEDLINK ; do
if [ " $rpmname " = "xCAT" -o " $rpmname " = "xCATsn" ] ; then
if [ " $EMBED " = "zvm" ] ; then
echo " Creating link for $rpmname - $SHORTSHORTVER " '*.s390x.rpm'
rm -f $rpmname -$SHORTSHORTVER *rpm
ln -s $maindir /$rpmname -$SHORTSHORTVER *.s390x.rpm .
fi
else
echo " Creating link for $rpmname - $SHORTSHORTVER " '*rpm'
rm -f $rpmname -$SHORTSHORTVER *rpm
ln -s $maindir /$rpmname -$SHORTSHORTVER *rpm .
fi
done
cd - >/dev/null
2012-01-27 20:40:27 +00:00
fi
2009-11-12 14:35:24 +00:00
# Decide if anything was built or not
2011-12-19 17:01:18 +00:00
if [ -n " $FAILEDRPMS " ] ; then
echo " Error: build of the following RPMs failed: $FAILEDRPMS "
exit 2
fi
2009-11-13 23:09:13 +00:00
if [ $UPLOAD = = 0 -a " $UP " != 1 ] ; then
2009-11-12 14:35:24 +00:00
echo "Nothing new detected"
2011-12-19 17:01:18 +00:00
exit 0
2008-03-04 18:10:05 +00:00
fi
2009-11-12 14:35:24 +00:00
#else we will continue
2009-02-26 21:48:23 +00:00
# Prepare the RPMs for pkging and upload
2009-12-05 20:55:00 +00:00
2009-11-06 20:53:22 +00:00
# get gpg keys in place
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " != "AIX" ] ; then
mkdir -p $HOME /.gnupg
for i in pubring.gpg secring.gpg trustdb.gpg; do
if [ ! -f $HOME /.gnupg/$i ] || [ ` wc -c $HOME /.gnupg/$i | cut -f 1 -d' ' ` = = 0 ] ; then
rm -f $HOME /.gnupg/$i
wget -P $HOME /.gnupg $GSA /keys/$i
chmod 600 $HOME /.gnupg/$i
fi
done
# tell rpm to use gpg to sign
MACROS = $HOME /.rpmmacros
2011-12-19 17:01:18 +00:00
if ! $GREP '%_signature gpg' $MACROS 2>/dev/null; then
2009-12-05 20:55:00 +00:00
echo '%_signature gpg' >> $MACROS
fi
2011-12-19 17:01:18 +00:00
if ! $GREP '%_gpg_name' $MACROS 2>/dev/null; then
2009-12-05 20:55:00 +00:00
echo '%_gpg_name Jarrod Johnson' >> $MACROS
fi
2011-12-21 12:21:31 +00:00
echo "Signing RPMs..."
2013-10-11 21:42:39 +00:00
build-utils/rpmsign.exp ` find $DESTDIR -type f -name '*.rpm' ` | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
build-utils/rpmsign.exp $SRCDIR /*rpm | grep -v -E '(already contains identical signature|was already signed|rpm --quiet --resign|WARNING: standard input reopened)'
2013-08-31 14:35:25 +00:00
createrepo --checksum sha $DESTDIR # specifying checksum so the repo will work on rhel5
createrepo --checksum sha $SRCDIR
2009-12-05 20:55:00 +00:00
rm -f $SRCDIR /repodata/repomd.xml.asc
rm -f $DESTDIR /repodata/repomd.xml.asc
gpg -a --detach-sign $DESTDIR /repodata/repomd.xml
gpg -a --detach-sign $SRCDIR /repodata/repomd.xml
if [ ! -f $DESTDIR /repodata/repomd.xml.key ] ; then
wget -P $DESTDIR /repodata $GSA /keys/repomd.xml.key
fi
if [ ! -f $SRCDIR /repodata/repomd.xml.key ] ; then
wget -P $SRCDIR /repodata $GSA /keys/repomd.xml.key
2009-11-06 20:53:22 +00:00
fi
2009-11-06 20:08:25 +00:00
fi
2009-12-05 20:55:00 +00:00
2013-11-06 15:15:13 +00:00
# set group and permissions correctly on the built rpms
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " = "AIX" ] ; then
chmod +x $DESTDIR /instxcat
fi
2013-11-06 15:15:13 +00:00
chgrp -R $SYSGRP $DESTDIR
2009-02-23 21:03:18 +00:00
chmod -R g+w $DESTDIR
2013-11-06 15:15:13 +00:00
chgrp -R $SYSGRP $SRCDIR
2009-11-06 16:11:05 +00:00
chmod -R g+w $SRCDIR
2010-04-16 14:37:03 +00:00
2013-07-26 18:29:23 +00:00
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
2009-04-07 00:43:03 +00:00
2009-04-17 14:25:21 +00:00
cd $DESTDIR
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " != "AIX" ] ; then
2012-01-27 20:40:27 +00:00
2009-12-05 20:55:00 +00:00
# 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
2012-01-27 20:40:27 +00:00
if [ -n " $1 " ] ; then embed = " $1 / "
else embed = "" ; fi
2009-12-05 20:55:00 +00:00
cat >xCAT-core.repo << EOF
2009-11-06 16:38:13 +00:00
[ xcat-2-core]
name = xCAT 2 Core packages
2012-01-27 20:40:27 +00:00
baseurl = $YUMREPOURL /$REL $EMBEDDIR /$CORE
2009-11-06 16:38:13 +00:00
enabled = 1
gpgcheck = 1
2012-01-27 20:40:27 +00:00
gpgkey = $YUMREPOURL /$REL $EMBEDDIR /$CORE /repodata/repomd.xml.key
2009-11-06 16:38:13 +00:00
EOF
2012-01-27 20:40:27 +00:00
2009-12-05 20:55:00 +00:00
# Create the mklocalrepo script
cat >mklocalrepo.sh << 'EOF2'
2009-11-13 23:09:13 +00:00
#!/bin/sh
cd ` dirname $0 `
REPOFILE = ` basename xCAT-*.repo`
2010-05-05 19:41:16 +00:00
sed -e 's|baseurl=.*|baseurl=file://' "`pwd`" '|' $REPOFILE | sed -e 's|gpgkey=.*|gpgkey=file://' "`pwd`" '/repodata/repomd.xml.key|' > /etc/yum.repos.d/$REPOFILE
2009-11-13 23:09:13 +00:00
cd -
EOF2
2010-03-19 16:54:56 +00:00
chmod 775 mklocalrepo.sh
fi # not AIX
2009-04-17 14:25:21 +00:00
# Build the tarball
2009-05-08 15:09:15 +00:00
cd ..
2011-12-19 17:01:18 +00:00
if [ -n " $VERBOSEMODE " ] ; then
2011-12-22 10:56:44 +00:00
verboseflag = "-v"
2011-12-19 17:01:18 +00:00
else
2011-12-22 10:56:44 +00:00
verboseflag = ""
2011-12-19 17:01:18 +00:00
fi
echo " Creating $TARNAME ... "
2013-11-07 17:09:43 +00:00
if [ [ -e $TARNAME ] ] ; then
mkdir -p previous
mv -f $TARNAME previous
fi
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " = "AIX" ] ; then
2011-12-22 10:56:44 +00:00
tar $verboseflag -hcf ${ TARNAME %.gz } $XCATCORE
2009-12-05 20:55:00 +00:00
gzip ${ TARNAME %.gz }
else
2011-12-22 10:56:44 +00:00
tar $verboseflag -hjcf $TARNAME $XCATCORE
2009-12-05 20:55:00 +00:00
fi
2013-11-06 15:15:13 +00:00
chgrp $SYSGRP $TARNAME
2009-04-07 00:43:03 +00:00
chmod g+w $TARNAME
2009-02-26 21:48:23 +00:00
2009-11-12 14:35:24 +00:00
# Decide whether to upload or not
if [ -n " $UP " ] && [ " $UP " = = 0 ] ; then
exit 0;
fi
#else we will continue
2009-07-31 20:36:29 +00:00
# Upload the individual RPMs to sourceforge
2009-12-05 20:55:00 +00:00
if [ " $OSNAME " = "AIX" ] ; then
YUM = aix
else
YUM = yum
fi
2009-10-08 20:17:51 +00:00
if [ ! -e core-snap ] ; then
ln -s xcat-core core-snap
fi
2011-08-17 16:00:45 +00:00
if [ " $REL " = "devel" -o " $PREGA " != 1 ] ; then
2011-12-19 17:01:18 +00:00
i = 0
2012-01-27 20:40:27 +00:00
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 /
2011-08-17 16:00:45 +00:00
do : ; done
fi
2009-07-31 20:36:29 +00:00
2009-11-06 16:11:05 +00:00
# Upload the individual source RPMs to sourceforge
2011-12-19 17:01:18 +00:00
i = 0
2012-01-27 20:40:27 +00:00
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 /
2009-11-06 16:11:05 +00:00
do : ; done
2009-07-31 20:36:29 +00:00
# Upload the tarball to sourceforge
2010-09-22 13:18:13 +00:00
if [ " $PROMOTE " = 1 -a " $REL " != "devel" -a " $PREGA " != 1 ] ; then
2009-04-16 20:01:54 +00:00
# upload tarball to FRS area
2011-12-19 17:01:18 +00:00
i = 0
2012-01-27 20:40:27 +00:00
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 /
2009-08-13 19:07:34 +00:00
do : ; done
2009-02-26 21:48:23 +00:00
else
2011-12-19 17:01:18 +00:00
i = 0
2012-01-27 20:40:27 +00:00
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 /
2009-07-31 20:36:29 +00:00
do : ; done
2009-02-26 21:48:23 +00:00
fi
2009-06-12 15:49:27 +00:00
# Extract and upload the man pages in html format
2012-01-27 20:40:27 +00:00
if [ " $OSNAME " != "AIX" -a " $REL " = "devel" -a " $PROMOTE " != 1 -a -z " $EMBED " ] ; then
2011-12-22 10:56:44 +00:00
echo "Extracting and uploading man pages to htdocs/ ..."
2009-06-12 15:49:27 +00:00
mkdir -p man
cd man
rm -rf opt
2009-12-05 20:55:00 +00:00
rpm2cpio ../$XCATCORE /xCAT-client-*.$NOARCH .rpm | cpio -id '*.html'
rpm2cpio ../$XCATCORE /perl-xCAT-*.$NOARCH .rpm | cpio -id '*.html'
2010-09-28 14:45:44 +00:00
rpm2cpio ../$XCATCORE /xCAT-test-*.$NOARCH .rpm | cpio -id '*.html'
2012-11-14 14:10:15 +00:00
rpm2cpio ../$XCATCORE /xCAT-buildkit-*.$NOARCH .rpm | cpio -id '*.html'
2013-11-01 20:38:35 +00:00
rpm2cpio ../$XCATCORE /xCAT-OpenStack-*.x86_64.rpm | cpio -id '*.html'
2014-03-03 20:01:37 +00:00
rpm2cpio ../$XCATCORE /xCAT-SoftLayer-*.$NOARCH .rpm | cpio -id '*.html'
2011-12-19 17:01:18 +00:00
i = 0
2011-12-22 13:53:53 +00:00
while [ $(( i += 1 )) -le 5 ] && ! rsync $verboseflag -r 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/
2009-07-31 20:36:29 +00:00
do : ; done
2013-03-13 23:48:24 +00:00
# extract and upload the tools readme
rpm2cpio ../$XCATCORE /xCAT-server-*.$NOARCH .rpm | cpio -id ./opt/xcat/share/xcat/tools/README.html
i = 0
while [ $(( i += 1 )) -le 5 ] && ! rsync $verboseflag opt/xcat/share/xcat/tools/README.html $UPLOADUSER ,xcat@web.sourceforge.net:htdocs/tools/
do : ; done
2009-06-12 15:49:27 +00:00
cd ..
fi