From 23da40b559ed096074995ca97c136363ca5c265d Mon Sep 17 00:00:00 2001 From: Yaron Kaikov Date: Sun, 23 Aug 2020 23:08:17 +0300 Subject: [PATCH 1/4] dist/debian: Remove conflict tag for Java 11 We current require Java 8 to install the scylla-jmx package on Debian. As Debian 10 defaults to Java 11, let's remove the conflict flag and add Java 11 to the dependencies list. --- dist/debian/control.template | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dist/debian/control.template b/dist/debian/control.template index 1564e91..be3b61e 100644 --- a/dist/debian/control.template +++ b/dist/debian/control.template @@ -8,8 +8,7 @@ Rules-Requires-Root: no Package: %{product}-jmx Architecture: all -Depends: ${shlibs:Depends}, ${misc:Depends}, openjdk-8-jre-headless | openjdk-8-jre | oracle-java8-set-default | adoptopenjdk-8-hotspot-jre, %{product}-server -Conflicts: openjdk-11-jre-headless, openjdk-11-jre, oracle-java11-set-default +Depends: ${shlibs:Depends}, ${misc:Depends}, openjdk-8-jre-headless | openjdk-8-jre | oracle-java8-set-default | adoptopenjdk-8-hotspot-jre | openjdk-11-jre-headless | openjdk-11-jre |oracle-java11-set-default , %{product}-server Description: Scylla JMX server binaries Scylla is a highly scalable, eventually consistent, distributed, partitioned row DB. From 99e491df40f3452f21aa9c578eabf7e517af9df0 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Sun, 13 Sep 2020 20:12:58 +0900 Subject: [PATCH 2/4] dist: do not install build dependencies on build script We do not want to install dependencies on package building time, we want to install it on dbuild container. So drop package installation from the scripts. scylladb/scylla#7219 --- dist/debian/build_deb.sh | 41 ---------------------------------------- dist/redhat/build_rpm.sh | 15 --------------- 2 files changed, 56 deletions(-) diff --git a/dist/debian/build_deb.sh b/dist/debian/build_deb.sh index 46b3902..26e5f25 100755 --- a/dist/debian/build_deb.sh +++ b/dist/debian/build_deb.sh @@ -28,16 +28,6 @@ is_redhat_variant() { 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-jmx/SCYLLA-RELOCATABLE-FILE ]; then echo "do not directly execute build_rpm.sh, use reloc/build_rpm.sh instead." @@ -53,37 +43,6 @@ if [ ! -f "$RELOC_PKG" ]; then 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=$(readlink -f $RELOC_PKG) mv scylla-jmx/debian debian diff --git a/dist/redhat/build_rpm.sh b/dist/redhat/build_rpm.sh index 7564649..4e7e8cf 100755 --- a/dist/redhat/build_rpm.sh +++ b/dist/redhat/build_rpm.sh @@ -24,14 +24,6 @@ done is_redhat_variant() { [ -f /etc/redhat-release ] } -pkg_install() { - if is_redhat_variant; then - sudo yum 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." @@ -47,13 +39,6 @@ if [ ! -f "$RELOC_PKG" ]; then exit 1 fi -if [ ! -f /usr/bin/rpmbuild ]; then - pkg_install rpm-build -fi -if [ ! -f /usr/bin/git ]; then - pkg_install git -fi - SCYLLA_VERSION=$(cat SCYLLA-VERSION-FILE) SCYLLA_RELEASE=$(cat SCYLLA-RELEASE-FILE) VERSION=$SCYLLA_VERSION-$SCYLLA_RELEASE From f1612ef508175e5d7f2002a4336df5ead6463741 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Sun, 13 Sep 2020 20:18:43 +0900 Subject: [PATCH 3/4] reloc: simplified .rpm build process We don't really need to have two build_rpm.sh, merge it to reloc. --- dist/redhat/build_rpm.sh | 59 ---------------------------------------- reloc/build_rpm.sh | 30 ++++++++++++++------ 2 files changed, 22 insertions(+), 67 deletions(-) delete mode 100755 dist/redhat/build_rpm.sh diff --git a/dist/redhat/build_rpm.sh b/dist/redhat/build_rpm.sh deleted file mode 100755 index 4e7e8cf..0000000 --- a/dist/redhat/build_rpm.sh +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash -e - -PRODUCT=$(cat SCYLLA-PRODUCT-FILE) - -. /etc/os-release -print_usage() { - echo "build_rpm.sh --reloc-pkg build/scylla-jmx-package.tar.gz" - echo " --reloc-pkg specify relocatable package path" - exit 1 -} -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 ] -} - -if [ ! -e SCYLLA-RELOCATABLE-FILE ]; then - echo "do not directly execute build_rpm.sh, use reloc/build_rpm.sh instead." - 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 - -SCYLLA_VERSION=$(cat SCYLLA-VERSION-FILE) -SCYLLA_RELEASE=$(cat SCYLLA-RELEASE-FILE) -VERSION=$SCYLLA_VERSION-$SCYLLA_RELEASE - -RPMBUILD=$(readlink -f ../) -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" -) - -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" $RPM_JOBS_OPTS $RPMBUILD/SPECS/scylla-jmx.spec diff --git a/reloc/build_rpm.sh b/reloc/build_rpm.sh index 36772a5..2c5a229 100755 --- a/reloc/build_rpm.sh +++ b/reloc/build_rpm.sh @@ -1,19 +1,16 @@ #!/bin/bash -e -. /etc/os-release print_usage() { echo "build_rpm.sh --reloc-pkg build/scylla-jmx-package.tar.gz" echo " --reloc-pkg specify relocatable package path" echo " --builddir specify rpmbuild directory" exit 1 } -RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz) +RELOC_PKG=build/scylla-jmx-package.tar.gz BUILDDIR=build/redhat -OPTS="" while [ $# -gt 0 ]; do case "$1" in "--reloc-pkg") - OPTS="$OPTS $1 $(readlink -f $2)" RELOC_PKG=$2 shift 2 ;; @@ -27,10 +24,27 @@ while [ $# -gt 0 ]; do esac done -if [[ ! $OPTS =~ --reloc-pkg ]]; then - OPTS="$OPTS --reloc-pkg $RELOC_PKG" -fi +RELOC_PKG=$(readlink -f $RELOC_PKG) +RPMBUILD=$(readlink -f $BUILDDIR) 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 -exec ./dist/redhat/build_rpm.sh $OPTS + +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" +) + +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 From 5fa422c4eada154fe86d274c296df491dcb10090 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Sun, 13 Sep 2020 20:18:56 +0900 Subject: [PATCH 4/4] reloc: simplified .deb build process We don't really need to have two build_deb.sh, merge it to reloc. --- dist/debian/build_deb.sh | 54 ---------------------------------------- reloc/build_deb.sh | 20 +++++++++------ 2 files changed, 12 insertions(+), 62 deletions(-) delete mode 100755 dist/debian/build_deb.sh diff --git a/dist/debian/build_deb.sh b/dist/debian/build_deb.sh deleted file mode 100755 index 26e5f25..0000000 --- a/dist/debian/build_deb.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -e - -PRODUCT=$(cat scylla-jmx/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 ] -} - -if [ ! -e scylla-jmx/SCYLLA-RELOCATABLE-FILE ]; then - echo "do not directly execute build_rpm.sh, use reloc/build_rpm.sh instead." - 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 - -RELOC_PKG=$(readlink -f $RELOC_PKG) - -mv scylla-jmx/debian debian -PKG_NAME=$(dpkg-parsechangelog --show-field Source) -# XXX: Drop revision number from version string. -# Since it always '1', this should be okay for now. -PKG_VERSION=$(dpkg-parsechangelog --show-field Version |sed -e 's/-1$//') -ln -fv $RELOC_PKG ../"$PKG_NAME"_"$PKG_VERSION".orig.tar.gz -debuild -rfakeroot -us -uc diff --git a/reloc/build_deb.sh b/reloc/build_deb.sh index a9408c3..63aed75 100755 --- a/reloc/build_deb.sh +++ b/reloc/build_deb.sh @@ -1,6 +1,5 @@ #!/bin/bash -e -. /etc/os-release print_usage() { echo "build_deb.sh --reloc-pkg build/scylla-jmx-package.tar.gz" echo " --reloc-pkg specify relocatable package path" @@ -8,13 +7,11 @@ print_usage() { exit 1 } -RELOC_PKG=$(readlink -f build/scylla-jmx-package.tar.gz) +RELOC_PKG=build/scylla-jmx-package.tar.gz BUILDDIR=build/debian -OPTS="" while [ $# -gt 0 ]; do case "$1" in "--reloc-pkg") - OPTS="$OPTS $1 $(readlink -f $2)" RELOC_PKG=$2 shift 2 ;; @@ -28,11 +25,18 @@ while [ $# -gt 0 ]; do esac done -if [[ ! $OPTS =~ --reloc-pkg ]]; then - OPTS="$OPTS --reloc-pkg $RELOC_PKG" -fi +RELOC_PKG=$(readlink -f $RELOC_PKG) rm -rf "$BUILDDIR" mkdir -p "$BUILDDIR"/scylla-package tar -C "$BUILDDIR"/scylla-package -xpf $RELOC_PKG cd "$BUILDDIR"/scylla-package -exec ./scylla-jmx/dist/debian/build_deb.sh $OPTS + +RELOC_PKG=$(readlink -f $RELOC_PKG) + +mv scylla-jmx/debian debian +PKG_NAME=$(dpkg-parsechangelog --show-field Source) +# XXX: Drop revision number from version string. +# Since it always '1', this should be okay for now. +PKG_VERSION=$(dpkg-parsechangelog --show-field Version |sed -e 's/-1$//') +ln -fv $RELOC_PKG ../"$PKG_NAME"_"$PKG_VERSION".orig.tar.gz +debuild -rfakeroot -us -uc