File gem2rpm.yml of Package rubygem-puppet

:license: Apache-2.0
:sources:
  - puppetmaster.fw
  - puppet.fw
: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
: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:      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
  %if 0%{?has_systemd}
  ln -sf service %{buildroot}/%{_sbindir}/rcpuppet
  ln -sf service %{buildroot}/%{_sbindir}/rcpuppetmaster
  %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
  # Latest git calls the service for agent puppet again
  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

  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 -s %{buildroot}%{_mandir}

  # 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
    %endif

    %if 0%{?suse_version} == 1110
    %stop_on_removal %{name}
    %endif
  :postun: |-
    %if 0%{?has_systemd}
    %service_del_postun puppet.service
    %endif

    %if 0%{?suse_version} == 1110
    %insserv_cleanup
    %endif
  :post: |-
    # Compatibility with old setups
    if [ -f /etc/sysconfig/puppet ] && [ -z "`grep 'PUPPET_EXTRA_OPTS="' /etc/sysconfig/puppet | grep ' --server=${PUPPET_SERVER} --masterport=${PUPPET_PORT} --logdest=${PUPPET_LOG}"'`" ]; then
        echo 'PUPPET_EXTRA_OPTS=" --server=${PUPPET_SERVER} --masterport=${PUPPET_PORT} --logdest=${PUPPET_LOG} ${PUPPET_EXTRA_OPTS}"' >>  /etc/sysconfig/puppet
    fi

    %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
  %{_unitdir}/system/%{mod_name}.service
  %if 0%{?suse_version} == 1110
  %_initddir/%{mod_name}
  %dir /usr/lib/systemd
  %dir /usr/lib/systemd/system
  %endif
: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%{?suse_version} > 1210
      %{?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
        %endif

        %if 0%{?suse_version} == 1110
        %stop_on_removal %{name}
        %endif
      :postun: |-
        %if 0%{?has_systemd}
        %service_del_postun puppetmaster.service
        %endif

        %if 0%{?suse_version} == 1110
        %insserv_cleanup
        %endif
      :post: |-
        # Compatibility with old setups
        if [ -f /etc/sysconfig/puppetmasterd ] && [ -z "`grep 'PUPPETMASTER_EXTRA_OPTS="' /etc/sysconfig/puppetmasterd | grep ' --manifest=${PUPPETMASTER_MANIFEST} --masterport=${PUPPETMASTER_PORTS[0]} --logdest ${PUPPETMASTER_LOG}"'`" ]; then
            echo 'PUPPETMASTER_EXTRA_OPTS=" --manifest=${PUPPETMASTER_MANIFEST} --masterport=${PUPPETMASTER_PORTS[0]} --logdest ${PUPPETMASTER_LOG} ${PUPPETMASTER_EXTRA_OPTS}' >>  /etc/sysconfig/puppet
        fi

        %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
      %{_unitdir}/system/puppetmaster.service
      %if 0%{?suse_version} == 1110
      %_initddir/puppetmaster
      %dir /usr/lib/systemd
      %dir /usr/lib/systemd/system
      %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
      %{_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