Drop dependency on pystache since it nolong present in Fedora 32. To implement it, simplified debian package build process. It will be generate debian/ directory when building relocatable package, we just need to run debuild using the package. To generate debian/ directory this commit added debian_files_gen.py, it construct whole directory including control and changelog files from template files. Since we need to stop pystache, these template files swiched to string.Template class which is included python3 standard library. see: https://github.com/scylladb/scylla/pull/6313
99 lines
2.3 KiB
Bash
Executable File
99 lines
2.3 KiB
Bash
Executable File
#!/bin/bash -e
|
|
|
|
PRODUCT=$(cat SCYLLA-PRODUCT-FILE)
|
|
|
|
. /etc/os-release
|
|
print_usage() {
|
|
echo "build_deb.sh --reloc-pkg build/scylla-jmx-package.tar.gz"
|
|
echo " --reloc-pkg specify relocatable package path"
|
|
exit 1
|
|
}
|
|
TARGET=stable
|
|
RELOC_PKG=
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
"--reloc-pkg")
|
|
RELOC_PKG=$2
|
|
shift 2
|
|
;;
|
|
*)
|
|
print_usage
|
|
;;
|
|
esac
|
|
done
|
|
|
|
is_redhat_variant() {
|
|
[ -f /etc/redhat-release ]
|
|
}
|
|
is_debian_variant() {
|
|
[ -f /etc/debian_version ]
|
|
}
|
|
pkg_install() {
|
|
if is_redhat_variant; then
|
|
sudo yum install -y $1
|
|
elif is_debian_variant; then
|
|
sudo apt-get install -y $1
|
|
else
|
|
echo "Requires to install following command: $1"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
if [ ! -e SCYLLA-RELOCATABLE-FILE ]; then
|
|
echo "do not directly execute build_rpm.sh, use reloc/build_rpm.sh instead."
|
|
exit 1
|
|
fi
|
|
|
|
if [ "$(arch)" != "x86_64" ]; then
|
|
echo "Unsupported architecture: $(arch)"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$RELOC_PKG" ]; then
|
|
print_usage
|
|
exit 1
|
|
fi
|
|
if [ ! -f "$RELOC_PKG" ]; then
|
|
echo "$RELOC_PKG is not found."
|
|
exit 1
|
|
fi
|
|
|
|
if is_debian_variant; then
|
|
sudo apt-get -y update
|
|
fi
|
|
# this hack is needed since some environment installs 'git-core' package, it's
|
|
# subset of the git command and doesn't works for our git-archive-all script.
|
|
if is_redhat_variant && [ ! -f /usr/libexec/git-core/git-submodule ]; then
|
|
sudo yum install -y git
|
|
fi
|
|
if [ ! -f /usr/bin/git ]; then
|
|
pkg_install git
|
|
fi
|
|
if [ ! -f /usr/bin/python ]; then
|
|
pkg_install python
|
|
fi
|
|
if [ ! -f /usr/sbin/debuild ]; then
|
|
pkg_install devscripts
|
|
fi
|
|
if [ ! -f /usr/bin/dh_testdir ]; then
|
|
pkg_install debhelper
|
|
fi
|
|
if [ ! -f /usr/bin/fakeroot ]; then
|
|
pkg_install fakeroot
|
|
fi
|
|
|
|
if [ "$ID" = "ubuntu" ] && [ ! -f /usr/share/keyrings/debian-archive-keyring.gpg ]; then
|
|
sudo apt-get install -y debian-archive-keyring
|
|
fi
|
|
if [ "$ID" = "debian" ] && [ ! -f /usr/share/keyrings/ubuntu-archive-keyring.gpg ]; then
|
|
sudo apt-get install -y ubuntu-archive-keyring
|
|
fi
|
|
|
|
RELOC_PKG_FULLPATH=$(readlink -f $RELOC_PKG)
|
|
RELOC_PKG_BASENAME=$(basename $RELOC_PKG)
|
|
SCYLLA_VERSION=$(cat SCYLLA-VERSION-FILE | sed 's/\.rc/~rc/')
|
|
SCYLLA_RELEASE=$(cat SCYLLA-RELEASE-FILE)
|
|
|
|
ln -fv $RELOC_PKG_FULLPATH ../$PRODUCT-jmx_$SCYLLA_VERSION-$SCYLLA_RELEASE.orig.tar.gz
|
|
debuild -rfakeroot -us -uc
|