2008-03-04 18:10:05 +00:00
|
|
|
#!/bin/sh
|
2009-02-23 21:03:18 +00:00
|
|
|
|
2009-05-08 16:31:57 +00:00
|
|
|
# Build and upload the xcat-core code. This script and the rest of the xcat-core source should
|
|
|
|
# be in a dir called <rel>/src/xcat-code, where <rel> is the same as the release dir it will be
|
|
|
|
# uploaded to in sourceforge (e.g. devel, or 2.2).
|
2009-02-23 21:03:18 +00:00
|
|
|
|
2009-05-08 16:31:57 +00:00
|
|
|
# Usage: buildcore.sh [promote]
|
2009-04-07 00:43:03 +00:00
|
|
|
# promote - if the keyword "promote" is specified, means an official dot release.
|
2009-02-26 21:48:23 +00:00
|
|
|
# Otherwise, and snap build is assumed.
|
|
|
|
# You can override the default upload behavior by specifying env var: UP=0 or UP=1
|
2009-05-08 15:09:15 +00:00
|
|
|
# You can control which rpms get built by specifying a coresvnup file env var: SVNUP=<filename>
|
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
|
|
|
|
|
2009-04-07 00:43:03 +00:00
|
|
|
set -x
|
2009-02-23 21:03:18 +00:00
|
|
|
export HOME=/root
|
2008-03-04 18:10:05 +00:00
|
|
|
cd `dirname $0`
|
2009-05-08 16:31:57 +00:00
|
|
|
|
|
|
|
# Strip the /src/xcat-core from the end of the dir to get the next dir up and use as the release
|
|
|
|
CURDIR=`pwd`
|
|
|
|
D=${CURDIR/\/src\/xcat-core/}
|
|
|
|
REL=`basename $D`
|
|
|
|
|
2009-01-28 15:42:14 +00:00
|
|
|
VER=`cat Version`
|
2009-04-07 00:43:03 +00:00
|
|
|
if [ "$2" = "promote" ]; then
|
|
|
|
CORE="xcat-core"
|
|
|
|
TARNAME=xcat-core-$VER.tar.bz2
|
|
|
|
else
|
|
|
|
CORE="core-snap"
|
|
|
|
TARNAME=core-rpms-snap.tar.bz2
|
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
DESTDIR=../../$CORE
|
2009-04-07 00:43:03 +00:00
|
|
|
|
2009-04-17 14:25:21 +00:00
|
|
|
|
2009-04-07 00:43:03 +00:00
|
|
|
if [ "$2" != "promote" ]; then # very long if statement to not do builds if we are promoting
|
|
|
|
mkdir -p $DESTDIR
|
2009-05-08 15:09:15 +00:00
|
|
|
SRCDIR=../../core-snap-srpms
|
2009-04-07 00:43:03 +00:00
|
|
|
mkdir -p $SRCDIR
|
2008-03-04 18:10:05 +00:00
|
|
|
GREP=grep
|
|
|
|
UPLOAD=0
|
|
|
|
if [ -f /etc/redhat-release ]
|
|
|
|
then
|
|
|
|
pkg="redhat"
|
|
|
|
else
|
|
|
|
pkg="packages"
|
|
|
|
fi
|
|
|
|
|
2009-05-08 18:46:56 +00:00
|
|
|
BUILDIT=0
|
2009-05-08 15:09:15 +00:00
|
|
|
if [ -z "$SVNUP" ]; then
|
|
|
|
SVNUP=../coresvnup
|
|
|
|
svn up > $SVNUP
|
2009-05-08 18:46:56 +00:00
|
|
|
if ! grep 'At revision' $SVNUP; then
|
|
|
|
BUILDIT=1
|
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
fi
|
2009-01-28 15:42:14 +00:00
|
|
|
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP xCAT-client $SVNUP; then
|
2008-03-04 18:10:05 +00:00
|
|
|
UPLOAD=1
|
|
|
|
./makeclientrpm
|
|
|
|
rm -f $DESTDIR/xCAT-client*rpm
|
|
|
|
rm -f $SRCDIR/xCAT-client*rpm
|
2009-01-28 15:42:14 +00:00
|
|
|
mv /usr/src/$pkg/RPMS/noarch/xCAT-client-$VER*rpm $DESTDIR/
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-client-$VER*rpm $SRCDIR/
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-05-08 18:46:56 +00:00
|
|
|
if [ $BUILDIT eq 1 ]; then #$GREP perl-xCAT $SVNUP; then
|
2008-03-04 18:10:05 +00:00
|
|
|
UPLOAD=1
|
|
|
|
./makeperlxcatrpm
|
|
|
|
rm -f $DESTDIR/perl-xCAT*rpm
|
|
|
|
rm -f $SRCDIR/perl-xCAT*rpm
|
2009-01-28 15:42:14 +00:00
|
|
|
mv /usr/src/$pkg/RPMS/noarch/perl-xCAT-$VER*rpm $DESTDIR/
|
|
|
|
mv /usr/src/$pkg/SRPMS/perl-xCAT-$VER*rpm $SRCDIR/
|
2009-01-26 14:25:00 +00:00
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP xCAT-web $SVNUP; then
|
2009-01-26 14:25:00 +00:00
|
|
|
UPLOAD=1
|
|
|
|
rm -f $DESTDIR/xCAT-web*
|
|
|
|
rm -f $SRCDIR/xCAT-web*
|
|
|
|
./makewebrpm
|
2009-01-28 15:42:14 +00:00
|
|
|
mv /usr/src/$pkg/RPMS/noarch/xCAT-web-$VER*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-web-$VER*rpm $SRCDIR
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP xCAT-server $SVNUP; then
|
2008-03-04 18:10:05 +00:00
|
|
|
UPLOAD=1
|
|
|
|
./makeserverrpm
|
|
|
|
rm -f $DESTDIR/xCAT-server*rpm
|
|
|
|
rm -f $SRCDIR/xCAT-server*rpm
|
2009-01-28 15:42:14 +00:00
|
|
|
mv /usr/src/$pkg/RPMS/noarch/xCAT-server-$VER*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-server-$VER*rpm $SRCDIR
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP xCAT-rmc $SVNUP; then
|
2009-03-09 12:42:55 +00:00
|
|
|
UPLOAD=1
|
|
|
|
./makermcrpm
|
|
|
|
rm -f $DESTDIR/xCAT-rmc*rpm
|
|
|
|
rm -f $SRCDIR/xCAT-rmc*rpm
|
|
|
|
mv /usr/src/$pkg/RPMS/noarch/xCAT-rmc-$VER*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-rmc-$VER*rpm $SRCDIR
|
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP xCAT-nbroot $SVNUP; then
|
2008-03-04 18:10:05 +00:00
|
|
|
UPLOAD=1
|
2009-01-28 15:42:14 +00:00
|
|
|
./makenbrootrpm x86_64
|
|
|
|
./makenbrootrpm ppc64
|
|
|
|
./makenbrootrpm x86
|
2008-03-04 18:10:05 +00:00
|
|
|
rm -f $DESTDIR/xCAT-nbroot-core*rpm
|
|
|
|
rm -f $SRCDIR/xCAT-nbroot-core*rpm
|
|
|
|
mv /usr/src/$pkg/RPMS/noarch/xCAT-nbroot-core-*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-nbroot-core-*rpm $SRCDIR
|
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP -E '^[UAD] +xCATsn/' $SVNUP; then
|
2008-03-18 20:02:53 +00:00
|
|
|
UPLOAD=1
|
2009-01-28 15:42:14 +00:00
|
|
|
rm -f $DESTDIR/xCATsn-$VER*rpm
|
|
|
|
rm -f $SRCDIR/xCATsn-$VER*rpm
|
|
|
|
./makexcatsnrpm x86_64
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCATsn-$VER*rpm $SRCDIR
|
|
|
|
./makexcatsnrpm i386
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm $DESTDIR
|
|
|
|
./makexcatsnrpm ppc64
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm $DESTDIR
|
2009-03-26 22:38:47 +00:00
|
|
|
./makexcatsnrpm s390x
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCATsn-$VER*rpm $DESTDIR
|
2008-03-18 20:02:53 +00:00
|
|
|
fi
|
2009-05-08 15:09:15 +00:00
|
|
|
if $GREP -E '^[UAD] +xCAT/' $SVNUP; then
|
2008-03-04 18:10:05 +00:00
|
|
|
UPLOAD=1
|
2009-01-28 15:42:14 +00:00
|
|
|
rm -f $DESTDIR/xCAT-$VER*rpm
|
|
|
|
rm -f $SRCDIR/xCAT-$VER*rpm
|
|
|
|
./makexcatrpm x86_64
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm $DESTDIR
|
|
|
|
mv /usr/src/$pkg/SRPMS/xCAT-$VER*rpm $SRCDIR
|
2009-03-26 22:38:47 +00:00
|
|
|
./makexcatrpm i386
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm $DESTDIR
|
2009-01-28 15:42:14 +00:00
|
|
|
./makexcatrpm ppc64
|
|
|
|
mv /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm $DESTDIR
|
2009-03-26 22:38:47 +00:00
|
|
|
./makexcatrpm s390x
|
2009-01-28 15:42:14 +00:00
|
|
|
mv /usr/src/$pkg/RPMS/*/xCAT-$VER*rpm $DESTDIR
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-02-26 21:48:23 +00:00
|
|
|
|
|
|
|
# Decide whether to upload or not
|
|
|
|
if [ -n "$UP" ]; then
|
|
|
|
if [ $UP == 0 ]; then
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
#else we will continue
|
|
|
|
else
|
|
|
|
if [ $UPLOAD == 0 ]; then
|
|
|
|
echo "Nothing new detected"
|
|
|
|
exit 0;
|
|
|
|
fi
|
|
|
|
#else we will continue
|
2008-03-04 18:10:05 +00:00
|
|
|
fi
|
2009-02-26 21:48:23 +00:00
|
|
|
|
|
|
|
# Prepare the RPMs for pkging and upload
|
2009-02-23 21:03:18 +00:00
|
|
|
build-utils/rpmsign.exp $DESTDIR/*rpm
|
|
|
|
build-utils/rpmsign.exp $SRCDIR/*rpm
|
2008-03-04 18:10:05 +00:00
|
|
|
createrepo $DESTDIR
|
|
|
|
createrepo $SRCDIR
|
2009-01-26 14:25:00 +00:00
|
|
|
rm $SRCDIR/repodata/repomd.xml.asc
|
|
|
|
rm $DESTDIR/repodata/repomd.xml.asc
|
|
|
|
gpg -a --detach-sign $DESTDIR/repodata/repomd.xml
|
|
|
|
gpg -a --detach-sign $SRCDIR/repodata/repomd.xml
|
2009-02-23 21:03:18 +00:00
|
|
|
chgrp -R xcat $DESTDIR
|
|
|
|
chmod -R g+w $DESTDIR
|
2009-04-07 00:43:03 +00:00
|
|
|
fi # end of very long if-not-promote
|
|
|
|
|
2009-04-17 14:25:21 +00:00
|
|
|
|
|
|
|
# Modify the repo file to point to either xcat-core or core-snap
|
|
|
|
cd $DESTDIR
|
|
|
|
if [ "$2" = "promote" ]; 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
|
|
|
|
sed -e 's|/xcat-core|/core-snap|' xCAT-core.repo > xCAT-core.repo.new
|
|
|
|
mv -f xCAT-core.repo.new xCAT-core.repo
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build the tarball
|
2009-05-08 15:09:15 +00:00
|
|
|
cd ..
|
2009-04-07 00:43:03 +00:00
|
|
|
tar -hjcvf $TARNAME $CORE
|
|
|
|
chgrp xcat $TARNAME
|
|
|
|
chmod g+w $TARNAME
|
2009-02-26 21:48:23 +00:00
|
|
|
|
2009-04-17 14:25:21 +00:00
|
|
|
# Upload the tarball and individual RPMs to sourceforge
|
2009-04-08 03:17:59 +00:00
|
|
|
rsync -rLv --delete $CORE $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/
|
2009-04-08 03:03:39 +00:00
|
|
|
if [ "$2" = "promote" -a "$1" != "devel" ]; then
|
2009-04-16 20:01:54 +00:00
|
|
|
# upload tarball to FRS area
|
|
|
|
scp $TARNAME $UPLOADUSER@web.sourceforge.net:uploads/
|
|
|
|
echo "$TARNAME has been uploaded to the FRS uploads dir. Remember to move it into the release."
|
2009-02-26 21:48:23 +00:00
|
|
|
else
|
2009-04-07 00:43:03 +00:00
|
|
|
scp $TARNAME $UPLOADUSER,xcat@web.sourceforge.net:htdocs/yum/$REL/
|
2009-02-26 21:48:23 +00:00
|
|
|
fi
|