File gem2rpm.yml of Package rubygem-puppet.6846

:license: Apache-2.0
:sources:
  - puppetmaster.fw
  - puppet.fw
  - puppetmaster-unicorn.service
  - unicorn.conf
  - '%{name}-rpmlintrc'
:summary: A network tool for managing many disparate systems
: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.
:patches:
  '%{mod_name}-zypper-lu.patch': -p1
  '%{mod_name}-systemd-default.patch': -p1
  '%{mod_name}-ruby-2_2.patch': -p1
  '%{mod_name}-systemd-default-on-new-suse.patch': -p1
  '%{mod_name}-non_ASCII_user_comment.patch': -p1
  '%{mod_name}-CVE-2017-2295.patch': -p1
:main:
  :preamble: |-
    Provides:   %{mod_name} = %{version}-%{release}
    Obsoletes:  %{mod_name} < %{version}-%{release}
    Provides:   hiera-puppet >= 1.0.0
    Obsoletes:  hiera-puppet < 1.0.0
    Requires:   %{name}
    Recommends: rubygem(%{rb_default_ruby_abi}:%{mod_name})
    Recommends: rubygem(ruby-augeas)
    Recommends: rubygem(ruby-shadow)
:preamble: |-
  # 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})
:post_install: |-
  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
:scripts:
  :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
:filelist: |-
  %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
:custom_pkgs:
  :master:
    :preamble: |-
      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
    :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.
    :scripts:
      :pretrans: |-
        if [ -x /usr/bin/puppet ] && [ "`/usr/bin/puppet --version | grep '^3.3.1'`" ]; then
            echo old > /run/puppet_migrate
        fi
      :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 puppetmaster.service
        %endif
      :preun: |-
        %if 0%{?has_systemd}
        %service_del_preun puppetmaster.service
        %else
        %stop_on_removal %{name}
        %endif
      :postun: |-
        %if 0%{?has_systemd}
        %service_del_postun puppetmaster.service
        %else
        %insserv_cleanup
        %endif
      :post: |-
        # 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
    :filelist: |-
      %{_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
  :master-unicorn:
    :preamble: |-
      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
    :description: |-
      Unicorn config and systemd files for puppetmaster
    :scripts:
      :pre: |-
        %if 0%{?has_systemd}
        %service_add_pre puppetmaster-unicorn.service
        %endif
      :preun: |-
        %if 0%{?has_systemd}
        %service_del_preun puppetmaster-unicorn.service
        %endif
      :postun: |-
        %if 0%{?has_systemd}
        %service_del_postun puppetmaster-unicorn.service
        %endif
      :post: |-
        %if 0%{?has_systemd}
        %service_add_post puppetmaster-unicorn.service
        %endif
    :filelist: |-
      %config(noreplace) %{_sysconfdir}/%{mod_name}/unicorn.conf
      %if 0%{?has_systemd}
      %{_sbindir}/rcpuppetmaster-unicorn
      %{_unitdir}/system/puppetmaster-unicorn.service
      %endif
  :vim:
    :preamble: |-
      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}
    :description: Vim ftdetect and syntax files for Puppet manifests
    :filelist: |-
      %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
  :emacs:
    :preamble: |-
      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}
    :description: Emacs syntax files for Puppet manifests
    :filelist: |-
      # 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
openSUSE Build Service is sponsored by