Blame SPECS/rh-mongodb34.spec

e9aba3
# Define SCL name
e9aba3
%{!?scl_name_prefix: %global scl_name_prefix rh-}
e9aba3
%{!?scl_name_base: %global scl_name_base mongodb}
e9aba3
%{!?version_major: %global version_major 3}
e9aba3
%{!?version_minor: %global version_minor 4}
e9aba3
%{!?scl_name_version: %global scl_name_version %{version_major}%{version_minor}}
e9aba3
%{!?scl: %global scl %{scl_name_prefix}%{scl_name_base}%{scl_name_version}}
e9aba3
e9aba3
# Turn on new layout -- prefix for packages and location
e9aba3
# for config and variable files
e9aba3
# This must be before calling %%scl_package
e9aba3
%{!?nfsmountable: %global nfsmountable 1}
e9aba3
e9aba3
# Define SCL macros
e9aba3
%{?scl_package:%scl_package %scl}
e9aba3
e9aba3
# do not produce empty debuginfo package (https://bugzilla.redhat.com/show_bug.cgi?id=1061439#c2)
e9aba3
%global debug_package %{nil}
e9aba3
e9aba3
# Convert SCL name into uppercase including - to _ conversion
e9aba3
%if 0%{?scl:1}
e9aba3
%global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))}
e9aba3
%endif
e9aba3
e9aba3
e9aba3
Summary:	Package that installs %{scl}
e9aba3
Name:		%{scl}
e9aba3
Version:	3.0
e9aba3
Release:	14%{?dist}
e9aba3
License:	GPLv2+
e9aba3
Group:		Applications/File
e9aba3
# template of man page with RPM macros to be expanded
e9aba3
Source0:	README
e9aba3
# mongodb license
e9aba3
Source1:	LICENSE
e9aba3
Requires:       %{name}-runtime = %{version}
e9aba3
Requires:	scl-utils
e9aba3
Requires:	%{?scl_prefix}mongodb-server
e9aba3
Requires:	%{?scl_prefix}mongodb
e9aba3
Requires:	%{?scl_prefix}mongo-tools
e9aba3
BuildRequires:	scl-utils-build, help2man
e9aba3
%if 0%{?rhel} >= 7
e9aba3
BuildRequires:	rh-maven35-scldevel
e9aba3
BuildRequires:	rh-maven35-javapackages-local
e9aba3
%endif
e9aba3
e9aba3
%description
e9aba3
This is the main package for %{scl} Software Collection, which installs
e9aba3
necessary packages to use MongoDB %{version_major}.%{version_minor} server.
e9aba3
Software Collections allow to install more versions of the same package
e9aba3
by using alternative directory structure.
e9aba3
Install this package if you want to use MongoDB %{version_major}.%{version_minor}
e9aba3
server on your system
e9aba3
e9aba3
%package runtime
e9aba3
Summary:	Package that handles %{scl} Software Collection.
e9aba3
Group:		Applications/File
e9aba3
Requires:	scl-utils
e9aba3
Requires(post):	policycoreutils-python, libselinux-utils
e9aba3
e9aba3
%description runtime
e9aba3
Package shipping essential scripts to work with %{scl} Software Collection.
e9aba3
e9aba3
%package build
e9aba3
Summary:	Package shipping basic build configuration
e9aba3
Requires:	scl-utils-build
e9aba3
Requires:	scl-utils-build-helpers
e9aba3
Requires:	%{name}-scldevel = %{version}
e9aba3
%if 0%{?rhel} >= 7
e9aba3
Requires:	rh-maven35-scldevel
e9aba3
%endif
e9aba3
Group:		Applications/File
e9aba3
e9aba3
%description build
e9aba3
Package shipping essential configuration macros to build
e9aba3
%scl Software Collection.
e9aba3
e9aba3
%package scldevel
e9aba3
Summary:	Package shipping development files for %{scl}.
e9aba3
Group:		Applications/File
e9aba3
Requires:       %{name}-runtime = %{version}
e9aba3
e9aba3
%description scldevel
e9aba3
Development files for %{scl} (useful e.g. for hierarchical collection
e9aba3
building with transitive dependencies).
e9aba3
e9aba3
%if 0%{?scl_syspaths_metapackage:1}
e9aba3
%scl_syspaths_metapackage
e9aba3
Requires: %{?scl_prefix}mongodb-syspaths
e9aba3
Requires: %{?scl_prefix}mongodb-server-syspaths
e9aba3
Requires: %{?scl_prefix}mongo-tools-syspaths
e9aba3
e9aba3
%scl_syspaths_metapackage_description
e9aba3
%endif
e9aba3
e9aba3
%prep
e9aba3
%setup -c -T
e9aba3
e9aba3
# This section generates README file from a template and creates man page
e9aba3
# from that file, expanding RPM macros in the template file.
e9aba3
cat <<'EOF' | tee README
e9aba3
%{expand:%(cat %{SOURCE0})}
e9aba3
EOF
e9aba3
e9aba3
# copy the license file so %%files section sees it
e9aba3
cp %{SOURCE1} .
e9aba3
e9aba3
%build
e9aba3
# temporary helper script used by help2man
e9aba3
cat <<\EOF | tee h2m_helper
e9aba3
#!/bin/sh
e9aba3
if [ "$1" = "--version" ]; then
e9aba3
  printf '%%s' "%{?scl_name} %{version} Software Collection"
e9aba3
else
e9aba3
  cat README
e9aba3
fi
e9aba3
EOF
e9aba3
chmod a+x h2m_helper
e9aba3
# generate the man page
e9aba3
help2man -N --section 7 ./h2m_helper -o %{?scl_name}.7
e9aba3
sed -i "s|'|\\\\N'39'|g" %{?scl_name}.7
e9aba3
e9aba3
%install
e9aba3
%{?scl_install}
e9aba3
%{?scl_install_java}
e9aba3
e9aba3
# create enable scriptlet that sets correct environment for collection
e9aba3
cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/enable
e9aba3
# For binaries
e9aba3
export PATH="%{_bindir}:%{_sbindir}\${PATH:+:\${PATH}}"
e9aba3
# For header files
e9aba3
export CPATH="%{_includedir}\${CPATH:+:\${CPATH}}"
e9aba3
# For libraries during build
e9aba3
export LIBRARY_PATH="%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}"
e9aba3
# For libraries during linking
e9aba3
export LD_LIBRARY_PATH="%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}"
e9aba3
# For man pages; empty field makes man to consider also standard path
e9aba3
export MANPATH="%{_mandir}:\${MANPATH:-}"
e9aba3
# For Java Packages Tools to locate java.conf
e9aba3
export JAVACONFDIRS="%{_sysconfdir}/java\${JAVACONFDIRS:+:}\${JAVACONFDIRS:-}"
e9aba3
# For XMvn to locate its configuration file(s)
e9aba3
export XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:\${XDG_CONFIG_DIRS:-/etc/xdg}"
e9aba3
# For systemtap
e9aba3
export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
e9aba3
# For pkg-config
e9aba3
export PKG_CONFIG_PATH="%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
e9aba3
# For Java RPM generators
e9aba3
export PYTHONPATH="%{_scl_root}%{python_sitearch}:%{_scl_root}%{python_sitelib}\${PYTHONPATH:+:}\${PYTHONPATH:-}"
e9aba3
# For golang packages in collection (for building mongo tools)
e9aba3
export GOPATH="%{_datadir}/gocode\${GOPATH:+:\${GOPATH}}"
e9aba3
EOF
e9aba3
e9aba3
# generate service-environment file for mongo[ds] configuration
e9aba3
cat >> %{buildroot}%{_scl_scripts}/service-environment << EOF
e9aba3
# Services are started in a fresh environment without any influence of user's
e9aba3
# environment (like environment variable values). As a consequence,
e9aba3
# information of all enabled collections will be lost during service start up.
e9aba3
# If user needs to run a service under any software collection enabled, this
e9aba3
# collection has to be written into %{scl_upper}_SCLS_ENABLED variable in
e9aba3
# /opt/rh/sclname/service-environment.
e9aba3
%{scl_upper}_SCLS_ENABLED='%{scl}'
e9aba3
EOF
e9aba3
e9aba3
# install generated man page
e9aba3
install -d -m 755               %{buildroot}%{_mandir}/man7
e9aba3
install -p -m 644 %{?scl_name}.7 %{buildroot}%{_mandir}/man7/
e9aba3
e9aba3
# create directory for license
e9aba3
install -d -m 755 %{buildroot}%{_licensedir}
e9aba3
e9aba3
# create directory not create by scl_install
e9aba3
install -d -m 755 %{buildroot}%{_datadir}/gocode
e9aba3
install -d -m 755 %{buildroot}%{_datadir}/gocode/src
e9aba3
install -d -m 755 %{buildroot}%{_libdir}/cmake
e9aba3
install -d -m 755 %{buildroot}%{_libdir}/pkgconfig
e9aba3
e9aba3
# generate rpm macros file for depended collections
e9aba3
cat << EOF | tee -a %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
e9aba3
%%scl_%{scl_name_base} %{?scl}
e9aba3
%%scl_prefix_%{scl_name_base} %{?scl_prefix}
e9aba3
EOF
e9aba3
e9aba3
e9aba3
%post runtime
e9aba3
# Simple copy of context from system root to SCL root.
e9aba3
# In case new version needs some additional rules or context definition,
e9aba3
# it needs to be solved by changing selinux-policy.
e9aba3
semanage fcontext -a -e / %{?_scl_root} >/dev/null 2>&1 || :
e9aba3
semanage fcontext -a -e %{_root_sysconfdir} %{_sysconfdir} >/dev/null 2>&1 || :
e9aba3
semanage fcontext -a -e %{_root_localstatedir} %{_localstatedir} >/dev/null 2>&1 || :
e9aba3
selinuxenabled && load_policy || :
e9aba3
restorecon -R %{?_scl_root} >/dev/null 2>&1 || :
e9aba3
restorecon -R %{_sysconfdir} >/dev/null 2>&1 || :
e9aba3
restorecon -R %{_localstatedir} >/dev/null 2>&1 || :
e9aba3
e9aba3
#define license tag if not already defined (RHEL6)
e9aba3
%{!?_licensedir:%global license %doc}
e9aba3
e9aba3
%files
e9aba3
e9aba3
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 15
e9aba3
%{?scl_install_java:%files runtime -f filesystem -f .java-filelist}
e9aba3
%{!?scl_install_java:%files runtime -f filesystem}
e9aba3
%dir %attr(0755, root, root) %{_licensedir}/
e9aba3
%else
e9aba3
%files runtime
e9aba3
%endif
e9aba3
%license LICENSE
e9aba3
%doc README
e9aba3
%{?scl_files}
e9aba3
%config(noreplace) %{_scl_scripts}/service-environment
e9aba3
%{_mandir}/man7/%{?scl_name}.*
e9aba3
# Directories for golang code (requrements of mongo-tools)
e9aba3
%dir %{_datadir}/gocode
e9aba3
%dir %{_datadir}/gocode/src
e9aba3
# RHBZ#1482016 - missing ownership on aarch64 and ppc64le
e9aba3
%dir %{_libdir}
e9aba3
%dir %{_libdir}/cmake
e9aba3
%dir %{_libdir}/pkgconfig
e9aba3
e9aba3
e9aba3
%files build
e9aba3
%license LICENSE
e9aba3
%{_root_sysconfdir}/rpm/macros.%{scl}-config
e9aba3
e9aba3
%files scldevel
e9aba3
%license LICENSE
e9aba3
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
e9aba3
e9aba3
%{?scl_syspaths_metapackage:%files syspaths}
e9aba3
e9aba3
%changelog
e9aba3
* Mon Sep 25 2017 Marek Skalický <mskalick@redhat.com> - 3.0-14
e9aba3
- Add syspaths subpackage
e9aba3
  Resolves: RHZB#1466870
e9aba3
e9aba3
* Tue Aug 22 2017 Marek Skalický <mskalick@redhat.com> - 3.0-13
e9aba3
- Fix ownership on aarch64 and ppc64le
e9aba3
  Resolves: RHBZ#1482016
e9aba3
- Add requirements for collection metapackage to install mongo shell and mongo-tools
e9aba3
  Resolves: RHBZ#1483966
e9aba3
e9aba3
* Tue Aug 22 2017 Marek Skalický <mskalick@redhat.com> - 3.0-12
e9aba3
- Set XDG_DATA_DIRS correctly (to include /usr/share by default)
e9aba3
  Resolves: RHBZ#1482012
e9aba3
e9aba3
* Mon Aug 07 2017 Marek Skalický <mskalick@redhat.com> - 3.0-11
e9aba3
- Add back missing rh-maven35-javapackages-local needed for scl_install_java
e9aba3
e9aba3
* Fri Jul 21 2017 Marek Skalický <mskalick@redhat.com> - 3.0-10
e9aba3
- Remove rh-maven35 dependency
e9aba3
e9aba3
* Mon Jun 26 2017 Marek Skalický <mskalick@redhat.com> - 3.0-9
e9aba3
- Add missing directory ownership
e9aba3
e9aba3
* Mon Jun 26 2017 Marek Skalický <mskalick@redhat.com> - 3.0-8
e9aba3
- Install javapackages-local for building
e9aba3
e9aba3
* Mon Jun 26 2017 Marek Skalický <mskalick@redhat.com> - 3.0-7
e9aba3
- Use license directive on RHEL6 too
e9aba3
e9aba3
* Fri Jun 23 2017 Michael Simacek <msimacek@redhat.com> - 3.0-6
e9aba3
- Update for rh-maven35 and scl_install_java
e9aba3
e9aba3
* Fri Jun 23 2017 Marek Skalický <mskalick@redhat.com> - 3.0-5
e9aba3
- Use rh-maven35 on RHEL7
e9aba3
- Set GOPATH to be able to use mongo-tools sources in user project build
e9aba3
e9aba3
* Fri Jun 23 2017 Marek Skalický <mskalick@redhat.com> - 3.0-4
e9aba3
- Add scl-utils-build-helpers build dependency
e9aba3
e9aba3
* Tue Jun 20 2017 Marek Skalický <mskalick@redhat.com> - 3.0-3
e9aba3
- Add java configuration back
e9aba3
e9aba3
* Thu Jun 8 2017 Marek Skalicky <mskalick@redhat.com> - 3.0-2
e9aba3
- Remove odd chars from enable script
e9aba3
e9aba3
* Mon Jun 5 2017 Marek Skalicky <mskalick@redhat.com> - 3.0-1
e9aba3
- Initial commit (converted rh-mongodb32.spec)
e9aba3
- Use recommended softwarecollection.org way to redefine env variables in enable script
e9aba3