2015-09-01 21:32:54 +02:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2015-09-14 10:36:38 +02:00
|
|
|
RPMBUILD=build/rpmbuild
|
2015-09-01 21:32:54 +02:00
|
|
|
|
|
|
|
if [ ! -e dist/redhat/build_rpm.sh ]; then
|
|
|
|
echo "run build_rpm.sh in top of scylla-jmx dir"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-09-14 10:36:38 +02:00
|
|
|
if [ ! -f /usr/bin/git ] || [ ! -f /usr/bin/mock ] || [ ! -f /usr/bin/rpmbuild ]; then
|
|
|
|
sudo yum install -y git mock rpm-build
|
2015-09-01 21:32:54 +02:00
|
|
|
fi
|
2015-09-17 09:16:12 +02:00
|
|
|
VERSION=$(./SCYLLA-VERSION-GEN)
|
|
|
|
SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE)
|
|
|
|
SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
|
2015-09-01 21:32:54 +02:00
|
|
|
mkdir -p $RPMBUILD/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
2015-09-17 12:23:01 +02:00
|
|
|
git archive --format=tar --prefix=scylla-jmx-$SCYLLA_VERSION/ HEAD -o build/rpmbuild/SOURCES/scylla-jmx-$VERSION.tar
|
2015-09-17 09:16:12 +02:00
|
|
|
cp dist/redhat/scylla-jmx.spec.in $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
sed -i -e "s/@@VERSION@@/$SCYLLA_VERSION/g" $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
sed -i -e "s/@@RELEASE@@/$SCYLLA_RELEASE/g" $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
rpmbuild -bs --define "_topdir $RPMBUILD" -ba $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-jmx-$VERSION*.src.rpm
|