rabbitmq-server/rabbitmq-server.spec
Marcus Rueckert 5843c59cf0 Accepting request 455065 from devel:languages:erlang
- IMPORTANT CHANGE
  Require the epmd service instead of running our own version as
  rabbitmq user.
  This requires that you configure epmd to listen on more
  interfaces than just 127.0.0.1.
  For non systemd based distributions you can set EPMD_ADDRESSES in
  /etc/sysconfing/erlang.
  For systemd based distributions please follow
  /usr/share/doc/packages/erlang/README.SUSE
  IMPORTANT CHANGE
  This change is also documented in
  /usr/share/doc/packages/rabbitmq-server/README.SUSE

OBS-URL: https://build.opensuse.org/request/show/455065
OBS-URL: https://build.opensuse.org/package/show/network:messaging:amqp/rabbitmq-server?expand=0&rev=71
2017-02-06 16:06:05 +00:00

252 lines
8.1 KiB
RPMSpec

#
# spec file for package rabbitmq-server
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%define _rabbit_erllibdir %{_libdir}/rabbitmq/lib/rabbitmq_server-%{version}
%define _rabbit_libdir %{_libdir}/rabbitmq
%if %{undefined _initddir}
%define _initddir %{_sysconfdir}/init.d
%endif
Name: rabbitmq-server
Version: 3.5.8
Release: 0
Summary: The RabbitMQ Server
License: MPL-1.1
Group: System/Daemons
Url: http://www.rabbitmq.com/
Source: https://github.com/rabbitmq/rabbitmq-server/releases/download/rabbitmq_v3_5_8/rabbitmq-server-3.5.8.tar.gz
Source1: rabbitmq-server.init
# This comes from: http://hg.rabbitmq.com/rabbitmq-server/raw-file/2da625c0a436/packaging/common/rabbitmq-script-wrapper
Source2: rabbitmq-script-wrapper
Source3: rabbitmq-server.logrotate
Source4: rabbitmq-server.ocf
Source5: rabbitmq-server.sysconfig
Source6: rabbitmq-server.service
Source7: rabbitmq-server.tmpfiles.d.conf
Source8: README.SUSE
Patch0: no-nmap.patch
Patch1: no-remove-common.patch
BuildRequires: erlang
BuildRequires: erlang-src
BuildRequires: fdupes
BuildRequires: libxslt
# require python json module
BuildRequires: python >= 2.6
BuildRequires: python-xml
BuildRequires: unzip
BuildRequires: xmlto
BuildRequires: zip
Requires: erlang
Requires: erlang-epmd
Requires: logrotate
Provides: AMQP-server
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Requires(pre): pwdutils
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
%if 0%{?suse_version} > 1140
BuildRequires: systemd
%{?systemd_requires}
%define have_systemd 1
Requires: erlang-sd_notify
%else
Requires: %fillup_prereq
Requires: %insserv_prereq
%endif
# Do not use noarch since the Erlang packaging does not really allow that
#BuildArch: noarch
%description
RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
%package plugins
Summary: Plugins for the RabbitMQ server
Group: System/Daemons
Requires: rabbitmq-server = %{version}
%description plugins
RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
This package includes some plugins for the RabbitMQ server
%package -n erlang-rabbitmq-client
Summary: RabbitMQ AMQP language bindings for Erlang
Group: Development/Libraries/Other
Requires: erlang
Provides: erlang-gen_server2 = %{version}
%description -n erlang-rabbitmq-client
RabbitMQ is an implementation of AMQP, the emerging standard for high
performance enterprise messaging. The RabbitMQ server is a robust and
scalable implementation of an AMQP broker.
This package includes the RabbitMQ AMQP language bindings for Erlang.
%prep
%setup -q
%patch0
%patch1
%define _rabbit_server_ocf `basename %{SOURCE4}`
cp %{SOURCE4} %{_rabbit_server_ocf}
cp %{SOURCE8} .
#patch10 -p1
%build
make all VERSION=%{version}
# %{?_smp_mflags}
%install
make install \
TARGET_DIR=%{buildroot}%{_rabbit_erllibdir} \
SBIN_DIR=%{buildroot}%{_rabbit_libdir}/bin \
MAN_DIR=%{buildroot}%{_mandir} \
DOC_INSTALL_DIR=%{buildroot}/%{_docdir} \
VERSION=%{version}
mkdir -p %{buildroot}%{_sbindir}
%if 0%{?have_systemd}
install -p -D -m 644 %{SOURCE6} %{buildroot}%{_unitdir}/%{name}.service
ln -s -f %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%else
# Install init scripts
install -p -D -m 0755 %{SOURCE1} %{buildroot}%{_initddir}/rabbitmq-server
ln -sf %{_initddir}/rabbitmq-server %{buildroot}%{_sbindir}/rcrabbitmq-server
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates/
install -p -D -m 644 %{SOURCE5} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.rabbitmq-server
%endif
# Install wrapper scripts
%define _rabbit_wrapper %{_builddir}/`basename %{SOURCE2}`
cp %{SOURCE2} %{_rabbit_wrapper}
sed -i 's|@SU_RABBITMQ_SH_C@|su rabbitmq -s /bin/sh -c|' %{_rabbit_wrapper}
sed -i 's|/usr/lib/|%{_libdir}/|' %{_rabbit_wrapper}
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmqctl
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-server
install -p -D -m 0755 %{_rabbit_wrapper} %{buildroot}%{_sbindir}/rabbitmq-plugins
install -p -D -m 0755 %{_rabbit_server_ocf} %{buildroot}%{_exec_prefix}/lib/ocf/resource.d/rabbitmq/rabbitmq-server
# install config files
install -p -D -m 0644 docs/rabbitmq.config.example %{buildroot}/%{_sysconfdir}/rabbitmq/rabbitmq.config
# Copy all necessary lib files etc.
install -p -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/logrotate.d/rabbitmq-server
# Install Erlang client
mkdir -p %{buildroot}%{_libdir}/erlang/lib
for i in amqp_client rabbit_common ; do
unzip %{buildroot}%{_rabbit_erllibdir}/plugins/$i*.ez -d %{buildroot}%{_libdir}/erlang/lib
done
# Create other necessary directories for RabbitMQ server
mkdir -p %{buildroot}%{_sysconfdir}/rabbitmq
mkdir -p %{buildroot}%{_localstatedir}/lib/rabbitmq/mnesia
mkdir -p %{buildroot}%{_localstatedir}/log/rabbitmq
# tmpfiles.d for systemd
%if 0%{?have_systemd}
mkdir -p %{buildroot}%/usr/lib/tmpfiles.d
install -p -D -m 0644 %{SOURCE7} %{buildroot}/usr/lib/tmpfiles.d/rabbitmq-server.conf
%endif
# Build the list of files
rm -f %{_builddir}/filelist.%{name}.rpm
echo '%defattr(-,root,root, -)' >> %{_builddir}/filelist.%{name}.rpm
(cd %{buildroot}; \
find . -type f ! -regex '\.%{_sysconfdir}.*' \
! -regex '\.\(%{_rabbit_erllibdir}\|%{_rabbit_libdir}\).*' \
| sed -e 's/^\.//' >> %{_builddir}/filelist.%{name}.rpm)
# Create hardlinks for duplicate files
%fdupes %{buildroot}/usr/share
%pre
getent group rabbitmq >/dev/null || groupadd -r rabbitmq
getent passwd rabbitmq >/dev/null || useradd -r -g rabbitmq \
-d %{_localstatedir}/lib/rabbitmq \
-s /sbin/nologin \
-c "user for RabbitMQ messaging server" rabbitmq
%if 0%{?have_systemd}
%service_add_pre %{name}.service
%endif
%post
%if 0%{?have_systemd}
%service_add_post %{name}.service
systemd-tmpfiles --create --clean /usr/lib/tmpfiles.d/rabbitmq-server.conf
%else
%fillup_and_insserv rabbitmq-server
%endif
%preun
%if 0%{?have_systemd}
%service_del_preun %{name}.service
%else
%stop_on_removal rabbitmq-server
%endif
%postun
%if 0%{?have_systemd}
%service_del_postun %{name}.service
%else
%restart_on_update rabbitmq-server
%insserv_cleanup
%endif
%files -f ../filelist.%{name}.rpm
%defattr(-,root,root,-)
%attr(0750, rabbitmq, rabbitmq) %dir %{_localstatedir}/lib/rabbitmq
%attr(0750, rabbitmq, rabbitmq) %dir %{_localstatedir}/log/rabbitmq
%dir %{_sysconfdir}/rabbitmq
%dir %{_rabbit_libdir}
%{_rabbit_libdir}/bin
%dir %{_rabbit_libdir}/lib
%{_rabbit_erllibdir}
%if 0%{?have_systemd}
%{_unitdir}/%{name}.service
/usr/lib/tmpfiles.d/rabbitmq-server.conf
%else
%{_initddir}/rabbitmq-server
%endif
%{_sbindir}/rcrabbitmq-server
%dir /usr/lib/ocf
%dir /usr/lib/ocf/resource.d
%dir /usr/lib/ocf/resource.d/rabbitmq
%config(noreplace) %{_sysconfdir}/logrotate.d/rabbitmq-server
%config(noreplace) %{_sysconfdir}/rabbitmq/rabbitmq.config
%doc LICENSE* README README.SUSE
%dir %{_rabbit_erllibdir}/plugins
%exclude %{_rabbit_erllibdir}/plugins/*
%exclude %{_libdir}/erlang/lib/amqp_client*/*
%exclude %{_libdir}/erlang/lib/rabbit_common*/*
%files plugins
%defattr(-,root,root)
%{_rabbit_erllibdir}/plugins/
%files -n erlang-rabbitmq-client
%defattr(-,root,root)
%{_libdir}/erlang/lib/amqp_client*/
%{_libdir}/erlang/lib/rabbit_common*/
%changelog