2016-04-30 09:40:40 +02:00
|
|
|
#!/bin/bash -e
|
2015-09-01 21:32:54 +02:00
|
|
|
|
2015-10-12 22:39:47 +02:00
|
|
|
RPMBUILD=`pwd`/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-10-12 22:39:47 +02:00
|
|
|
|
|
|
|
sudo yum install -y rpm-build git
|
|
|
|
|
|
|
|
OS=`awk '{print $1}' /etc/redhat-release`
|
|
|
|
if [ "$OS" = "Fedora" ] && [ ! -f /usr/bin/mock ]; then
|
|
|
|
sudo yum -y install mock
|
|
|
|
elif [ "$OS" = "CentOS" ] && [ ! -f /usr/bin/yum-builddep ]; then
|
|
|
|
sudo yum -y install yum-utils
|
2015-09-01 21:32:54 +02:00
|
|
|
fi
|
2015-10-12 22:39:47 +02:00
|
|
|
|
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
|
2015-10-12 22:39:47 +02:00
|
|
|
|
|
|
|
if [ "$OS" = "Fedora" ]; then
|
|
|
|
rpmbuild -bs --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
/usr/bin/mock rebuild --resultdir=`pwd`/build/rpms $RPMBUILD/SRPMS/scylla-jmx-$VERSION*.src.rpm
|
|
|
|
else
|
|
|
|
sudo yum-builddep -y $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
rpmbuild -ba --define "_topdir $RPMBUILD" $RPMBUILD/SPECS/scylla-jmx.spec
|
|
|
|
fi
|