Blame SPECS/rh-mongodb26.spec

1c37ab
# Define SCL name
1c37ab
%{!?scl_name_prefix: %global scl_name_prefix rh-}
1c37ab
%{!?scl_name_base: %global scl_name_base mongodb}
1c37ab
%{!?version_major: %global version_major 2}
1c37ab
%{!?version_minor: %global version_minor 6}
1c37ab
%{!?scl_name_version: %global scl_name_version %{version_major}%{version_minor}}
1c37ab
%{!?scl: %global scl %{scl_name_prefix}%{scl_name_base}%{scl_name_version}}
1c37ab
1c37ab
# Turn on new layout -- prefix for packages and location
1c37ab
# for config and variable files
1c37ab
# This must be before calling %%scl_package
1c37ab
%{!?nfsmountable: %global nfsmountable 1}
1c37ab
1c37ab
# Define SCL macros
1c37ab
%{?scl_package:%scl_package %scl}
1c37ab
1c37ab
# needed, because we can't use Requires: %{?scl_v8_%{scl_name_base}}
1c37ab
%global scl_v8 v8314
1c37ab
%global scl_v8_prefix %{scl_v8}-
1c37ab
1c37ab
# do not produce empty debuginfo package (https://bugzilla.redhat.com/show_bug.cgi?id=1061439#c2)
1c37ab
%global debug_package %{nil}
1c37ab
1c37ab
# Convert SCL name into uppercase including - to _ conversion
1c37ab
%if 0%{?scl:1}
1c37ab
%global scl_upper %{lua:print(string.upper(string.gsub(rpm.expand("%{scl}"), "-", "_")))}
1c37ab
%endif
1c37ab
1c37ab
Summary:	Package that installs %{scl}
1c37ab
Name:		%{scl}
1c37ab
Version:	2.0
1c37ab
Release:	19%{?dist}
1c37ab
License:	GPLv2+
1c37ab
Group:		Applications/File
1c37ab
# template of man page with RPM macros to be expanded
1c37ab
Source0:	README
1c37ab
# mongodb license
1c37ab
Source1:	LICENSE
1c37ab
Requires:	scl-utils
1c37ab
Requires:	%{scl_v8}
1c37ab
Requires:	%{?scl_prefix}mongodb-server
1c37ab
BuildRequires:	scl-utils-build, help2man
1c37ab
BuildRequires:  rh-java-common-javapackages-tools
1c37ab
BuildRequires:	maven30-scldevel
1c37ab
BuildRequires:	rh-java-common-scldevel
1c37ab
1c37ab
%description
1c37ab
This is the main package for %{scl} Software Collection, which installs
1c37ab
necessary packages to use MongoDB %{version_major}.%{version_minor} server.
1c37ab
Software Collections allow to install more versions of the same package
1c37ab
by using alternative directory structure.
1c37ab
Install this package if you want to use MongoDB %{version_major}.%{version_minor}
1c37ab
server on your system
1c37ab
1c37ab
%package runtime
1c37ab
Summary:	Package that handles %{scl} Software Collection.
1c37ab
Group:		Applications/File
1c37ab
Requires:	scl-utils
1c37ab
Requires:	/usr/bin/scl_source
1c37ab
Requires:	%{scl_v8_prefix}runtime
1c37ab
# Those two java common requires are for build-classpath et. al.
1c37ab
# to work. See RHBZ#1129287
1c37ab
Requires:       %{?scl_prefix_java_common}runtime
1c37ab
Requires:       %{?scl_prefix_java_common}javapackages-tools
1c37ab
Requires(post):	policycoreutils-python, libselinux-utils
1c37ab
1c37ab
%description runtime
1c37ab
Package shipping essential scripts to work with %{scl} Software Collection.
1c37ab
1c37ab
%package build
1c37ab
Summary:	Package shipping basic build configuration
1c37ab
Requires:	scl-utils-build
1c37ab
Requires:	%{name}-scldevel = %{version}
1c37ab
Requires:	%{scl_v8_prefix}scldevel
1c37ab
Requires:	%{scl_prefix}scldevel
1c37ab
Group:		Applications/File
1c37ab
1c37ab
%description build
1c37ab
Package shipping essential configuration macros to build
1c37ab
%scl Software Collection.
1c37ab
1c37ab
%package scldevel
1c37ab
Summary:	Package shipping development files for %{scl}.
1c37ab
Group:		Applications/File
1c37ab
Requires:       %{name}-runtime = %{version}
1c37ab
Requires:       maven30-scldevel
1c37ab
1c37ab
%description scldevel
1c37ab
Development files for %{scl} (useful e.g. for hierarchical collection
1c37ab
building with transitive dependencies).
1c37ab
1c37ab
%prep
1c37ab
%setup -c -T
1c37ab
1c37ab
# java.conf
1c37ab
cat <
1c37ab
# Java configuration file for %{scl} software collection.
1c37ab
JAVA_LIBDIR=%{_javadir}
1c37ab
JNI_LIBDIR=%{_jnidir}
1c37ab
JVM_ROOT=%{_jvmdir}
1c37ab
EOF
1c37ab
1c37ab
# _scl_root is used without leading slash several times
1c37ab
ROOT_NOSLASH="%{?_scl_root}"
1c37ab
export ROOT_NOSLASH=${ROOT_NOSLASH:1}
1c37ab
1c37ab
# XMvn config
1c37ab
cat <<EOF >configuration.xml
1c37ab
1c37ab
<configuration>
1c37ab
  <resolverSettings>
1c37ab
    <metadataRepositories>
1c37ab
      <repository>%{?_scl_root}/usr/share/maven-metadata</repository>
1c37ab
    </metadataRepositories>
1c37ab
    <prefixes>
1c37ab
      <prefix>%{?_scl_root}</prefix>
1c37ab
    </prefixes>
1c37ab
  </resolverSettings>
1c37ab
  <installerSettings>
1c37ab
    <metadataDir>${ROOT_NOSLASH}/usr/share/maven-metadata</metadataDir>
1c37ab
  </installerSettings>
1c37ab
  <repositories>
1c37ab
    <repository>
1c37ab
      <id>resolve-%{scl}</id>
1c37ab
      <type>compound</type>
1c37ab
      <properties>
1c37ab
        <prefix>${ROOT_NOSLASH}</prefix>
1c37ab
        <namespace>%{scl}</namespace>
1c37ab
      </properties>
1c37ab
      <configuration>
1c37ab
        <repositories>
1c37ab
          <repository>base-resolve</repository>
1c37ab
        </repositories>
1c37ab
      </configuration>
1c37ab
    </repository>
1c37ab
    <repository>
1c37ab
      <id>resolve</id>
1c37ab
      <type>compound</type>
1c37ab
      <configuration>
1c37ab
        <repositories>
1c37ab
        
1c37ab
                    1. local repository
1c37ab
                    2. %{scl}
1c37ab
                    3. maven
1c37ab
               collections. -->
1c37ab
          <repository>resolve-local</repository>
1c37ab
          <repository>resolve-%{?scl}</repository>
1c37ab
          <repository>resolve-%{?scl_maven}</repository>
1c37ab
        </repositories>
1c37ab
      </configuration>
1c37ab
    </repository>
1c37ab
    <repository>
1c37ab
      <id>install</id>
1c37ab
      <type>compound</type>
1c37ab
      <properties>
1c37ab
        <prefix>${ROOT_NOSLASH}</prefix>
1c37ab
        <namespace>%{scl}</namespace>
1c37ab
      </properties>
1c37ab
      <configuration>
1c37ab
        <repositories>
1c37ab
          <repository>base-install</repository>
1c37ab
        </repositories>
1c37ab
      </configuration>
1c37ab
    </repository>
1c37ab
  </repositories>
1c37ab
</configuration>
1c37ab
EOF
1c37ab
1c37ab
#=====================#
1c37ab
# Javapackages config #
1c37ab
#=====================#
1c37ab
cat <
1c37ab
{
1c37ab
    "maven.req": {
1c37ab
	"always_generate": [
1c37ab
	    "%{scl}-runtime"
1c37ab
	],
1c37ab
	"java_requires": {
1c37ab
	    "package_name": "java",
1c37ab
	    "always_generate": true,
1c37ab
	    "skip": false
1c37ab
	},
1c37ab
	"java_devel_requires": {
1c37ab
	    "package_name": "java-devel",
1c37ab
	    "always_generate": false,
1c37ab
	    "skip": false
1c37ab
	}
1c37ab
    },
1c37ab
    "javadoc.req": {
1c37ab
	"always_generate": [
1c37ab
	    "%{scl}-runtime"
1c37ab
	]
1c37ab
    }
1c37ab
}
1c37ab
EOF
1c37ab
1c37ab
# This section generates README file from a template and creates man page
1c37ab
# from that file, expanding RPM macros in the template file.
1c37ab
cat <<'EOF' | tee README
1c37ab
%{expand:%(cat %{SOURCE0})}
1c37ab
EOF
1c37ab
1c37ab
# copy the license file so %%files section sees it
1c37ab
cp %{SOURCE1} .
1c37ab
1c37ab
%build
1c37ab
# temporary helper script used by help2man
1c37ab
cat <<\EOF | tee h2m_helper
1c37ab
#!/bin/sh
1c37ab
if [ "$1" = "--version" ]; then
1c37ab
  printf '%%s' "%{?scl_name} %{version} Software Collection"
1c37ab
else
1c37ab
  cat README
1c37ab
fi
1c37ab
EOF
1c37ab
chmod a+x h2m_helper
1c37ab
# generate the man page
1c37ab
help2man -N --section 7 ./h2m_helper -o %{?scl_name}.7
1c37ab
1c37ab
%install
1c37ab
%{?scl_install}
1c37ab
1c37ab
# create enable scriptlet that sets correct environment for collection
1c37ab
cat << EOF | tee -a %{buildroot}%{?_scl_scripts}/enable
1c37ab
. scl_source enable %{scl_v8} %{scl_java_common}
1c37ab
# For binaries
1c37ab
export PATH="%{_bindir}\${PATH:+:\${PATH}}"
1c37ab
# For header files
1c37ab
export CPATH="%{_includedir}\${CPATH:+:\${CPATH}}"
1c37ab
# For libraries during build
1c37ab
export LIBRARY_PATH="%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}"
1c37ab
# For libraries during linking
1c37ab
export LD_LIBRARY_PATH="%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}"
1c37ab
# For man pages; empty field makes man to consider also standard path
1c37ab
export MANPATH="%{_mandir}:\${MANPATH}"
1c37ab
# For Java Packages Tools to locate java.conf
1c37ab
export JAVACONFDIRS="%{_sysconfdir}/java:\${JAVACONFDIRS:-/etc/java}"
1c37ab
# For XMvn to locate its configuration file(s)
1c37ab
export XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:\${XDG_CONFIG_DIRS:-/etc/xdg}"
1c37ab
# For systemtap
1c37ab
export XDG_DATA_DIRS="%{_datadir}\${XDG_DATA_DIRS:+:\${XDG_DATA_DIRS}}"
1c37ab
# For pkg-config
1c37ab
export PKG_CONFIG_PATH="%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}"
1c37ab
# For Java RPM generators
1c37ab
export PYTHONPATH="%{_scl_root}%{python_sitelib}\${PYTHONPATH:+:}\${PYTHONPATH:-}"
1c37ab
EOF
1c37ab
1c37ab
# generate service-environment file for mongo[ds] configuration
1c37ab
cat >> %{buildroot}%{_scl_scripts}/service-environment << EOF
1c37ab
# Services are started in a fresh environment without any influence of user's
1c37ab
# environment (like environment variable values). As a consequence,
1c37ab
# information of all enabled collections will be lost during service start up.
1c37ab
# If user needs to run a service under any software collection enabled, this
1c37ab
# collection has to be written into %{scl_upper}_SCLS_ENABLED variable in
1c37ab
# /opt/rh/sclname/service-environment.
1c37ab
%{scl_upper}_SCLS_ENABLED='%{scl}'
1c37ab
EOF
1c37ab
1c37ab
install -d -m 755           %{buildroot}%{_sysconfdir}/java
1c37ab
install -p -m 644 java.conf %{buildroot}%{_sysconfdir}/java/
1c37ab
install -p -m 644 javapackages-config.json %{buildroot}%{_sysconfdir}/java/
1c37ab
1c37ab
install -d -m 755                   %{buildroot}%{_sysconfdir}/xdg/xmvn
1c37ab
install -p -m 644 configuration.xml %{buildroot}%{_sysconfdir}/xdg/xmvn/
1c37ab
1c37ab
# Create java/maven directories so that they'll get properly owned.
1c37ab
# These are listed in the scl_files macro. See also: RHBZ#1057169
1c37ab
install -d -m 755 %{buildroot}%{_javadir}
1c37ab
install -d -m 755 %{buildroot}%{_prefix}/lib/java
1c37ab
install -d -m 755 %{buildroot}%{_javadocdir}
1c37ab
install -d -m 755 %{buildroot}%{_mavenpomdir}
1c37ab
install -d -m 755 %{buildroot}%{_datadir}/maven-effective-poms
1c37ab
install -d -m 755 %{buildroot}%{_mavendepmapfragdir}
1c37ab
1c37ab
# install generated man page
1c37ab
install -d -m 755               %{buildroot}%{_mandir}/man7
1c37ab
install -p -m 644 %{?scl_name}.7 %{buildroot}%{_mandir}/man7/
1c37ab
1c37ab
# create directory for license
1c37ab
install -d -m 755 %{buildroot}%{_licensedir}
1c37ab
1c37ab
# generate rpm macros file for depended collections
1c37ab
cat << EOF | tee -a %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
1c37ab
%%scl_%{scl_name_base} %{?scl}
1c37ab
%%scl_prefix_%{scl_name_base} %{?scl_prefix}
1c37ab
EOF
1c37ab
1c37ab
1c37ab
%post runtime
1c37ab
# Simple copy of context from system root to SCL root.
1c37ab
# In case new version needs some additional rules or context definition,
1c37ab
# it needs to be solved by changing selinux-policy.
1c37ab
semanage fcontext -a -e / %{?_scl_root} >/dev/null 2>&1 || :
1c37ab
semanage fcontext -a -e %{_root_sysconfdir} %{_sysconfdir} >/dev/null 2>&1 || :
1c37ab
semanage fcontext -a -e %{_root_localstatedir} %{_localstatedir} >/dev/null 2>&1 || :
1c37ab
selinuxenabled && load_policy || :
1c37ab
restorecon -R %{?_scl_root} >/dev/null 2>&1 || :
1c37ab
restorecon -R %{_sysconfdir} >/dev/null 2>&1 || :
1c37ab
restorecon -R %{_localstatedir} >/dev/null 2>&1 || :
1c37ab
1c37ab
1c37ab
%files
1c37ab
1c37ab
%if 0%{?rhel} >= 7 || 0%{?fedora} >= 15
1c37ab
%files runtime -f filesystem
1c37ab
%license LICENSE
1c37ab
%dir %attr(0755, root, root) %{_sysconfdir}/java/
1c37ab
%dir %attr(0755, root, root) %{_licensedir}/
1c37ab
%dir %attr(0755, root, root) %{_javadir}
1c37ab
%dir %attr(0755, root, root) %{_mavenpomdir}
1c37ab
%else
1c37ab
%files runtime
1c37ab
%doc LICENSE
1c37ab
%endif
1c37ab
%doc README
1c37ab
%{?scl_files}
1c37ab
%config(noreplace) %{_scl_scripts}/service-environment
1c37ab
%config(noreplace) %{_sysconfdir}/java/java.conf
1c37ab
%config(noreplace) %{_sysconfdir}/xdg/xmvn/configuration.xml
1c37ab
%config(noreplace) %{_sysconfdir}/java/javapackages-config.json
1c37ab
%{_mandir}/man7/%{?scl_name}.*
1c37ab
1c37ab
%files build
1c37ab
%doc LICENSE
1c37ab
%{_root_sysconfdir}/rpm/macros.%{scl}-config
1c37ab
1c37ab
%files scldevel
1c37ab
%doc LICENSE
1c37ab
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
1c37ab
1c37ab
%changelog
1c37ab
* Thu Mar 19 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-19
1c37ab
- Fixed java and maven directory ownership
1c37ab
1c37ab
* Wed Mar 18 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-18
1c37ab
- Use license instead of doc (used by mongodb)
1c37ab
- Fixed rhel7 runtime {_licensedir} directory ownership
1c37ab
1c37ab
* Mon Mar 2 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-17
1c37ab
- Fixed rhel7 runtime {_sysconfdir}/java/ directory ownership
1c37ab
1c37ab
* Fri Feb 27 2015 Honza Horak <hhorak@redhat.com> - 2.0-16
1c37ab
- Remove NFS register feature for questionable usage for DBs
1c37ab
1c37ab
* Mon Jan 26 2015 Honza Horak <hhorak@redhat.com> - 2.0-15
1c37ab
- Fix upper format of scl name
1c37ab
1c37ab
* Mon Jan 26 2015 Honza Horak <hhorak@redhat.com> - 2.0-14
1c37ab
- Create correct directory under register.content
1c37ab
1c37ab
* Mon Jan 26 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-13
1c37ab
- Fixed runtime subpackage file section
1c37ab
1c37ab
* Mon Jan 26 2015 Honza Horak <hhorak@redhat.com> - 2.0-12
1c37ab
- Do not set selinux context  scl root during scl register
1c37ab
1c37ab
* Mon Jan 26 2015 Honza Horak <hhorak@redhat.com> - 2.0-11
1c37ab
- Use cat for README expansion, rather than include macro
1c37ab
1c37ab
* Fri Jan 23 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-10
1c37ab
- Added service-environment into mongodb package
1c37ab
- Fixed runtime directory ownership
1c37ab
1c37ab
* Thu Jan 22 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-9
1c37ab
- Merged origin/rhscl-2.0-rh-mongodb26-rhel-7 (2.0-9)
1c37ab
1c37ab
* Wed Jan 21 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-8
1c37ab
- Moved SCL python27 dependency into rh-mongodb26-mongodb
1c37ab
1c37ab
* Tue Jan 20 2015 Marek Skalicky <mskalick@redhat.com> - 2.0-7
1c37ab
- Added SCL python27 dependency
1c37ab
1c37ab
* Sat Jan 17 2015 Honza Horak <hhorak@redhat.com> - 2.0-6
1c37ab
- Initial register implementation
1c37ab
1c37ab
* Wed Jan 14 2015 Severin Gehwolf <sgehwolf@redhat.com> - 2.0-5
1c37ab
- Update java/maven configuration for thermostat consumption.
1c37ab
1c37ab
* Tue Jan 13 2015 Honza Horak <hhorak@redhat.com> - 2.0-4
1c37ab
- Implement some new scl-utils features and use more scl macros
1c37ab
1c37ab
* Mon Nov 24 2014 Marek Skalicky <mskalic@redhat.com> 2.0-3
1c37ab
- Modified files section to correctly uninstall SCL root
1c37ab
1c37ab
* Tue Nov 18 2014 Marek Skalicky <mskalic@redhat.com> 2.0-2
1c37ab
- Changed and cleaned up requirements
1c37ab
1c37ab
* Fri Nov 14 2014 Marek Skalicky <mskalic@redhat.com> 2.0-1
1c37ab
- added SCL v8 dependency
1c37ab
- changed version for SCL 2.0
1c37ab
1c37ab
* Fri Nov 07 2014 Marek Skalicky <mskalic@redhat.com> 1-2
1c37ab
- removed SCL v8 dependency
1c37ab
1c37ab
* Thu Oct 30 2014 Marek Skalicky <mskalic@redhat.com> 1-1
1c37ab
- initial packaging (based on mongodb24 SCL)
1c37ab