Blame SPECS/rh-nginx120.spec

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