# Define SCL name %{!?scl_name_prefix: %global scl_name_prefix rh-} %{!?scl_name_base: %global scl_name_base haproxy} %{!?version_major: %global version_major 1} %{!?version_minor: %global version_minor 8} %{!?scl_name_version: %global scl_name_version %{version_major}%{version_minor}} %{!?scl: %global scl %{scl_name_prefix}%{scl_name_base}%{scl_name_version}} # Turn on new layout -- prefix for packages and location # for config and variable files # This must be before calling %%scl_package %{!?nfsmountable: %global nfsmountable 1} # Define SCL macros %{?scl_package:%scl_package %scl} # do not produce empty debuginfo package %global debug_package %{nil} Summary: Package that installs %{scl} Name: %{scl} Version: 3.1 Release: 1%{?dist} License: GPLv2+ Group: Applications/File Source0: README Source1: LICENSE Requires: scl-utils Requires: %{?scl_prefix}%{scl_name_base} BuildRequires: scl-utils-build help2man scl-utils-build-helpers %description This is the main package for %{scl} Software Collection, which installs necessary packages to use HAProxy %{version_major}.%{version_minor}. Software Collections allow to install more versions of the same package by using alternative directory structure. Install this package if you want to use HAProxy %{version_major}.%{version_minor} Software Collection on your system. %package runtime Summary: Package that handles %{scl} Software Collection. Group: Applications/File Requires: scl-utils Requires(post): policycoreutils-python libselinux-utils %description runtime Package shipping essential scripts to work with %{scl} Software Collection. %package build Summary: Package shipping basic build configuration Group: Applications/File Requires: scl-utils-build scl-utils-build-helpers %description build Package shipping essential configuration macros to build %{scl} Software Collection or packages depending on %{scl} Software Collection. %package scldevel Summary: Package shipping development files for %{scl} %description scldevel Package shipping development files, especially usefull for development of packages depending on %{scl} Software Collection. %if 0%{?scl_syspaths_metapackage:1} %scl_syspaths_metapackage Requires: %{?scl_prefix}%{scl_name_base}-syspaths %scl_syspaths_metapackage_description %endif %prep %setup -c -T # This section generates README file from a template and creates man page # from that file, expanding RPM macros in the template file. cat <<'EOF' | tee README %{expand:%(cat %{SOURCE0})} EOF # copy the license file so %%files section sees it cp %{SOURCE1} . %build # generate a helper script that will be used by help2man cat <<'EOF' | tee h2m_helper #!/bin/bash [ "$1" == "--version" ] && echo "%{?scl_name} %{version} Software Collection" || cat README EOF chmod a+x h2m_helper # generate the man page help2man -N --section 7 ./h2m_helper -o %{?scl_name}.7 sed -i "s|'|\\\\N'39'|g" %{?scl_name}.7 %install %{?scl_install} # create and own dirs not covered by %%scl_install and %%scl_files mkdir -p %{buildroot}%{_mandir}/man{1,7,8} # create enable scriptlet that sets correct environment for collection cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/enable # For binaries export PATH="%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}" # For header files export CPATH="%{_includedir}\${CPATH:+:\${CPATH}}" # For libraries during build export LIBRARY_PATH="%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}" # For libraries during linking export LD_LIBRARY_PATH="%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}" # For man pages; empty field makes man to consider also standard path export MANPATH="%{_mandir}:\${MANPATH:-}" # For Java Packages Tools to locate java.conf export JAVACONFDIRS="%{_sysconfdir}/java\${JAVACONFDIRS:+:}\${JAVACONFDIRS:-}" # For XMvn to locate its configuration file(s) export XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:\${XDG_CONFIG_DIRS:-/etc/xdg}" # For systemtap export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:%{_root_datadir}}" # For pkg-config export PKG_CONFIG_PATH="%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}" EOF # generate rpm macros file for depended collections cat << EOF | tee -a %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel %%scl_%{scl_name_base} %{scl} %%scl_prefix_%{scl_name_base} %{?scl_prefix} EOF # install generated man page mkdir -p %{buildroot}%{_mandir}/man7/ install -m 644 %{?scl_name}.7 %{buildroot}%{_mandir}/man7/%{?scl_name}.7 # RHBZ#1487292 - missing ownership on some files mkdir -p %{buildroot}%{_libdir}/pkgconfig mkdir -p %{buildroot}%{_datadir}/selinux/packages/ %post runtime # Simple copy of context from system root to SCL root. # In case new version needs some additional rules or context definition, # it needs to be solved in base system. # semanage does not have -e option in RHEL-5, so we would # have to have its own policy for collection. semanage fcontext -a -e / %{?_scl_root} >/dev/null 2>&1 || : semanage fcontext -a -e %{_root_sysconfdir} %{_sysconfdir} >/dev/null 2>&1 || : semanage fcontext -a -e %{_root_localstatedir} %{_localstatedir} >/dev/null 2>&1 || : selinuxenabled && load_policy || : restorecon -R %{?_scl_root} >/dev/null 2>&1 || : restorecon -R %{_sysconfdir} >/dev/null 2>&1 || : restorecon -R %{_localstatedir} >/dev/null 2>&1 || : %files %files runtime -f filesystem %doc README LICENSE %{?scl_files} %dir %{_datadir}/selinux/ %dir %{_datadir}/selinux/packages/ %files build %doc LICENSE %{_root_sysconfdir}/rpm/macros.%{scl}-config %files scldevel %doc LICENSE %{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel %{?scl_syspaths_metapackage:%files syspaths} %changelog * Sun Feb 04 2018 Honza Horak - 3.1-1 - initial packaging