reloc: Add "--builddir" option to build_{rpm,deb}.sh

We need the ability to control build directory in scylla.git build
system. Let's add support for the "--builddir" option like in other
variants of the same scripts.

Message-Id: <20200717085723.701209-1-penberg@scylladb.com>
This commit is contained in:
Pekka Enberg 2020-07-17 11:57:23 +03:00 committed by Avi Kivity
parent aa94fe53e0
commit 7578d359af
2 changed files with 19 additions and 7 deletions

View File

@ -4,10 +4,12 @@
print_usage() { print_usage() {
echo "build_deb.sh --reloc-pkg build/scylla-jmx-package.tar.gz" echo "build_deb.sh --reloc-pkg build/scylla-jmx-package.tar.gz"
echo " --reloc-pkg specify relocatable package path" echo " --reloc-pkg specify relocatable package path"
echo " --builddir specify Debian package build path"
exit 1 exit 1
} }
RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz) RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz)
BUILDDIR=build/debian
OPTS="" OPTS=""
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -16,6 +18,10 @@ while [ $# -gt 0 ]; do
RELOC_PKG=$2 RELOC_PKG=$2
shift 2 shift 2
;; ;;
"--builddir")
BUILDDIR="$2"
shift 2
;;
*) *)
print_usage print_usage
;; ;;
@ -25,8 +31,8 @@ done
if [[ ! $OPTS =~ --reloc-pkg ]]; then if [[ ! $OPTS =~ --reloc-pkg ]]; then
OPTS="$OPTS --reloc-pkg $RELOC_PKG" OPTS="$OPTS --reloc-pkg $RELOC_PKG"
fi fi
rm -rf build/debian rm -rf "$BUILDDIR"
mkdir -p build/debian/scylla-package mkdir -p "$BUILDDIR"/scylla-package
tar -C build/debian/scylla-package -xpf $RELOC_PKG tar -C "$BUILDDIR"/scylla-package -xpf $RELOC_PKG
cd build/debian/scylla-package cd "$BUILDDIR"/scylla-package
exec ./scylla-jmx/dist/debian/build_deb.sh $OPTS exec ./scylla-jmx/dist/debian/build_deb.sh $OPTS

View File

@ -4,9 +4,11 @@
print_usage() { print_usage() {
echo "build_rpm.sh --reloc-pkg build/scylla-jmx-package.tar.gz" echo "build_rpm.sh --reloc-pkg build/scylla-jmx-package.tar.gz"
echo " --reloc-pkg specify relocatable package path" echo " --reloc-pkg specify relocatable package path"
echo " --builddir specify rpmbuild directory"
exit 1 exit 1
} }
RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz) RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz)
BUILDDIR=build/redhat
OPTS="" OPTS=""
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
case "$1" in case "$1" in
@ -15,6 +17,10 @@ while [ $# -gt 0 ]; do
RELOC_PKG=$2 RELOC_PKG=$2
shift 2 shift 2
;; ;;
"--builddir")
BUILDDIR="$2"
shift 2
;;
*) *)
print_usage print_usage
;; ;;
@ -24,7 +30,7 @@ done
if [[ ! $OPTS =~ --reloc-pkg ]]; then if [[ ! $OPTS =~ --reloc-pkg ]]; then
OPTS="$OPTS --reloc-pkg $RELOC_PKG" OPTS="$OPTS --reloc-pkg $RELOC_PKG"
fi fi
mkdir -p build/redhat mkdir -p "$BUILDDIR"
tar -C build/redhat/ -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 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 build/redhat/scylla-jmx cd "$BUILDDIR"/scylla-jmx
exec ./dist/redhat/build_rpm.sh $OPTS exec ./dist/redhat/build_rpm.sh $OPTS