Blob Blame History Raw
#%%global reltag .Beta1
%global namedversion %{version}%{?reltag}
%global _docdir_fmt %{name}

Name:          elasticsearch
Version:       1.7.5
Release:       6%{?reltag}%{?dist}
Summary:       Open source, flexible, distributed search and analytics engine
License:       ASL 2.0
URL:           http://www.elasticsearch.org/
# wget https://github.com/elasticsearch/elasticsearch/archive/v%%{version}.tar.gz -O %%{name}-%%{version}.tar.gz
# repacked by repack.sh %%{name}-%%{version}.tar.gz
Source0:       %{name}-%{namedversion}-fedora.tar.xz
Source1:       getsources.sh
Source2:       %{name}.service.in
Source3:       %{name}.in
Patch0:        %{name}-1.3.2-remove-sigar-service.patch
Patch1:        unbundleBase64.patch
Patch2:        localhostByDefault.patch
Patch3:        netty-version.patch


BuildRequires: netty3
BuildRequires: java-base64 >= 2.3.8-7
BuildRequires: mvn(org.apache.maven.plugins:maven-dependency-plugin)
BuildRequires: mvn(com.carrotsearch:hppc)
BuildRequires: mvn(com.fasterxml.jackson.core:jackson-core)
BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-cbor)
BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-smile)
BuildRequires: mvn(com.fasterxml.jackson.dataformat:jackson-dataformat-yaml)
BuildRequires: mvn(com.github.spullara.mustache.java:compiler)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(com.ning:compress-lzf)
BuildRequires: mvn(com.spatial4j:spatial4j)
BuildRequires: mvn(com.tdunning:t-digest)
BuildRequires: mvn(com.vividsolutions:jts)
BuildRequires: mvn(joda-time:joda-time)
BuildRequires: mvn(net.java.dev.jna:jna)
BuildRequires: mvn(org.antlr:antlr-runtime)
BuildRequires: mvn(org.codehaus.groovy:groovy)
BuildRequires: mvn(org.joda:joda-convert)
BuildRequires: mvn(org.mvel:mvel2)
BuildRequires: mvn(org.slf4j:slf4j-api)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
BuildRequires: mvn(log4j:log4j:1.2.17)
BuildRequires: mvn(log4j:apache-log4j-extras)
BuildRequires: lucene4

%if 0
# Test deps
BuildRequires: mvn(com.carrotsearch.randomizedtesting:junit4-maven-plugin)
BuildRequires: mvn(com.carrotsearch.randomizedtesting:junit4-ant)
BuildRequires: mvn(com.carrotsearch.randomizedtesting:randomizedtesting-runner)
BuildRequires: mvn(de.thetaphi:forbiddenapis)
BuildRequires: mvn(org.hamcrest:hamcrest-all)
BuildRequires: mvn(org.apache.httpcomponents:httpclient)
%endif

BuildRequires: maven-local
#service build
BuildRequires: systemd
# not added by autogenerated stuff
Requires: mvn(org.apache.lucene:lucene-sandbox:4)
Requires: snakeyaml
# xmvn do not set up versions
Requires: java-base64 >= 2.3.8-7
# service setup
Requires(post):   systemd
Requires(preun):  systemd
Requires(postun): systemd
# user and group creation
Requires(pre): shadow-utils

BuildArch:     noarch

%description
Elasticsearch is a search server based on Lucene. It provides a distributed,
multitenant-capable full-text search engine with a RESTful web interface and
schema-free JSON documents. Elasticsearch is developed in Java and is released
as open source under the terms of the Apache License.

It is a flexible and powerful open source, distributed, real-time
search and analytics engine.

Architected from the ground up for use in distributed environments where
reliability and scalability are must haves, Elasticsearch gives you the ability
to move easily beyond simple full-text search.

Through its robust set of APIs and query DSLs, plus clients for the most popular
programming languages, Elasticsearch delivers on the near limitless promises of
search technology.

%package javadoc
Summary:       Javadoc for %{name}

%description javadoc
This package contains javadoc for %{name}.

%prep
%autosetup -n elasticsearch-%{namedversion} -p0
# Cleanup
find . -name "*.class" -print -delete
find . -name "*.jar" -print -delete
find . -name "*.bat" -print -delete
find . -name "*.exe" -print -delete
# Unused/unavailable plugins
%pom_remove_plugin de.thetaphi:forbiddenapis
%pom_remove_plugin com.mycila:license-maven-plugin
%pom_remove_plugin org.vafer:jdeb
%pom_remove_plugin :maven-shade-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_plugin :rpm-maven-plugin
%pom_remove_plugin com.carrotsearch.randomizedtesting:junit4-maven-plugin
%pom_remove_plugin :buildnumber-maven-plugin
%pom_remove_plugin :maven-dependency-plugin
%pom_remove_plugin :maven-assembly-plugin
#%%pom_add_dep com.carrotsearch.randomizedtesting:junit4-ant::test
%pom_add_dep net.iharder:base64

# Disable test task
%pom_xpath_remove "pom:build/pom:plugins/pom:plugin[pom:artifactId = 'maven-antrun-plugin']/pom:executions/pom:execution[pom:id = 'tests']"

# package org.antlr.runtime.tree does not exist
%pom_add_dep org.antlr:antlr-runtime


%pom_remove_dep org.fusesource:sigar
rm -rfv src/main/java/org/elasticsearch/monitor/sigar \
 src/main/java/org/elasticsearch/monitor/process/SigarProcessProbe.java \
 src/main/java/org/elasticsearch/monitor/network/SigarNetworkProbe.java \
 src/main/java/org/elasticsearch/monitor/os/SigarOsProbe.java \
 src/main/java/org/elasticsearch/monitor/fs/SigarFsProbe.java

#removal of bundled class
rm -vf src/main/java/org/elasticsearch/common/Base64.java

%build
%mvn_file : %{name}
%mvn_build -f


%install
%mvn_install
# the target/bin/elasticsearch.in.sh is not packed, as it do not honor packaging guidelines
# proper mixture of it and rpm based launcher will be subject of further work
# todo, discover origin of elasticsearch launcher script, does not seems to be based on in file
# the in file seems to be only strangely included
mkdir -p $RPM_BUILD_ROOT/%{_libexecdir}/
mkdir -p $RPM_BUILD_ROOT/%{_unitdir}/
cat %{SOURCE2} | sed "s;@LAUNCHER@;%{_libexecdir}/%{name};g" | sed  "s;@USER@;%{name};g"  > $RPM_BUILD_ROOT/%{_unitdir}/%{name}.service
# because of bugs in set_flags/options and custom code, using .in file instead of %%jpackage_script
cat %{SOURCE3} | sed "s;@NAME@;%{name};g" | sed "s;@VLIB@;%{_sharedstatedir};g" >$RPM_BUILD_ROOT/%{_libexecdir}/%{name}
chmod 755 $RPM_BUILD_ROOT/%{_libexecdir}/%{name}
# setup config templates target dirs
mkdir -p $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
# setup config files in /etc/elasticsearch
install -m 644 -p config/%{name}.yml $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
install -m 644 -p config/logging.yml $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}
# link them to ES home
ln -s %{_sysconfdir}/%{name}/%{name}.yml $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/
ln -s %{_sysconfdir}/%{name}/logging.yml $RPM_BUILD_ROOT/%{_sharedstatedir}/%{name}/conf/

# Plugins management script
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}/plugins $RPM_BUILD_ROOT/%{_bindir}
sed -i "s@#path.plugins: /path/to/plugins@path.plugins: %{_datadir}/%{name}/plugins@" $RPM_BUILD_ROOT/%{_sysconfdir}/%{name}/%{name}.yml

cat << 'EOF' > $RPM_BUILD_ROOT/%{_bindir}/%{name}-plugin
export MAIN_CLASS=org.elasticsearch.plugins.PluginManager
/usr/libexec/elasticsearch "$@"
EOF

%pre
# add the elasticsearch user and group
getent group  %{name} >/dev/null || %{_sbindir}/groupadd -r %{name}
getent passwd %{name} >/dev/null || %{_sbindir}/useradd -r -g %{name} -d %{_sharedstatedir}/%{name} -s %{_sbindir}/nologin \
    -c "Elastic Search shared service user" elasticsearch
exit 0

%post
# install but don't activate
%systemd_post %{name}.service


%preun
%systemd_preun %{name}.service


%postun
%systemd_postun_with_restart %{name}.service
# %%systemd_postun %%{name}.service

%files -f .mfiles
%license LICENSE.txt NOTICE.txt
%doc README.textile CONTRIBUTING.md TESTING.asciidoc
%attr(755,-,-) %{_bindir}/%{name}-plugin
%{_libexecdir}/%{name}
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.yml
%config(noreplace) %{_sysconfdir}/%{name}/logging.yml
%{_unitdir}/%{name}.service
%attr(755, %{name}, %{name}) %{_sharedstatedir}/%{name}
%dir %{_datadir}/%{name}/plugins

%files javadoc -f .mfiles-javadoc
%license LICENSE.txt NOTICE.txt

%changelog
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.5-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.5-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Feb 23 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@bupkis> - 1.7.5-1
- Bump to latest version in 1.7.x branch

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Wed Jan 06 2016 Pavel Alexeev <Pahan@Hubbitus.info> - 1.7.1-3
- Include plugin script as elasticsearch-plugin - bz#1252823.
- Fix config no-replace - bz#1296308.

* Sat Aug 22 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.7.1-2
- Fix Requires to work with lucene4 in single rpm

* Mon Aug 10 2015 Jiri Vanek <jvanek@redhat.com> - 1.7.1-1
- now using lucene4

* Tue Aug 04 2015 Jiri Vanek <jvanek@redhat.com> - 1.7.1-0
- updated to 1.7.1

* Thu Jul 23 2015 Jiri Vanek <jvanek@redhat.com> - 1.7.0-0
- updated to securty update of 1.7.0
- https://www.elastic.co/blog/elasticsearch-1-7-0-and-1-6-1-released

* Thu Jul 23 2015 Jiri Vanek <jvanek@redhat.com> - 1.6.1-0
- updated to securty update of 1.6.1
- https://www.elastic.co/blog/elasticsearch-1-7-0-and-1-6-1-released

* Fri Jun 12 2015 Jiri Vanek <jvanek@redhat.com> - 1.6.0-0
- updated to 1.6.0

* Wed Apr 29 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.5.2-0
- update to latest upstream version (#1217024)

* Mon Apr 20 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.5.1-0
- update to latest upstream version (#1210523)

* Mon Feb 16 2015 Jiri Vanek <jvanek@redhat.com> - 1.4.4-0
- initial build