Blame SPECS/rh-varnish4.spec

50d985
%global scl_name_prefix  rh-
50d985
%global scl_name_base    varnish
50d985
%global scl_name_version 4
50d985
%global scl              %{scl_name_prefix}%{scl_name_base}%{scl_name_version}
50d985
%{!?nfsmountable: %global nfsmountable 1}
50d985
%scl_package %scl
50d985
50d985
# do not produce empty debuginfo package
50d985
%global debug_package %{nil}
50d985
50d985
Summary:       Package that installs %scl
50d985
Name:          %scl_name
50d985
Version:       2.1
50d985
Release:       6%{?dist}
50d985
License:       GPLv2+
50d985
Group: Applications/File
50d985
Source0: README
50d985
Source1: LICENSE
50d985
Source2: README.7
50d985
50d985
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
50d985
BuildRequires: scl-utils-build
50d985
# Temporary work-around
50d985
BuildRequires: iso-codes
50d985
BuildRequires: help2man
50d985
50d985
Requires: %{scl_prefix}varnish
50d985
50d985
%description
50d985
This is the main package for %scl Software Collection.
50d985
50d985
%package runtime
50d985
Summary:   Package that handles %scl Software Collection.
50d985
Requires:  scl-utils
50d985
Requires(post): policycoreutils-python
50d985
50d985
%description runtime
50d985
Package shipping essential scripts to work with %scl Software Collection.
50d985
50d985
%package build
50d985
Summary:   Package shipping basic build configuration
50d985
Requires:  scl-utils-build
50d985
50d985
%description build
50d985
Package shipping essential configuration macros to build %scl Software Collection.
50d985
50d985
%package scldevel
50d985
Summary:   Package shipping development files for %scl
50d985
Group:     Development/Languages
50d985
50d985
%description scldevel
50d985
Package shipping development files, especially usefull for development of
50d985
packages depending on %scl Software Collection.
50d985
50d985
%prep
50d985
%setup -c -T
50d985
50d985
# copy the license file so %%files section sees it
50d985
cp %{SOURCE0} .
50d985
cp %{SOURCE1} .
50d985
cp %{SOURCE2} .
50d985
50d985
expand_variables() {
50d985
    sed -i 's|%%{scl_name}|%{scl_name}|g' "$1"
50d985
    sed -i 's|%%{_scl_root}|%{_scl_root}|g' "$1"
50d985
    sed -i 's|%%{version}|%{version}|g' "$1"
50d985
%if 0%{?rhel} > 6
50d985
    sed -i 's|%%{start_command}|systemctl start %{scl_name}-varnish|g' "$1"
50d985
%else
50d985
    sed -i 's|%%{start_command}|service %{scl_name}-varnish start|g' "$1"
50d985
%endif
50d985
}
50d985
50d985
expand_variables README.7
50d985
expand_variables README
50d985
50d985
# Not required for now
50d985
#export LIBRARY_PATH=%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}
50d985
#export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
50d985
50d985
cat <
50d985
export PATH=%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}
50d985
export LIBRARY_PATH=%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}
50d985
export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
50d985
export MANPATH=%{_mandir}:\${MANPATH}
50d985
export CPATH=%{_includedir}\${CPATH:+:\${CPATH}}
50d985
EOF
50d985
50d985
# generate rpm macros file for depended collections
50d985
cat << EOF | tee scldev
50d985
%%scl_%{scl_name_base}         %{scl}
50d985
%%scl_prefix_%{scl_name_base}  %{scl_prefix}
50d985
EOF
50d985
50d985
%build
50d985
# generate a helper script that will be used by help2man
50d985
cat >h2m_helper <<'EOF'
50d985
#!/bin/bash
50d985
[ "$1" == "--version" ] && echo "%{scl_name} %{version} Software Collection" || cat README
50d985
EOF
50d985
chmod a+x h2m_helper
50d985
50d985
# generate the man page
50d985
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7
50d985
50d985
50d985
%install
50d985
mkdir -p %{buildroot}%{_scl_scripts}/root
50d985
install -m 644 enable  %{buildroot}%{_scl_scripts}/enable
50d985
install -D -m 644 scldev %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
50d985
50d985
# install generated man page
50d985
mkdir -p %{buildroot}%{_mandir}/man1/
50d985
mkdir -p %{buildroot}%{_mandir}/man7/
50d985
mkdir -p %{buildroot}%{_mandir}/man8/
50d985
mkdir -p %{buildroot}%{_libdir}/pkgconfig/
50d985
mkdir -p %{buildroot}%{_datadir}/aclocal/
50d985
install -m 644 README.7 %{buildroot}%{_mandir}/man7/%{scl_name}.7
50d985
50d985
%scl_install
50d985
50d985
# create directory for SCL register scripts
50d985
mkdir -p %{buildroot}%{?_scl_scripts}/register.content
50d985
mkdir -p %{buildroot}%{?_scl_scripts}/register.d
50d985
cat <
50d985
#!/bin/sh
50d985
ls %{?_scl_scripts}/register.d/* | while read file ; do
50d985
    [ -x \$f ] && source \$(readlink -f \$file)
50d985
done
50d985
EOF
50d985
# and deregister as well
50d985
mkdir -p %{buildroot}%{?_scl_scripts}/deregister.d
50d985
cat <
50d985
#!/bin/sh
50d985
ls %{?_scl_scripts}/deregister.d/* | while read file ; do
50d985
    [ -x \$f ] && source \$(readlink -f \$file)
50d985
done
50d985
EOF
50d985
50d985
%post runtime
50d985
# Simple copy of context from system root to DSC root.
50d985
# In case new version needs some additional rules or context definition,
50d985
# it needs to be solved.
50d985
# Unfortunately, semanage does not have -e option in RHEL-5, so we have to
50d985
# have its own policy for collection
50d985
semanage fcontext -a -e / %{_scl_root} >/dev/null 2>&1 || :
50d985
restorecon -R %{_scl_root} >/dev/null 2>&1 || :
50d985
selinuxenabled && load_policy || :
50d985
50d985
%files
50d985
50d985
%files runtime
50d985
%defattr(-,root,root)
50d985
%doc README LICENSE
50d985
%scl_files
50d985
%dir %{_mandir}/man1
50d985
%dir %{_mandir}/man3
50d985
%dir %{_mandir}/man7
50d985
%dir %{_mandir}/man8
50d985
%dir %{_libdir}/pkgconfig
50d985
%dir %{_datadir}/aclocal
50d985
%{_mandir}/man7/%{scl_name}.*
50d985
%attr(0755,root,root) %{?_scl_scripts}/register
50d985
%attr(0755,root,root) %{?_scl_scripts}/deregister
50d985
%{?_scl_scripts}/register.content
50d985
%dir %{?_scl_scripts}/register.d
50d985
%dir %{?_scl_scripts}/deregister.d
50d985
50d985
%files build
50d985
%defattr(-,root,root)
50d985
%{_root_sysconfdir}/rpm/macros.%{scl}-config
50d985
50d985
%files scldevel
50d985
%defattr(-,root,root)
50d985
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
50d985
50d985
%changelog
50d985
* Tue Oct 13 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-6
50d985
- correct mistakes in man page (#1261372)
50d985
50d985
* Fri Sep 11 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-5
50d985
- own man3 directory (#1261455)
50d985
- improve the man page (#1261372)
50d985
50d985
* Mon Aug 17 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-4
50d985
- add sbin directory into PATH (#1253666)
50d985
50d985
* Wed Jul 08 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-3
50d985
- rebuild against new scl-utils
50d985
50d985
* Tue Jul 07 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-2
50d985
- enable NFS support
50d985
50d985
* Wed Apr 08 2015 Jan Kaluza <jkaluza@redhat.com> - 2.1-1
50d985
- initial packaging