Blob Blame History Raw
%global scl_name_base    nginx
%global scl_name_version 16
%global scl              %{scl_name_base}%{scl_name_version}
%scl_package %scl

# do not produce empty debuginfo package
%global debug_package %{nil}

Summary:       Package that installs %scl
Name:          %scl_name
Version:       1.2
Release:       2%{?dist}
License:       GPLv2+
Group: Applications/File
Source0: README
Source1: LICENSE

BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: scl-utils-build
# Temporary work-around
BuildRequires: iso-codes
BuildRequires: help2man

Requires: %{scl_prefix}nginx

%description
This is the main package for %scl Software Collection.

%package runtime
Summary:   Package that handles %scl Software Collection.
Requires:  scl-utils
Requires(post): policycoreutils-python libselinux-utils

%description runtime
Package shipping essential scripts to work with %scl Software Collection.

%package build
Summary:   Package shipping basic build configuration
Requires:  scl-utils-build

%description build
Package shipping essential configuration macros to build %scl Software Collection.

%package scldevel
Summary:   Package shipping development files for %scl
Group:     Development/Languages

%description scldevel
Package shipping development files, especially usefull for development of
packages depending on %scl Software Collection.

%prep
%setup -c -T
# This section generates README file from a template and creates man page
# from that file, expanding RPM macros in the template file.
cat >README <<'EOF'
%{expand:%(cat %{SOURCE0})}
EOF

# copy the license file so %%files section sees it
cp %{SOURCE1} .

# Not required for now
#export LIBRARY_PATH=%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}
#export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}

cat <<EOF | tee enable
export PATH=%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}
export MANPATH=%{_mandir}:\${MANPATH}
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}
EOF

# generate rpm macros file for depended collections
cat << EOF | tee scldev
%%scl_%{scl_name_base}         %{scl}
%%scl_prefix_%{scl_name_base}  %{scl_prefix}
EOF

%build
# generate a helper script that will be used by help2man
cat >h2m_helper <<'EOF'
#!/bin/bash
[ "$1" == "--version" ] && echo "%{scl_name} %{version} Software Collection" || cat README
EOF
chmod a+x h2m_helper

# generate the man page
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7

%install
mkdir -p %{buildroot}%{_scl_scripts}/root
install -m 644 enable  %{buildroot}%{_scl_scripts}/enable
install -D -m 644 scldev %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel

mkdir -p %{buildroot}%{_localstatedir}/run/

# install generated man page
mkdir -p %{buildroot}%{_mandir}/man7/
install -m 644 %{scl_name}.7 %{buildroot}%{_mandir}/man7/%{scl_name}.7

%scl_install

%post runtime
# Simple copy of context from system root to DSC root.
# In case new version needs some additional rules or context definition,
# it needs to be solved.
# Unfortunately, semanage does not have -e option in RHEL-5, so we have to
# have its own policy for collection
semanage fcontext -a -e / %{_scl_root} >/dev/null 2>&1 || :
restorecon -R %{_scl_root} >/dev/null 2>&1 || :
selinuxenabled && load_policy || :

%files

%files runtime
%defattr(-,root,root)
%doc README LICENSE
%scl_files
%dir %{_mandir}/man7
%dir %{_mandir}/man8
%{_mandir}/man7/%{scl_name}.*

%dir %{_localstatedir}/run

%files build
%defattr(-,root,root)
%{_root_sysconfdir}/rpm/macros.%{scl}-config

%files scldevel
%defattr(-,root,root)
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel

%changelog
* Tue Jan 06 2015 Jan Kaluza <jkaluza@redhat.com> - 1.2-2
- fix incorrectly defined rhel macro in README (#1152494)
- own the man7 and ma8 directories to remove them weh uninstalling (#1040470)

* Tue Jun 24 2014 Jan Kaluza <jkaluza@redhat.com> - 1.2-1
- rename to nginx16

* Mon Mar 31 2014 Honza Horak <hhorak@redhat.com> - 1.1-3
- Fix path typo in README
  Related: #1061451

* Tue Feb 25 2014 Jan Kaluza <jkaluza@redhat.com> - 1.1-2
- add scldevel subpackage (#1067444)

* Thu Feb 13 2014 Jan Kaluza <jkaluza@redhat.com> - 1.1-1
- add README and LICENSE (#1061451)

* Fri Jan 17 2014 Jan Kaluza <jkaluza@redhat.com> - 1.4
- rebuild because of missing uucp user (#1054725)

* Wed Jan 15 2014 Jan Kaluza <jkaluza@redhat.com> - 1.3
- execute load_policy to load newly created SELinux policy (#1052935)

* Mon Nov 18 2013 Jan Kaluza <jkaluza@redhat.com> - 1.2
- create /var/run directory

* Mon Nov 18 2013 Jan Kaluza <jkaluza@redhat.com> - 1.1
- initial packaging