2018-10-24 04:04:47 +02:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
|
|
|
print_usage() {
|
|
|
|
echo "build_rpm.sh --reloc-pkg build/scylla-jmx-package.tar.gz"
|
|
|
|
echo " --reloc-pkg specify relocatable package path"
|
2020-07-17 10:57:23 +02:00
|
|
|
echo " --builddir specify rpmbuild directory"
|
2018-10-24 04:04:47 +02:00
|
|
|
exit 1
|
|
|
|
}
|
2020-09-13 13:18:43 +02:00
|
|
|
RELOC_PKG=build/scylla-jmx-package.tar.gz
|
2020-07-17 10:57:23 +02:00
|
|
|
BUILDDIR=build/redhat
|
2018-10-24 04:04:47 +02:00
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
case "$1" in
|
|
|
|
"--reloc-pkg")
|
|
|
|
RELOC_PKG=$2
|
|
|
|
shift 2
|
|
|
|
;;
|
2020-07-17 10:57:23 +02:00
|
|
|
"--builddir")
|
|
|
|
BUILDDIR="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
2018-10-24 04:04:47 +02:00
|
|
|
*)
|
|
|
|
print_usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2020-09-13 13:18:43 +02:00
|
|
|
RELOC_PKG=$(readlink -f $RELOC_PKG)
|
|
|
|
RPMBUILD=$(readlink -f $BUILDDIR)
|
2020-07-17 10:57:23 +02:00
|
|
|
mkdir -p "$BUILDDIR"
|
|
|
|
tar -C "$BUILDDIR" -xpf $RELOC_PKG scylla-jmx/SCYLLA-RELEASE-FILE scylla-jmx/SCYLLA-RELOCATABLE-FILE scylla-jmx/SCYLLA-VERSION-FILE scylla-jmx/SCYLLA-PRODUCT-FILE scylla-jmx/dist/redhat
|
|
|
|
cd "$BUILDDIR"/scylla-jmx
|
2020-09-13 13:18:43 +02:00
|
|
|
|
2020-10-11 19:17:41 +02:00
|
|
|
RELOC_PKG_BASENAME=$(basename "$RELOC_PKG")
|
2020-09-13 13:18:43 +02:00
|
|
|
SCYLLA_VERSION=$(cat SCYLLA-VERSION-FILE)
|
|
|
|
SCYLLA_RELEASE=$(cat SCYLLA-RELEASE-FILE)
|
|
|
|
VERSION=$SCYLLA_VERSION-$SCYLLA_RELEASE
|
|
|
|
PRODUCT=$(cat SCYLLA-PRODUCT-FILE)
|
|
|
|
|
|
|
|
mkdir -p $RPMBUILD/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
|
|
|
|
|
|
|
ln -fv $RELOC_PKG $RPMBUILD/SOURCES/
|
|
|
|
|
|
|
|
parameters=(
|
|
|
|
-D"version $SCYLLA_VERSION"
|
|
|
|
-D"release $SCYLLA_RELEASE"
|
|
|
|
-D"product $PRODUCT"
|
2020-10-11 19:17:41 +02:00
|
|
|
-D"reloc_pkg $RELOC_PKG_BASENAME"
|
2020-09-13 13:18:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
cp dist/redhat/scylla-jmx.spec $RPMBUILD/SPECS
|
|
|
|
# this rpm can be install on both fedora / centos7, so drop distribution name from the file name
|
|
|
|
rpmbuild -ba "${parameters[@]}" --define '_binary_payload w2.xzdio' --define "_topdir $RPMBUILD" --undefine "dist" $RPMBUILD/SPECS/scylla-jmx.spec
|