Create RPM releases


(Psaiz) #1

Hi Simone,

Would it be possible to have rpms with the ROR ?

Best regards,
pablo

An example of the spec file that could do the stuff is:

%define es_version 5.2.1
%define es_version_src 5.2.1
%define es_version_next 5.2.2
%define plugin_version 1.14.0
%define plugin_version_upstream 1.14.0
%define package_name elasticsearch-readonlyrest-plugin
Name:           %{package_name}-%{es_version}
Version:        %{plugin_version}
Release:        1%{?dist}
Summary:        Client for Elasticsearch

License:        ASL 2.0
URL:            https://github.com/sscarduzio
Source0:        https://github.com/sscarduzio/elasticsearch-readonlyrest-plugin/archive/v%{plugin_version_upstream}_es%{es_version_src}.tar.gz
#Patch0:         readonlyrest-5.2.1.patch
BuildRequires:  java-1.8.0-openjdk-devel
BuildRequires:  ites-gradle

Requires: elasticsearch >= %{es_version}
Requires: elasticsearch < %{es_version_next}
Requires: java-1.8.0-openjdk

%description
Elasticsearch readonly-rest plugin

%prep

%setup -qn %{package_name}-%{plugin_version_upstream}_es%{es_version}
#%patch0 -p1

%build
cp -rpL /opt/gradle /tmp
export GRADLE_USER_HOME=/tmp/gradle
export GRADLE_HOME=/tmp/gradle
export JAVA_HOME=$(/usr/bin/dirname `/usr/bin/readlink -f $(which java)`)/../..
sh gradlew assemble
rm -rf /tmp/gradle

%install
mkdir -p ${RPM_BUILD_ROOT}/usr/share/elasticsearch/plugins
unzip build/distributions/readonlyrest-%{plugin_version_upstream}_es%{es_version}.zip -d ${RPM_BUILD_ROOT}/usr/share/elasticsearch/plugins/
mv ${RPM_BUILD_ROOT}/usr/share/elasticsearch/plugins/elasticsearch ${RPM_BUILD_ROOT}/usr/share/elasticsearch/plugins/readonlyrest

%files
/usr/share/elasticsearch/plugins/readonlyrest

%changelog
* Fri Mar 10 2017 Ulrich Schwickerath <[email protected]> 1.14.0-5.2.1-1
- upgrade to latest version
* Wed Feb 22 2017 Ulrich Schwickerath <[email protected]> 1.13.3-5.2.1-1
- upgrade to 1.13.3
- rename package
* Fri Feb 17 2017 Ulrich Schwickerath <[email protected]> 1.13.2-5.2.1-1
- initial build