Blame SPECS/rh-nginx112.spec

567c88
%global scl_name_prefix  rh-
567c88
%global scl_name_base    nginx
567c88
%global scl_name_version 112
567c88
%global scl              %{scl_name_prefix}%{scl_name_base}%{scl_name_version}
567c88
%{!?nfsmountable: %global nfsmountable 1}
567c88
%scl_package %scl
567c88
567c88
%{!?scl_perl:%global scl_perl rh-perl524}
567c88
%{!?scl_prefix_perl:%global scl_prefix_perl %{scl_perl}-}
567c88
567c88
# do not produce empty debuginfo package
567c88
%global debug_package %{nil}
567c88
567c88
%global nginx_perl_vendorarch %{_scl_root}%(eval "`%{_root_bindir}/perl -V:installvendorarch`"; echo $installvendorarch)
567c88
%global nginx_perl_archlib %{_scl_root}%(eval "`%{_root_bindir}/perl -V:archlib`"; echo $archlib)
567c88
567c88
Summary:       Package that installs %scl
567c88
Name:          %scl_name
567c88
Version:       1.12
567c88
Release:       3%{?dist}
567c88
License:       GPLv2+
567c88
Group: Applications/File
567c88
Source0: README
567c88
Source1: LICENSE
567c88
Source2: README.7
567c88
567c88
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
567c88
BuildRequires: scl-utils-build
567c88
# Temporary work-around
567c88
BuildRequires: iso-codes
567c88
567c88
Requires: %{scl_prefix}nginx
567c88
567c88
%description
567c88
This is the main package for %scl Software Collection.
567c88
567c88
%package runtime
567c88
Summary:   Package that handles %scl Software Collection.
567c88
Requires:  scl-utils
567c88
Requires(post): policycoreutils-python libselinux-utils
567c88
567c88
%description runtime
567c88
Package shipping essential scripts to work with %scl Software Collection.
567c88
567c88
%package build
567c88
Summary:   Package shipping basic build configuration
567c88
Requires:  scl-utils-build
567c88
%ifarch x86_64
567c88
Requires: %{scl_prefix_perl}scldevel
567c88
%endif
567c88
567c88
%description build
567c88
Package shipping essential configuration macros to build %scl Software Collection.
567c88
567c88
%package scldevel
567c88
Summary:   Package shipping development files for %scl
567c88
Group:     Development/Languages
567c88
567c88
%description scldevel
567c88
Package shipping development files, especially usefull for development of
567c88
packages depending on %scl Software Collection.
567c88
567c88
%prep
567c88
%setup -c -T
567c88
567c88
# copy the license file so %%files section sees it
567c88
cp %{SOURCE0} .
567c88
cp %{SOURCE1} .
567c88
cp %{SOURCE2} .
567c88
567c88
expand_variables() {
567c88
    sed -i 's|%%{scl_name}|%{scl_name}|g' "$1"
567c88
    sed -i 's|%%{_scl_root}|%{_scl_root}|g' "$1"
567c88
    sed -i 's|%%{version}|%{version}|g' "$1"
567c88
%if 0%{?rhel} > 6
567c88
    sed -i 's|%%{service_start}|systemctl start %{scl_name}-nginx|g' "$1"
567c88
%else
567c88
    sed -i 's|%%{service_start}|service %{scl_name}-nginx start|g' "$1"
567c88
%endif
567c88
}
567c88
567c88
expand_variables README.7
567c88
expand_variables README
567c88
567c88
# Not required for now
567c88
#export LIBRARY_PATH=%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}
567c88
#export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
567c88
567c88
cat <
567c88
if scl -l  | grep %{scl_perl} >&/dev/null; then
567c88
  . scl_source enable %{scl_perl}
567c88
fi
567c88
export PATH=%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}
567c88
export MANPATH=%{_mandir}:\${MANPATH}
567c88
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}
567c88
export PERL5LIB="%{nginx_perl_vendorarch}\${PERL5LIB:+:\${PERL5LIB}}"
567c88
EOF
567c88
567c88
# generate rpm macros file for depended collections
567c88
cat << EOF | tee scldev
567c88
%%scl_%{scl_name_base}         %{scl}
567c88
%%scl_prefix_%{scl_name_base}  %{scl_prefix}
567c88
EOF
567c88
567c88
%build
567c88
567c88
%install
567c88
mkdir -p %{buildroot}%{_scl_scripts}/root
567c88
install -m 644 enable  %{buildroot}%{_scl_scripts}/enable
567c88
install -D -m 644 scldev %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
567c88
567c88
mkdir -p -m 755 \
567c88
      %{buildroot}%{_localstatedir}/run/ \
567c88
      %{buildroot}%{nginx_perl_vendorarch}
567c88
567c88
# install generated man page
567c88
mkdir -p %{buildroot}%{_mandir}/man7/
567c88
install -m 644 README.7 %{buildroot}%{_mandir}/man7/%{scl_name}.7
567c88
567c88
%scl_install
567c88
567c88
%ifarch x86_64
567c88
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config << EOF
567c88
%%scl_package_override() %%{expand:%%global __perl_requires /usr/lib/rpm/perl.req.rh-perl524 \
567c88
%%global __perl_provides /usr/lib/rpm/perl.prov.rh-perl524 \
567c88
%%global __perl %{_scl_prefix}/%{scl_perl}/root/usr/bin/perl \
567c88
%%global _nginx_perl_vendorarch %{nginx_perl_vendorarch} \
567c88
}
567c88
EOF
567c88
%else
567c88
touch %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config
567c88
%endif
567c88
567c88
# create directory for SCL register scripts
567c88
mkdir -p %{buildroot}%{?_scl_scripts}/register.content
567c88
mkdir -p %{buildroot}%{?_scl_scripts}/register.d
567c88
cat <
567c88
#!/bin/sh
567c88
ls %{?_scl_scripts}/register.d/* | while read file ; do
567c88
    [ -x \$f ] && source \$(readlink -f \$file)
567c88
done
567c88
EOF
567c88
# and deregister as well
567c88
mkdir -p %{buildroot}%{?_scl_scripts}/deregister.d
567c88
cat <
567c88
#!/bin/sh
567c88
ls %{?_scl_scripts}/deregister.d/* | while read file ; do
567c88
    [ -x \$f ] && source \$(readlink -f \$file)
567c88
done
567c88
EOF
567c88
567c88
%post runtime
567c88
# Simple copy of context from system root to DSC root.
567c88
# In case new version needs some additional rules or context definition,
567c88
# it needs to be solved.
567c88
# Unfortunately, semanage does not have -e option in RHEL-5, so we have to
567c88
# have its own policy for collection
567c88
semanage fcontext -a -e / %{_scl_root} >/dev/null 2>&1 || :
567c88
restorecon -R %{_scl_root} >/dev/null 2>&1 || :
567c88
selinuxenabled && load_policy || :
567c88
567c88
%files
567c88
567c88
%files runtime
567c88
%defattr(-,root,root)
567c88
%doc README LICENSE
567c88
%scl_files
567c88
%dir %{_mandir}/man3
567c88
%dir %{_mandir}/man7
567c88
%dir %{_mandir}/man8
567c88
%{_mandir}/man7/%{scl_name}.*
567c88
567c88
%dir %{_localstatedir}/run
567c88
%dir %{nginx_perl_archlib}
567c88
%dir %{nginx_perl_vendorarch}
567c88
567c88
%attr(0755,root,root) %{?_scl_scripts}/register
567c88
%attr(0755,root,root) %{?_scl_scripts}/deregister
567c88
%{?_scl_scripts}/register.content
567c88
%dir %{?_scl_scripts}/register.d
567c88
%dir %{?_scl_scripts}/deregister.d
567c88
567c88
%files build
567c88
%defattr(-,root,root)
567c88
%{_root_sysconfdir}/rpm/macros.%{scl}-config
567c88
567c88
%files scldevel
567c88
%defattr(-,root,root)
567c88
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
567c88
567c88
%changelog
567c88
* Tue Jul 11 2017 Luboš Uhliarik <luhliari@redhat.com> - 1.12-3
567c88
- Resolves: #1469535 - mistakes in README file
567c88
- Resolves: #1264421 - Unexpanded macros in metapackage README
567c88
567c88
* Fri Jun 09 2017 Luboš Uhliarik <luhliari@redhat.com> - 1.12-2
567c88
- initial packaging