Blame SPECS/rh-redis5.spec

263a8d
%{!?scl_vendor: %global scl_vendor rh}
263a8d
%global scl_name_base    redis
263a8d
%global scl_name_version 5
263a8d
%global scl              %{scl_vendor}-%{scl_name_base}%{scl_name_version}
263a8d
%global macrosdir        %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_root_sysconfdir}/rpm; echo $d)
263a8d
%global install_scl      1
263a8d
%global nfsmountable     1
263a8d
263a8d
%scl_package %scl
263a8d
263a8d
# do not produce empty debuginfo package
263a8d
%global debug_package %{nil}
263a8d
263a8d
Summary:       Package that installs Redis 5
263a8d
Name:          %scl_name
263a8d
Version:       3.3
263a8d
Release:       1%{?dist}
263a8d
Group:         Development/Languages
263a8d
License:       GPLv2+
263a8d
263a8d
Source0:       macros-build
263a8d
Source1:       README
263a8d
Source2:       LICENSE
263a8d
Source3:       register
263a8d
Source4:       deregister
263a8d
Source5:       50-copy-files
263a8d
Source6:       50-clean-files
263a8d
263a8d
BuildRequires: scl-utils-build
263a8d
BuildRequires: help2man
263a8d
# Temporary work-around
263a8d
BuildRequires: iso-codes
263a8d
263a8d
Requires:      %{?scl_prefix}redis%{?_isa}
263a8d
Requires:      %{?scl_name}-runtime%{?_isa} = %{version}-%{release}
263a8d
263a8d
%description
263a8d
This is the main package for %scl Software Collection,
263a8d
that install Redis and Sentinel servers.
263a8d
263a8d
263a8d
%package runtime
263a8d
Summary:   Package that handles %scl Software Collection.
263a8d
Group:     Development/Languages
263a8d
Requires:  scl-utils
263a8d
Requires(post): policycoreutils-python libselinux-utils
263a8d
263a8d
%description runtime
263a8d
Package shipping essential scripts to work with %scl Software Collection.
263a8d
263a8d
263a8d
%package build
263a8d
Summary:   Package shipping basic build configuration
263a8d
Group:     Development/Languages
263a8d
Requires:  scl-utils-build
263a8d
Requires:  %{?scl_name}-runtime%{?_isa} = %{version}-%{release}
263a8d
263a8d
%description build
263a8d
Package shipping essential configuration macros
263a8d
to build %scl Software Collection.
263a8d
263a8d
263a8d
%package scldevel
263a8d
Summary:   Package shipping development files for %scl
263a8d
Group:     Development/Languages
263a8d
Requires:  %{?scl_name}-runtime%{?_isa} = %{version}-%{release}
263a8d
263a8d
%description scldevel
263a8d
Package shipping development files, especially usefull for development of
263a8d
packages depending on %scl Software Collection.
263a8d
263a8d
263a8d
%prep
263a8d
%setup -c -T
263a8d
263a8d
cat <
263a8d
export PATH=%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}
263a8d
export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
263a8d
export MANPATH=%{_mandir}:\${MANPATH}
263a8d
EOF
263a8d
263a8d
# generate rpm macros file for depended collections
263a8d
cat << EOF | tee scldev
263a8d
%%scl_%{scl_name_base}         %{scl}
263a8d
%%scl_prefix_%{scl_name_base}  %{scl_prefix}
263a8d
EOF
263a8d
263a8d
# This section generates README file from a template and creates man page
263a8d
# from that file, expanding RPM macros in the template file.
263a8d
cat >README <<'EOF'
263a8d
%{expand:%(cat %{SOURCE1})}
263a8d
EOF
263a8d
263a8d
# copy additional files
263a8d
cp %{SOURCE2} %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} .
263a8d
263a8d
263a8d
%build
263a8d
# generate a helper script that will be used by help2man
263a8d
cat >h2m_helper <<'EOF'
263a8d
#!/bin/bash
263a8d
[ "$1" == "--version" ] && echo "%{scl_name} %{version} Software Collection" || cat README
263a8d
EOF
263a8d
chmod a+x h2m_helper
263a8d
263a8d
# generate the man page
263a8d
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7
263a8d
# Fix single quotes in man page. See RHBZ#1219527
263a8d
#
263a8d
# http://lists.gnu.org/archive/html/groff/2008-06/msg00001.html suggests that
263a8d
# using "'" for quotes is correct, but the current implementation of man in 6
263a8d
# mangles it when rendering.
263a8d
sed -i "s/'/\\\\(aq/g" %{scl_name}.7
263a8d
 
263a8d
263a8d
%install
263a8d
install -D -m 644 enable         %{buildroot}%{_scl_scripts}/enable
263a8d
install -D -m 644 register       %{buildroot}%{_scl_scripts}/register
263a8d
install -d -m 755                %{buildroot}%{_scl_scripts}/register.content
263a8d
install -D -m 644 50-copy-files  %{buildroot}%{_scl_scripts}/register.d/50-copy-files
263a8d
install -D -m 644 deregister     %{buildroot}%{_scl_scripts}/deregister
263a8d
install -D -m 644 50-clean-files %{buildroot}%{_scl_scripts}/deregister.d/50-clean-files
263a8d
sed -e 's:@SCLDIR@:%{_scl_scripts}:' \
263a8d
    -i %{buildroot}%{_scl_scripts}/*gister
263a8d
263a8d
install -D -m 644 scldev %{buildroot}%{macrosdir}/macros.%{scl_name_base}-scldevel
263a8d
install -D -m 644 %{scl_name}.7 %{buildroot}%{_mandir}/man7/%{scl_name}.7
263a8d
263a8d
install -d -m 755 %{buildroot}%{_datadir}/licenses
263a8d
263a8d
%scl_install
263a8d
263a8d
# Add the scl_package_override macro
263a8d
sed -e 's/@SCL@/%{scl_name_base}%{scl_name_version}/g' \
263a8d
    -e 's/@VENDOR@/%{scl_vendor}/' \
263a8d
    %{SOURCE0} \
263a8d
  | tee -a %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config
263a8d
263a8d
# Move in correct location, if needed
263a8d
if [ "%{_root_sysconfdir}/rpm" != "%{macrosdir}" ]; then
263a8d
  mv  %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config \
263a8d
      %{buildroot}%{macrosdir}/macros.%{scl}-config
263a8d
fi
263a8d
263a8d
263a8d
%post runtime
263a8d
# Simple copy of context from system root to SCL root.
263a8d
semanage fcontext -a -e /                      %{?_scl_root}     &>/dev/null || :
263a8d
semanage fcontext -a -e %{_root_sysconfdir}    %{_sysconfdir}    &>/dev/null || :
263a8d
semanage fcontext -a -e %{_root_localstatedir} %{_localstatedir} &>/dev/null || :
263a8d
selinuxenabled && load_policy || :
263a8d
restorecon -R %{?_scl_root}     &>/dev/null || :
263a8d
restorecon -R %{_sysconfdir}    &>/dev/null || :
263a8d
restorecon -R %{_localstatedir} &>/dev/null || :
263a8d
263a8d
263a8d
%files
263a8d
263a8d
263a8d
%{!?_licensedir:%global license %%doc}
263a8d
263a8d
%files runtime -f filesystem
263a8d
%license LICENSE
263a8d
%doc README
263a8d
%scl_files
263a8d
%{_scl_scripts}/register
263a8d
%{_scl_scripts}/register.d/
263a8d
%{_scl_scripts}/register.content/
263a8d
%{_scl_scripts}/deregister
263a8d
%{_scl_scripts}/deregister.d/
263a8d
%{?_licensedir:%{_datadir}/licenses}
263a8d
263a8d
263a8d
%files build
263a8d
%{macrosdir}/macros.%{scl}-config
263a8d
263a8d
263a8d
%files scldevel
263a8d
%{macrosdir}/macros.%{scl_name_base}-scldevel
263a8d
263a8d
263a8d
%changelog
263a8d
* Wed Jul 27 2016 Remi Collet <rcollet@redhat.com> 3.3-1
263a8d
- initial package for rh-redis5 in RHSCL-3.3
263a8d