Blame SPECS/rh-varnish5.spec

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