File rubygem-mcollective.spec of Package rubygem-mcollective

#
# spec file for package rubygem-mcollective
#
# Copyright (c) 2016 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/
#


#
# This file was generated with a gem2rpm.yml and not just plain gem2rpm.
# All sections marked as MANUAL, license headers, summaries and descriptions
# can be maintained in that file. Please consult this file before editing any
# of those fields
#

Name:           rubygem-mcollective
Version:        2.9.0
Release:        0
%define mod_name mcollective
%define mod_full_name %{mod_name}-%{version}
# MANUAL
%{?!_initddir:%define _initddir %_initrddir}

BuildRequires: bash-completion
BuildRequires: zsh
%if 0%{?suse_version} >= 1210
BuildRequires: systemd
%{?systemd_requires}
%define has_systemd 1
%endif
PreReq:        rubygem(%{mod_name})
#!BuildIgnore: rubygem(%{mod_name})
# /MANUAL
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  ruby-macros >= 5
BuildRequires:  %{ruby}
BuildRequires:  %{rubygem gem2rpm}
BuildRequires:  update-alternatives
Url:            https://github.com/puppetlabs/marionette-collective
Source:         %{mod_full_name}.gem
Source1:        %{mod_name}.gemspec
Source2:        gem2rpm.yml
Summary:        Marionette Collective
License:        Apache-2.0
Group:          Development/Languages/Ruby
PreReq:         update-alternatives

%description
The Marionette Collective aka. mcollective is a framework to build server
orchestration or parallel job execution systems.

%prep

%build

%install
%gem_install \
  --symlink-binaries \
  --doc-files="COPYING README.md" \
  -f
# MANUAL
gemdir="%{buildroot}$(gem env gemdir)/gems/%{mod_full_name}"
mkdir -p %{buildroot}%{_libexecdir}/%{mod_name}
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_sysconfdir}/%{mod_name}
mkdir -p %{buildroot}%{_localstatedir}/log/%{mod_name}
%if 0%{?has_systemd}
mkdir -p %{buildroot}%{_unitdir}
install -m0644 $gemdir/ext/redhat/%{mod_name}.service %{buildroot}/%{_unitdir}/%{mod_name}.service
sed -i -e 's/sbin/bin/' %{buildroot}/%{_unitdir}/%{mod_name}.service
ln -sf service %{buildroot}/%{_sbindir}/rc%{mod_name}
%else
mkdir -p %{buildroot}%{_initddir}
install -m0755 $gemdir/ext/aio/suse/%{mod_name}.init %{buildroot}/%{_initddir}/%{mod_name}
ln -sf %{_initddir}/%{mod_name} %{buildroot}/%{_sbindir}/rc%{mod_name}
%endif
install -m0644 $gemdir/etc/server.cfg.dist %{buildroot}/%{_sysconfdir}/%{mod_name}/server.cfg
install -m0644 $gemdir/etc/client.cfg.dist %{buildroot}/%{_sysconfdir}/%{mod_name}/client.cfg
sed -i -e 's/libexec/lib/g' -e 's#log/%{mod_name}#log/%{mod_name}/%{mod_name}#g' \
    %{buildroot}/%{_sysconfdir}/%{mod_name}/*.cfg
install -m0644 $gemdir/etc/*.erb %{buildroot}/%{_sysconfdir}/%{mod_name}
install -Dm0644 $gemdir/ext/bash/mco_completion.sh %{buildroot}/%{_datadir}/bash-completion/completions/mco_completion.sh
install -Dm0644 $gemdir/ext/zsh/_mco %{buildroot}/%{_datadir}/zsh/site-functions/_mco

# Remove those dirs as they cause strange runtime dependencies
for gem in $(/usr/bin/ruby-find-versioned gem) ; do
    gemdir="%{buildroot}$($gem env gemdir)/gems/%{mod_full_name}"
    rm -rf $gemdir/ext/{debian,solaris} $gemdir/website
done
# /MANUAL


%files
%defattr(-,root,root,-)
%dir %{_sysconfdir}/%{mod_name}
%dir %{_libexecdir}/%{mod_name}
%dir %{_localstatedir}/log/%{mod_name}

%package client
Summary:   MCollective client
Group:     Productivity/Networking/System
PreReq:    rubygem(%{mod_name}) = %{version}-%{release}
BuildArch: noarch

# Requires:      rubygem-mcollective = 2.9.0
%description client

The Marionette Collective aka. mcollective is a framework to build server
orchestration or parallel job execution systems.

This package holds the client sub package for mcollective
%files client
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{mod_name}/client.cfg
%{_sysconfdir}/%{mod_name}/*.erb


%package server
Summary: MCollective server
Group:   Productivity/Networking/System
PreReq:  rubygem(%{mod_name}) = %{version}-%{release}
%if 0%{?suse_version} > 1210
%{?systemd_requires}
%endif

# Requires:      rubygem-mcollective = 2.9.0
%description server

The Marionette Collective aka. mcollective is a framework to build server
orchestration or parallel job execution systems.

This package holds the server sub package for mcollective
%files server
%defattr(-,root,root,-)
%{_sbindir}/rc%{mod_name}
%config(noreplace) %{_sysconfdir}/%{mod_name}/server.cfg
%if 0%{?has_systemd}
%{_unitdir}/%{mod_name}.service
%else
%{_initddir}/%{mod_name}
%endif

%pre server
%if 0%{?has_systemd}
%service_add_pre %{mod_name}.service
%endif

%preun server
%if 0%{?has_systemd}
%service_del_preun %{mod_name}.service
%endif

%if 0%{?suse_version} == 1110
%stop_on_removal %{name}
%endif

%postun server
%if 0%{?has_systemd}
%service_del_postun %{mod_name}.service
%endif

%if 0%{?suse_version} == 1110
%insserv_cleanup
%endif

%post server
%if 0%{?has_systemd}
%service_add_post %{mod_name}.service
%endif


%package bash-completion
Summary:   Bash completion for MCollective
Group:     Productivity/Networking/System
PreReq:    rubygem(%{mod_name})
Requires:  bash-completion
BuildArch: noarch

# Requires:      rubygem-mcollective = 2.9.0
%description bash-completion
Bash command line completion support for MCollective

%files bash-completion
%defattr(-,root,root,-)
%{_datadir}/bash-completion/completions/mco_completion.sh


%package zsh-completion
Summary:   Zsh completion for MCollective
Group:     Productivity/Networking/System
PreReq:    rubygem(%{mod_name})
Requires:  zsh
BuildArch: noarch

# Requires:      rubygem-mcollective = 2.9.0
%description zsh-completion
Zsh command line completion support for MCollective

%files zsh-completion
%defattr(-,root,root,-)
%{_datadir}/zsh/site-functions/_mco


%gem_packages

%changelog
openSUSE Build Service is sponsored by