|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
PACKAGE=$(basename $(pwd))
|
|
|
|
VERSION=$(rpm -q --qf "%{version}" --specfile $PACKAGE.spec)
|
|
|
|
ME=$(whoami)
|
|
|
|
BRANCH=$(git branch | grep '*' | cut -d' ' -f2)
|
|
|
|
|
|
|
|
DIST=$1
|
|
|
|
if [ -z $DIST ]; then
|
|
|
|
DIST="el5"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Generate ChangeLog
|
|
|
|
git log --format=%H --grep="update changelog" > ignore_hash
|
|
|
|
git log --format=%H | grep -v -f ignore_hash | git log --pretty --stdin --no-walk > CHANGELOG.git
|
|
|
|
rm -f ignore_hash
|
|
|
|
git add CHANGELOG.git
|
|
|
|
git commit -m 'update changelog' CHANGELOG.git
|
|
|
|
|
|
|
|
# Tag GIT using the version in the spec file
|
|
|
|
git tag $VERSION
|
|
|
|
|
|
|
|
# Create needed dirs on the build box
|
|
|
|
ssh -l $ME build.firewall-services.com mkdir -p rpmbuild/{RPMS,SRPMS,SPECS,SOURCES}
|
|
|
|
|
|
|
|
# Generate a tgz archive from the repo
|
|
|
|
git archive --format=tar.gz --prefix=$PACKAGE-$VERSION/ $BRANCH | ssh -l $ME build.firewall-services.com "cat > rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz"
|
|
|
|
|
|
|
|
# Upload the spec file
|
|
|
|
scp $PACKAGE.spec $ME@build.firewall-services.com:rpmbuild/SPECS/
|
|
|
|
|
|
|
|
# And build
|
|
|
|
ssh -l $ME build.firewall-services.com rpmbuild -bs --nodeps rpmbuild/SPECS/$PACKAGE.spec
|
|
|
|
ssh -l $ME build.firewall-services.com buildrpm rpmbuild/SRPMS/$PACKAGE-$VERSION-*.src.rpm $DIST
|
|
|
|
ssh -l $ME build.firewall-services.com rm -f rpmbuild/SPECS/$PACKAGE.spec rpmbuild/SOURCES/$PACKAGE-$VERSION.tar.gz rpmbuild/SRPMS/$PACKAGE-$VERSION*.src.rpm
|
|
|
|
|