Blame SPECS/rh-nginx116.spec

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