Blame SPECS/rh-nginx118.spec

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