Skip to content

Commit

Permalink
Update all smart proxy plugins to SCL specs
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Jan 6, 2020
1 parent bf14b8a commit f825335
Show file tree
Hide file tree
Showing 25 changed files with 1,230 additions and 667 deletions.
1 change: 1 addition & 0 deletions gem2rpm/smart_proxy_plugin.spec.erb
Expand Up @@ -9,6 +9,7 @@ has_cronjob = spec.files.any? { |f| f =~ %r{\Aextra/.*\.cron\z }
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

%{!?_root_bindir:%global _root_bindir %{_bindir}}
%{!?_root_datadir:%global _root_datadir %{_datadir}}
%{!?_root_localstatedir:%global _root_localstatedir %{_localstatedir}}
%{!?_root_sysconfdir:%global _root_sysconfdir %{_sysconfdir}}
Expand Down
7 changes: 4 additions & 3 deletions licenses.json
@@ -1,5 +1,6 @@
{
"GPL-2.0-or-later": "GPLv2+",
"GPL-3.0": "GPLv3",
"GPL-3.0+": "GPLv3+"
"GPL-2.0-or-later": "GPLv2+",
"GPL-3.0": "GPLv3",
"GPL-3.0+": "GPLv3+",
"GPLv3-or-later": "GPLv3+"
}
@@ -1,44 +1,51 @@
# Generated from smart-proxy-probing-0.0.2.gem by gem2rpm -*- rpm-spec -*-
# template: smart_proxy_plugin
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

%{!?_root_datadir:%global _root_datadir %{_datadir}}
%{!?_root_localstatedir:%global _root_localstatedir %{_localstatedir}}
%{!?_root_sysconfdir:%global _root_sysconfdir %{_sysconfdir}}

%global gem_name smart-proxy-probing
%global plugin_name smart-proxy-probing

%global foreman_proxy_min_version 1.17
%global foreman_proxy_dir %{_datarootdir}/foreman-proxy
%global foreman_proxy_min_version 1.25
%global foreman_proxy_dir %{_root_datadir}/foreman-proxy
%global foreman_proxy_statedir %{_root_localstatedir}/foreman-proxy
%global foreman_proxy_bundlerd_dir %{foreman_proxy_dir}/bundler.d
%global foreman_proxy_settingsd_dir %{_sysconfdir}/foreman-proxy/settings.d
%global smart_proxy_dynflow_bundlerd_dir %{?rhel:/opt/theforeman/tfm/root/}%{_datadir}/smart_proxy_dynflow_core/bundler.d
%global foreman_proxy_settingsd_dir %{_root_sysconfdir}/foreman-proxy/settings.d
%global smart_proxy_dynflow_bundlerd_dir %{!?scl:/opt/theforeman/tfm/root}%{_datadir}/smart_proxy_dynflow_core/bundler.d

Name: rubygem-%{gem_name}
Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 0.0.2
Release: 2%{?foremandist}%{?dist}
Release: 3%{?foremandist}%{?dist}
Summary: Gem to allow probing through smart-proxy
Group: Applications/Internet
License: GPLv3
URL: https://github.com/adamruzicka/smart-proxy-probing
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem

# start generated dependencies
Requires: foreman-proxy >= %{foreman_proxy_min_version}
Requires: ruby(release)
Requires: ruby
Requires: ruby(rubygems)
Requires: rubygem(smart_proxy_dynflow) < 0.3.0
Requires: rubygem(smart_proxy_dynflow) >= 0.1.0
BuildRequires: ruby(release)
BuildRequires: ruby
BuildRequires: rubygems-devel
BuildArch: noarch
Provides: rubygem(%{gem_name}) = %{version}
Provides: foreman-proxy-plugin-%{plugin_name}
# end generated dependencies

%if 0%{?rhel} == 7
Requires: tfm-rubygem(foreman_probing_core)
%else
Requires: rubygem(foreman_probing_core)
%endif

# start specfile generated dependencies
Requires: foreman-proxy >= %{foreman_proxy_min_version}
Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby
Requires: %{?scl_prefix_ruby}ruby(rubygems)
Requires: %{?scl_prefix}rubygem(smart_proxy_dynflow) < 0.3.0
Requires: %{?scl_prefix}rubygem(smart_proxy_dynflow) >= 0.1.0
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildArch: noarch
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
Provides: foreman-proxy-plugin-%{plugin_name} = %{version}
# end specfile generated dependencies

%description
Gem to allow probing through smart-proxy.

Expand All @@ -53,19 +60,27 @@ BuildArch: noarch
Documentation for %{name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
gem unpack %{SOURCE0}
%{?scl:EOF}
%setup -q -D -T -n %{gem_name}-%{version}
%{?scl:scl enable %{scl} - << \EOF}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}
%build
# Create the gem as gem install only works on a gem file
%{?scl:scl enable %{scl} - << \EOF}
gem build %{gem_name}.gemspec
%{?scl:EOF}
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%{?scl:scl enable %{scl} - << \EOF}
%gem_install
%{?scl:EOF}
%install
mkdir -p %{buildroot}%{gem_dir}
Expand All @@ -78,16 +93,16 @@ cat <<EOF > %{buildroot}%{foreman_proxy_bundlerd_dir}/%{plugin_name}.rb
gem 'smart-proxy-probing'
EOF
mkdir -p %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}
cat <<EOF > %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}/foreman_probing_core.rb
gem 'foreman_probing_core'
EOF

# sample config
mkdir -p %{buildroot}%{foreman_proxy_settingsd_dir}
mv %{buildroot}%{gem_instdir}/settings.d/probing.yml.example \
%{buildroot}%{foreman_proxy_settingsd_dir}/probing.yml
mkdir -p %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}
cat <<EOF > %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}/foreman_probing_core.rb
gem 'foreman_probing_core'
EOF
%files
%dir %{gem_instdir}
%config(noreplace) %attr(0640, root, foreman-proxy) %{foreman_proxy_settingsd_dir}/probing.yml
Expand All @@ -96,18 +111,20 @@ mv %{buildroot}%{gem_instdir}/settings.d/probing.yml.example \
%{gem_libdir}
%{gem_instdir}/settings.d
%{foreman_proxy_bundlerd_dir}/%{plugin_name}.rb
%{smart_proxy_dynflow_bundlerd_dir}/foreman_probing_core.rb
%exclude %{gem_cache}
%{gem_spec}
%{smart_proxy_dynflow_bundlerd_dir}/foreman_probing_core.rb
%files doc
%doc %{gem_docdir}
%changelog
* Mon Dec 16 2019 Eric D. Helms <ericdhelms@gmail.com> - 0.0.2-3
- Update to SCL based template
* Thu May 16 2019 Eric D. Helms <ericdhelms@gmail.com> - 0.0.2-2
- Require SCL prefix only on EL7
* Thu Jul 19 2018 Dirk Goetz <dirk.goetz@netways.de> 0.0.2-1
- Add rubygem-smart-proxy-probing generated by gem2rpm using the smart_proxy_plugin template

@@ -1,66 +1,95 @@
# template: smart_proxy_plugin
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

%global gem_name smart_proxy_ansible
%global plugin_name ansible

%{!?_root_datadir:%global _root_datadir %{_datadir}}
%{!?_root_localstatedir:%global _root_localstatedir %{_localstatedir}}
%{!?_root_sysconfdir:%global _root_sysconfdir %{_sysconfdir}}

%global foreman_proxy_dir /usr/share/foreman-proxy
%global foreman_proxy_statedir %{_localstatedir}/lib/foreman-proxy
%global foreman_proxy_min_version 1.25
%global foreman_proxy_dir %{_root_datadir}/foreman-proxy
%global foreman_proxy_statedir %{_root_localstatedir}/foreman-proxy
%global foreman_proxy_bundlerd_dir %{foreman_proxy_dir}/bundler.d
%global foreman_proxy_settingsd_dir %{_sysconfdir}/foreman-proxy/settings.d
%global smart_proxy_dynflow_bundlerd_dir %{?rhel:/opt/theforeman/tfm/root/}%{_datadir}/smart_proxy_dynflow_core/bundler.d
%global foreman_proxy_settingsd_dir %{_root_sysconfdir}/foreman-proxy/settings.d
%global smart_proxy_dynflow_bundlerd_dir %{!?scl:/opt/theforeman/tfm/root}%{_datadir}/smart_proxy_dynflow_core/bundler.d

Summary: Ansible support for Foreman smart proxy
Name: rubygem-%{gem_name}
Name: %{?scl_prefix}rubygem-%{gem_name}
Version: 3.0.1
Release: 1%{?foremandist}%{?dist}
Group: Applications/System
Release: 2%{?foremandist}%{?dist}
Summary: Smart-Proxy Ansible plugin
Group: Applications/Internet
License: GPLv3
URL: https://github.com/theforeman/smart_proxy_ansible
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem

Requires: ansible >= 2.2
%if 0%{?rhel} == 7
Requires: tfm-rubygem(smart_proxy_dynflow_core) >= 0.1.5
Requires: tfm-rubygem(foreman_ansible_core)
Requires: python-requests
%else
Requires: rubygem(smart_proxy_dynflow_core) >= 0.1.5
Requires: rubygem(foreman_ansible_core)
Requires: python3-requests
%endif
Requires: foreman-proxy >= 1.11.0
Requires: rubygem(smart_proxy_dynflow) >= 0.1
Requires: rubygem(smart_proxy_dynflow) < 1.0

Requires: ruby
Requires: ruby(rubygems)

Requires: ansible >= 2.2
%if 0%{?rhel} == 7
Requires: python-requests
Requires: tfm-rubygem(smart_proxy_dynflow_core) >= 0.1.5
Requires: tfm-rubygem(foreman_ansible_core)
%else
Requires: python3-requests
Requires: rubygem(smart_proxy_dynflow_core) >= 0.1.5
Requires: rubygem(foreman_ansible_core)
%endif

Requires: ruby(release)
BuildRequires: ruby(release)
BuildRequires: rubygems-devel
# start specfile generated dependencies
Requires: foreman-proxy >= %{foreman_proxy_min_version}
Requires: %{?scl_prefix_ruby}ruby(release)
Requires: %{?scl_prefix_ruby}ruby
Requires: %{?scl_prefix_ruby}ruby(rubygems)
Requires: %{?scl_prefix}rubygem(smart_proxy_dynflow) >= 0.1
Requires: %{?scl_prefix}rubygem(smart_proxy_dynflow) < 1
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildArch: noarch

Provides: rubygem(%{gem_name}) = %{version}
Provides: foreman-proxy-plugin-ansible
Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version}
Provides: foreman-proxy-plugin-%{plugin_name} = %{version}
# end specfile generated dependencies

%description
Ansible support for Foreman smart proxy
Smart-Proxy ansible plugin.


%package doc
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Summary: Documentation for rubygem-%{gem_name}
Summary: Documentation for %{name}
Group: Documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
This package contains documentation for rubygem-%{gem_name}.
Documentation for %{name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
gem unpack %{SOURCE0}
%{?scl:EOF}
%setup -q -c -T
%gem_install -n %{SOURCE0}
%setup -q -D -T -n %{gem_name}-%{version}
%{?scl:scl enable %{scl} - << \EOF}
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%{?scl:EOF}
%build
# Create the gem as gem install only works on a gem file
%{?scl:scl enable %{scl} - << \EOF}
gem build %{gem_name}.gemspec
%{?scl:EOF}
# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir
# by default, so that we can move it into the buildroot in %%install
%{?scl:scl enable %{scl} - << \EOF}
%gem_install
%{?scl:EOF}
%pre
for i in ansible ansible_galaxy; do
Expand All @@ -70,62 +99,65 @@ for i in ansible ansible_galaxy; do
done
if [ -f %{foreman_proxy_dir}/.ansible.cfg ] && [ ! -L %{foreman_proxy_dir}/.ansible.cfg ]; then
mv %{foreman_proxy_dir}/.ansible.cfg %{_sysconfdir}/foreman-proxy/ansible.cfg
mv %{foreman_proxy_dir}/.ansible.cfg %{_root_sysconfdir}/foreman-proxy/ansible.cfg
fi
%install
mkdir -p %{buildroot}%{gem_dir}

cp -pa .%{gem_dir}/* \
cp -a .%{gem_dir}/* \
%{buildroot}%{gem_dir}/
# bundler file
mkdir -p %{buildroot}%{foreman_proxy_bundlerd_dir}
cp -pa .%{gem_instdir}/bundler.plugins.d/smart_proxy_ansible.rb %{buildroot}%{foreman_proxy_bundlerd_dir}
mv %{buildroot}%{gem_instdir}/bundler.plugins.d/%{gem_name}.rb \
%{buildroot}%{foreman_proxy_bundlerd_dir}
mkdir -p %{buildroot}%{foreman_proxy_settingsd_dir}
cp -pa .%{gem_instdir}/settings.d/ansible.yml.example %{buildroot}%{foreman_proxy_settingsd_dir}/ansible.yml
# sample config
mkdir -p %{buildroot}%{foreman_proxy_settingsd_dir}
mv %{buildroot}%{gem_instdir}/settings.d/ansible.yml.example \
%{buildroot}%{foreman_proxy_settingsd_dir}/ansible.yml
mkdir -p %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}
cat <<EOF > %{buildroot}%{smart_proxy_dynflow_bundlerd_dir}/foreman_ansible_core.rb
gem 'foreman_ansible_core'
EOF
mkdir -p %{buildroot}%{foreman_proxy_dir}

# Ensure all the ansible state is in /var/lib
for i in ansible ansible_galaxy; do
mkdir -p %{buildroot}%{foreman_proxy_statedir}/$i
ln -sv %{foreman_proxy_statedir}/$i %{buildroot}%{foreman_proxy_dir}/.$i
done
ln -sv %{_sysconfdir}/foreman-proxy/ansible.cfg %{buildroot}%{foreman_proxy_dir}/.ansible.cfg
ln -sv %{_root_sysconfdir}/foreman-proxy/ansible.cfg %{buildroot}%{foreman_proxy_dir}/.ansible.cfg
find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x
%files
%dir %{gem_instdir}
%config(noreplace) %attr(0640, root, foreman-proxy) %{foreman_proxy_settingsd_dir}/ansible.yml
%license %{gem_instdir}/LICENSE
%{gem_instdir}/bin
%{gem_instdir}/lib
%{gem_libdir}
%{gem_instdir}/settings.d
%{foreman_proxy_bundlerd_dir}/smart_proxy_ansible.rb
%config(noreplace) %{foreman_proxy_settingsd_dir}/ansible.yml
%{foreman_proxy_bundlerd_dir}/%{gem_name}.rb
%exclude %{gem_cache}
%{gem_spec}
%{foreman_proxy_dir}/.ansible
%{foreman_proxy_dir}/.ansible_galaxy
%{foreman_proxy_dir}/.ansible.cfg
%attr(-,foreman-proxy,foreman-proxy) %{foreman_proxy_statedir}/ansible
%attr(-,foreman-proxy,foreman-proxy) %{foreman_proxy_statedir}/ansible_galaxy
%ghost %attr(0640,root,foreman-proxy) %config(noreplace) %{_sysconfdir}/foreman-proxy/ansible.cfg
%license %{gem_instdir}/LICENSE
%ghost %attr(0640,root,foreman-proxy) %config(noreplace) %{_root_sysconfdir}/foreman-proxy/ansible.cfg
%{smart_proxy_dynflow_bundlerd_dir}/foreman_ansible_core.rb
%exclude %{gem_instdir}/bundler.plugins.d
%exclude %{gem_cache}
%{gem_spec}

%files doc
%doc %{gem_instdir}/README.md
%doc %{gem_docdir}
%doc %{gem_instdir}/README.md
%changelog
* Wed Sep 25 2019 Eric D. Helms <ericdhelms@gmail.com> - 3.0.1-2
- Add SCL support to spec
* Fri Jun 28 2019 Ondrej Prazak <oprazak@redhat.com> 3.0.1-1
- Update to 3.0.1
Expand Down

0 comments on commit f825335

Please sign in to comment.