From 6c69351ea10bd445d2100e2c44d835bf7e4e909e Mon Sep 17 00:00:00 2001 From: Matej Ferencevic Date: Mon, 6 Apr 2020 14:00:48 +0200 Subject: [PATCH] Fix RPM packaging Reviewers: buda Reviewed By: buda Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D2756 --- release/CMakeLists.txt | 2 +- release/examples/build_examples | 2 +- release/get_version.py | 24 ++++++++++++------------ release/rpm/community/memgraph.spec.in | 13 +++++++++++++ release/rpm/enterprise/memgraph.spec.in | 13 +++++++++++++ 5 files changed, 40 insertions(+), 14 deletions(-) diff --git a/release/CMakeLists.txt b/release/CMakeLists.txt index 9ad99f381..2670545e6 100644 --- a/release/CMakeLists.txt +++ b/release/CMakeLists.txt @@ -65,7 +65,7 @@ set(CPACK_DEBIAN_PACKAGE_DEPENDS "openssl (>= 1.1.0), python3 (>= 3.5.0)") # RPM specific set(CPACK_RPM_PACKAGE_URL https://memgraph.com) set(CPACK_RPM_PACKAGE_VERSION "${MEMGRAPH_VERSION_RPM}") -set(CPACK_RPM_FILE_NAME "memgraph_${MEMGRAPH_VERSION_RPM}.x86_64.rpm") +set(CPACK_RPM_FILE_NAME "memgraph-${MEMGRAPH_VERSION_RPM}-1.x86_64.rpm") set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /var /var/lib /var/log /etc/logrotate.d /lib /lib/systemd /lib/systemd/system /lib/systemd/system/memgraph.service) diff --git a/release/examples/build_examples b/release/examples/build_examples index 2e4bedf08..1f0de780b 100755 --- a/release/examples/build_examples +++ b/release/examples/build_examples @@ -75,7 +75,7 @@ do pushd "$script_dir/$snapshots_dir/" >/dev/null # remove all unnecessary directories - for name in *; do + for name in * .[a-zA-Z0-9]*; do if [ "$name" == "snapshots" ]; then continue fi diff --git a/release/get_version.py b/release/get_version.py index ca5e069f8..db4c22507 100755 --- a/release/get_version.py +++ b/release/get_version.py @@ -75,18 +75,18 @@ import sys # # The RPM package version is determined using the following two templates: # Release version: -# -1.[.] +# _1.[.] # Development version: -# -0...[.] +# _0...[.] # Examples: # Release version: -# 0.50.1-1.community -# 0.50.1-1.enterprise -# 0.50.1-1.enterprise.veryimportantcustomer +# 0.50.1_1.community +# 0.50.1_1.enterprise +# 0.50.1_1.enterprise.veryimportantcustomer # Development version: -# 0.50.0-0.12.7e1eef94.community -# 0.50.0-0.12.7e1eef94.enterprise -# 0.50.0-0.12.7e1eef94.enterprise.veryimportantcustomer +# 0.50.0_0.12.7e1eef94.community +# 0.50.0_0.12.7e1eef94.enterprise +# 0.50.0_0.12.7e1eef94.enterprise.veryimportantcustomer # For more documentation about the RPM package naming conventions see: # https://docs.fedoraproject.org/en-US/packaging-guidelines/Versioning/ # https://fedoraproject.org/wiki/Package_Versioning_Examples @@ -112,8 +112,8 @@ def format_version(variant, version, offering, distance=None, shorthash=None, ret += "-1" return ret elif variant == "rpm": - # -1.[.] - ret = "{}-1.{}".format(version, offering) + # _1.[.] + ret = "{}_1.{}".format(version, offering) if suffix: ret += "." + suffix return ret @@ -133,8 +133,8 @@ def format_version(variant, version, offering, distance=None, shorthash=None, ret += "-1" return ret elif variant == "rpm": - # -0...[.] - ret = "{}-0.{}.{}.{}".format( + # _0...[.] + ret = "{}_0.{}.{}.{}".format( version, distance, shorthash, offering) if suffix: ret += "." + suffix diff --git a/release/rpm/community/memgraph.spec.in b/release/rpm/community/memgraph.spec.in index 32fa03aa5..e1c8859b7 100644 --- a/release/rpm/community/memgraph.spec.in +++ b/release/rpm/community/memgraph.spec.in @@ -27,6 +27,19 @@ BuildRequires: systemd @TMP_RPM_DEBUGINFO@ +# This is needed to prevent Python compilation errors when building the RPM +# package +# https://github.com/scylladb/scylla/issues/2235 +%global __os_install_post \ + /usr/lib/rpm/redhat/brp-compress \ + %{!?__debug_package:\ + /usr/lib/rpm/redhat/brp-strip %{__strip} \ + /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \ + } \ + /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \ + %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \ +%{nil} + %define _rpmdir %_topdir/RPMS %define _srcrpmdir %_topdir/SRPMS @FILE_NAME_DEFINE@ diff --git a/release/rpm/enterprise/memgraph.spec.in b/release/rpm/enterprise/memgraph.spec.in index c13c219e7..849059450 100644 --- a/release/rpm/enterprise/memgraph.spec.in +++ b/release/rpm/enterprise/memgraph.spec.in @@ -27,6 +27,19 @@ BuildRequires: systemd @TMP_RPM_DEBUGINFO@ +# This is needed to prevent Python compilation errors when building the RPM +# package +# https://github.com/scylladb/scylla/issues/2235 +%global __os_install_post \ + /usr/lib/rpm/redhat/brp-compress \ + %{!?__debug_package:\ + /usr/lib/rpm/redhat/brp-strip %{__strip} \ + /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \ + } \ + /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \ + %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \ +%{nil} + %define _rpmdir %_topdir/RPMS %define _srcrpmdir %_topdir/SRPMS @FILE_NAME_DEFINE@