File rubygem-puppet.spec of Package rubygem-puppet
#
# spec file for package rubygem-puppet
#
# 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-puppet
Version: 3.8.7
Release: 0
%define mod_name puppet
%define mod_full_name %{mod_name}-%{version}
# MANUAL
# backward compatible requirement SLE...
%{?!_initddir:%define _initddir %_initrddir}
%define _fwdefdir /etc/sysconfig/SuSEfirewall2.d/services
%define _unitdir /usr/lib/systemd
%{!?vim_data_dir:%global vim_data_dir %{_datadir}/vim/%(readlink %{_datadir}/vim/current)}
# not really required, but we don't want to own their dirs
BuildRequires: vim
BuildRequires: emacs-nox
BuildRequires: fdupes
Requires(pre): /usr/sbin/groupadd
Requires(pre): /usr/sbin/useradd
Requires(pre): %fillup_prereq
Requires: tar
%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: %{rubygem rdoc > 3.10}
BuildRequires: update-alternatives
Url: https://github.com/puppetlabs/puppet
Source: http://rubygems.org/gems/%{mod_full_name}.gem
Source1: puppetmaster.fw
Source2: puppet.fw
Source3: puppetmaster-unicorn.service
Source4: unicorn.conf
Source5: %{name}-rpmlintrc
Source6: gem2rpm.yml
# MANUAL
Patch0: %{mod_name}-zypper-lu.patch
Patch1: %{mod_name}-systemd-default.patch
Patch2: %{mod_name}-ruby-2_2.patch
Patch3: %{mod_name}-systemd-default-on-new-suse.patch
Patch4: %{mod_name}-non_ASCII_user_comment.patch
# /MANUAL
Summary: A network tool for managing many disparate systems
License: Apache-2.0
Group: Development/Languages/Ruby
PreReq: update-alternatives
%description
Puppet lets you centrally manage every important aspect of your system
using a cross-platform specification language that manages all the
separate elements normally aggregated in different files, like users,
cron jobs, and hosts, along with obviously discrete elements like
packages, services, and files.
%prep
%gem_unpack
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
find -type f -print0 | xargs -0 touch -r %{S:0}
%gem_build
%build
%install
%gem_install \
--symlink-binaries \
--doc-files="LICENSE README.md" \
-f
# MANUAL
gemdir="%{buildroot}$(gem env gemdir)/gems/%{mod_full_name}"
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_localstatedir}/lib/%{mod_name}
mkdir -p %{buildroot}%{_localstatedir}/log/%{mod_name}
mkdir -p %{buildroot}%{_fwdefdir}
mkdir -p %{buildroot}%{_unitdir}/system
install -Dm0644 $gemdir/ext/redhat/%{mod_name}.conf %{buildroot}%{_sysconfdir}/%{mod_name}/%{mod_name}.conf
for config_file in auth fileserver tagmail ; do
install -m0644 $gemdir/conf/$config_file.conf %{buildroot}%{_sysconfdir}/%{mod_name}/$config_file.conf
done
install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/%{mod_name}/unicorn.conf
mkdir -p %{buildroot}%{_localstatedir}/adm/fillup-templates
cp $gemdir/ext/redhat/client.sysconfig %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.puppet
cp $gemdir/ext/redhat/server.sysconfig %{buildroot}/%{_localstatedir}/adm/fillup-templates/sysconfig.puppetmaster
%if 0%{?has_systemd}
ln -sf service %{buildroot}/%{_sbindir}/rcpuppet
ln -sf service %{buildroot}/%{_sbindir}/rcpuppetmaster
ln -sf service %{buildroot}/%{_sbindir}/rcpuppetmaster-unicorn
install -m 644 $gemdir/ext/systemd/puppet.service %{buildroot}%{_unitdir}/system/puppet.service
install -m 644 $gemdir/ext/systemd/puppetmaster.service %{buildroot}%{_unitdir}/system/puppetmaster.service
install -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/system/puppetmaster-unicorn.service
%else
mkdir -p %{buildroot}%_initddir
# fix old port arg
sed -i 's/--port/--masterport/' $gemdir/ext/suse/client.init
install -m0755 $gemdir/ext/suse/client.init %{buildroot}/%_initddir/puppet
install -m0755 $gemdir/ext/suse/server.init %{buildroot}/%_initddir/puppetmaster
ln -sf %_initddir/puppet %{buildroot}/%{_sbindir}/rcpuppet
ln -sf %_initddir/puppetmaster %{buildroot}/%{_sbindir}/rcpuppetmaster
%endif
install -m 644 %{SOURCE1} %{buildroot}/%{_fwdefdir}/puppetmasterd
install -m 644 %{SOURCE2} %{buildroot}/%{_fwdefdir}/puppet
for mandirX in $(ls $gemdir/man); do
for manpage in $(ls $gemdir/man/$mandirX); do
install -Dm0444 $gemdir/man/$mandirX/$manpage %{buildroot}/%{_mandir}/$mandirX/$manpage
done
done
%fdupes %{buildroot}%{_prefix}
# Install vim syntax files
install -Dp -m0644 $gemdir/ext/vim/ftdetect/%{mod_name}.vim %{buildroot}%{vim_data_dir}/ftdetect/%{mod_name}.vim
install -Dp -m0644 $gemdir/ext/vim/ftplugin/%{mod_name}.vim %{buildroot}%{vim_data_dir}/ftplugin/%{mod_name}.vim
install -Dp -m0644 $gemdir/ext/vim/indent/%{mod_name}.vim %{buildroot}%{vim_data_dir}/indent/%{mod_name}.vim
install -Dp -m0644 $gemdir/ext/vim/syntax/%{mod_name}.vim %{buildroot}%{vim_data_dir}/syntax/%{mod_name}.vim
# Install emacs mode files
emacsdir=%{buildroot}%{_datadir}/emacs/site-lisp
install -Dp -m0644 $gemdir/ext/emacs/puppet-mode.el $emacsdir/puppet-mode.el
install -Dp -m0644 $gemdir/ext/emacs/puppet-mode-init.el $emacsdir/site-start.d/puppet-mode-init.el
# 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,gentoo}
done
# /MANUAL
%files
%defattr(-,root,root,-)
%attr(0750,%{mod_name},%{mod_name}) %dir %{_localstatedir}/lib/%{mod_name}
%attr(0750,%{mod_name},%{mod_name}) %dir %{_localstatedir}/log/%{mod_name}
%dir %{_sysconfdir}/%{mod_name}
%config(noreplace) %{_sysconfdir}/%{mod_name}/%{mod_name}.conf
%config(noreplace) %{_fwdefdir}/%{mod_name}
%{_mandir}/man?/*
%{_sbindir}/rcpuppet
%if 0%{?has_systemd}
%{_unitdir}/system/%{mod_name}.service
%else
%_initddir/%{mod_name}
%endif
%{_localstatedir}/adm/fillup-templates/sysconfig.puppet
%pre
getent group puppet >/dev/null || /usr/sbin/groupadd -r puppet
getent passwd puppet >/dev/null || /usr/sbin/useradd -r -g puppet -d /var/lib/puppet -s /bin/false -c "Puppet daemon" puppet
%if 0%{?has_systemd}
%service_add_pre puppet.service
%endif
%preun
%if 0%{?has_systemd}
%service_del_preun puppet.service
%else
%stop_on_removal %{name}
%endif
%postun
%if 0%{?has_systemd}
%service_del_postun puppet.service
%else
%insserv_cleanup
%endif
%post
%fillup_only -n puppetmaster
%if 0%{?has_systemd}
%service_add_post puppet.service
%endif
%package master
Summary: A network tool for managing many disparate systems
Group: Productivity/Networking/System
PreReq: rubygem(%{mod_name})
Obsoletes: puppet-server <= 3.7.3
Provides: puppet-master = %{version}-%{release}
Provides: puppetmaster = %{version}-%{release}
%if 0%{?has_systemd}
%{?systemd_requires}
%endif
# Requires: rubygem-puppet = 3.8.7
%description master
Puppet lets you centrally manage every important aspect of your system
using a cross-platform specification language that manages all the
separate elements normally aggregated in different files, like users,
cron jobs, and hosts, along with obviously discrete elements like
packages, services, and files.
%files master
%defattr(-,root,root,-)
%{_sbindir}/rcpuppetmaster
%config(noreplace) %{_fwdefdir}/puppetmasterd
%config(noreplace) %{_sysconfdir}/%{mod_name}/auth.conf
%config(noreplace) %{_sysconfdir}/%{mod_name}/fileserver.conf
%config(noreplace) %{_sysconfdir}/%{mod_name}/tagmail.conf
%if 0%{?has_systemd}
%{_unitdir}/system/puppetmaster.service
%else
%_initddir/puppetmaster
%endif
%{_localstatedir}/adm/fillup-templates/sysconfig.puppetmaster
%pretrans master
if [ -x /usr/bin/puppet ] && [ "`/usr/bin/puppet --version | grep '^3.3.1'`" ]; then
echo old > /run/puppet_migrate
fi
%pre master
getent group puppet >/dev/null || /usr/sbin/groupadd -r puppet
getent passwd puppet >/dev/null || /usr/sbin/useradd -r -g puppet -d /var/lib/puppet -s /bin/false -c "Puppet daemon" puppet
%if 0%{?has_systemd}
%service_add_pre puppetmaster.service
%endif
%preun master
%if 0%{?has_systemd}
%service_del_preun puppetmaster.service
%else
%stop_on_removal %{name}
%endif
%postun master
%if 0%{?has_systemd}
%service_del_postun puppetmaster.service
%else
%insserv_cleanup
%endif
%post master
# Compatibility with old setups
%fillup_only
%if 0%{?has_systemd}
%service_add_post puppetmaster.service
%endif
if [ -f /run/puppet_migrate ]; then
cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
Warning: If you used puppet on openSUSE/SLE before be aware, that service is now
Warning: called puppemaster instead of puppetmasterd. This was done to comply
Warning: with upstream naming of the service and hopefully with everybody else
EOF
rm -f /run/puppet_migrate
fi
%package master-unicorn
Summary: Unicorn files for puppetmaster
Group: Productivity/Networking/System
Requires: rubygem-puppet-master = %{version}
Requires: rubygem(unicorn)
BuildArch: noarch
%if 0%{?has_systemd} > 1210
%{?systemd_requires}
%endif
# Requires: rubygem-puppet = 3.8.7
%description master-unicorn
Unicorn config and systemd files for puppetmaster
%files master-unicorn
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{mod_name}/unicorn.conf
%if 0%{?has_systemd}
%{_sbindir}/rcpuppetmaster-unicorn
%{_unitdir}/system/puppetmaster-unicorn.service
%endif
%pre master-unicorn
%if 0%{?has_systemd}
%service_add_pre puppetmaster-unicorn.service
%endif
%preun master-unicorn
%if 0%{?has_systemd}
%service_del_preun puppetmaster-unicorn.service
%endif
%postun master-unicorn
%if 0%{?has_systemd}
%service_del_postun puppetmaster-unicorn.service
%endif
%post master-unicorn
%if 0%{?has_systemd}
%service_add_post puppetmaster-unicorn.service
%endif
%package vim
Summary: Vim syntax files for Puppet manifests
Group: Productivity/Text/Editors
Requires: vim
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
Supplements: packageand(vim:%{name})
Provides: puppet-vim = %{version}-%{release}
Obsoletes: puppet-vim < %{version}-%{release}
# Requires: rubygem-puppet = 3.8.7
%description vim
Vim ftdetect and syntax files for Puppet manifests
%files vim
%defattr(-,root,root,-)
%dir %{vim_data_dir}/ftdetect
%{vim_data_dir}/ftdetect/%{mod_name}.vim
%{vim_data_dir}/ftplugin/%{mod_name}.vim
%{vim_data_dir}/indent/%{mod_name}.vim
%{vim_data_dir}/syntax/%{mod_name}.vim
%package emacs
Summary: Emacs syntax files for Puppet
Group: Productivity/Text/Editors
Requires: emacs
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
Supplements: packageand(emacs:%{name})
Provides: puppet-emacs = %{version}-%{release}
# Requires: rubygem-puppet = 3.8.7
%description emacs
Emacs syntax files for Puppet manifests
%files emacs
%defattr(-,root,root,-)
# emacs-mode files
%if 0%{?suse_version} <= 1230
%dir %{_datadir}/emacs/site-lisp/site-start.d
%endif
%{_datadir}/emacs/site-lisp/puppet-mode.el
%{_datadir}/emacs/site-lisp/site-start.d/puppet-mode-init.el
%gem_packages
%changelog