Blame SPECS/rh-mongodb36.spec

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