Legacy build scripts, not maintained nor used anymore
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.8 KiB

#!/bin/bash
PACKAGE=$(basename $(pwd))
VERSION=$(rpm -q --qf "%{version}\n" --specfile $PACKAGE.spec | head -1)
#RELEASE=$(rpm -q --qf "%{release}\n" --specfile $PACKAGE.spec | head -1)
ME=$(whoami)
SERVER=build.firewall-services.com
BRANCH=$(git branch | grep '*' | cut -d' ' -f2)
DIST=$1
if [ -z $DIST ]; then
DIST="el5"
fi
TMPDIR=$(mktemp -d)
mkdir -p $TMPDIR/$PACKAGE-$VERSION/
SOCKET=$(mktemp -u)
# Open master SSH socket
ssh -M -f -N -o ControlPath=$SOCKET -l $ME $SERVER
# Tag GIT using the version in the spec file
git tag -f $VERSION 2>&1 > /dev/null
# Create needed dirs on the build box
ssh -o ControlPath=$SOCKET -l $ME $SERVER mkdir -p rpmbuild/{RPMS,SRPMS,SPECS,SOURCES}
# Generate a tgz archive from the repo
git archive --format=tar --prefix=$PACKAGE-$VERSION/ $BRANCH | tar xf - -C $TMPDIR
# Generate ChangeLog
git log --format=%H | git log --pretty --stdin --no-walk > $TMPDIR/$PACKAGE-$VERSION/CHANGELOG.git
#tar cz -C $TMPDIR $PACKAGE-$VERSION | ssh -l $ME build.firewall-services.com "cat > rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz"
tar czf $TMPDIR/$PACKAGE-$VERSION.tar.gz -C $TMPDIR $PACKAGE-$VERSION
scp -o ControlPath=$SOCKET -C $TMPDIR/$PACKAGE-$VERSION.tar.gz $ME@$SERVER:rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz
# Upload the spec file
scp -o ControlPath=$SOCKET $PACKAGE.spec $ME@$SERVER:rpmbuild/SPECS/
# And build
ssh -o ControlPath=$SOCKET -l $ME $SERVER rpmbuild -bs --nodeps rpmbuild/SPECS/$PACKAGE.spec
ssh -o ControlPath=$SOCKET -l $ME $SERVER buildrpm rpmbuild/SRPMS/$PACKAGE-$VERSION-*.src.rpm $DIST
ssh -o ControlPath=$SOCKET -l $ME $SERVER rm -f rpmbuild/SPECS/$PACKAGE.spec rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz rpmbuild/SRPMS/$PACKAGE-$VERSION*.src.rpm
rm -rf $TMPDIR
# Close master SSH connexion
ssh -S $SOCKET -O exit -l $ME $SERVER