Blame SPECS/mongodb24.spec

2b56f3
%{!?scl_name_base:%global scl_name_base mongodb}
2b56f3
%{!?scl_name_version:%global scl_name_version 24}
2b56f3
# particularly useful for mock
2b56f3
%{!?scl:%global scl %{scl_name_base}%{scl_name_version}}
2b56f3
%scl_package %scl
2b56f3
# needed, because we can't use Requires: %{?scl_v8_%{scl_name_base}}
2b56f3
%global scl_v8 v8314
2b56f3
# do not produce empty debuginfo package (https://bugzilla.redhat.com/show_bug.cgi?id=1061439#c2)
2b56f3
%global debug_package %{nil}
2b56f3
2b56f3
Summary: Package that installs %scl
2b56f3
Name: %scl_name
2b56f3
# should match the RHSCL version
2b56f3
Version: 1.1
2b56f3
Release: 5%{?dist}
2b56f3
License: GPLv2+
2b56f3
Group: Applications/File
2b56f3
Source0: macros.mongodb24
2b56f3
Source1: mongodb24-javapackages-provides-wrapper
2b56f3
Source2: mongodb24-javapackages-requires-wrapper
2b56f3
# template of man page with RPM macros to be expanded
2b56f3
Source3: README
2b56f3
# mongodb license
2b56f3
Source4: LICENSE
2b56f3
Requires: scl-utils
2b56f3
Requires: %{scl_prefix}mongodb-server
2b56f3
BuildRequires: scl-utils-build, help2man
2b56f3
2b56f3
%description
2b56f3
This is the main package for %scl Software Collection, which installs
2b56f3
necessary packages to use MongoDB 2.4 server. Software Collections allow
2b56f3
to install more versions of the same package by using alternative
2b56f3
directory structure.
2b56f3
Install this package if you want to use MongoDB 2.4 server on your system
2b56f3
2b56f3
%package runtime
2b56f3
Summary: Package that handles %scl Software Collection.
2b56f3
Group: Applications/File
2b56f3
Requires: scl-utils
2b56f3
# e.g. scl-utils 20120927-8.el6_5
2b56f3
Requires: /usr/bin/scl_source
2b56f3
Requires(post): policycoreutils-python, libselinux-utils
2b56f3
2b56f3
%description runtime
2b56f3
Package shipping essential scripts to work with %scl Software Collection.
2b56f3
2b56f3
%package build
2b56f3
Summary: Package shipping basic build configuration
2b56f3
# xmvn_config/java_config
2b56f3
Requires: %{name}-runtime = %{version}
2b56f3
Requires: scl-utils-build
2b56f3
Group: Applications/File
2b56f3
2b56f3
%description build
2b56f3
Package shipping essential configuration macros to build
2b56f3
%scl Software Collection.
2b56f3
2b56f3
%package scldevel
2b56f3
Summary: Package shipping development files for %scl.
2b56f3
Group: Applications/File
2b56f3
2b56f3
%description scldevel
2b56f3
Development files for %scl (useful e.g. for hierarchical collection
2b56f3
building with transitive dependencies).
2b56f3
2b56f3
%prep
2b56f3
%setup -c -T
2b56f3
# java.conf
2b56f3
cat <<EOF >java.conf
2b56f3
# Java configuration file for %{scl} software collection.
2b56f3
JAVA_LIBDIR=%{_javadir}
2b56f3
JNI_LIBDIR=%{_jnidir}
2b56f3
JVM_ROOT=%{_jvmdir}
2b56f3
EOF
2b56f3
# XMvn config
2b56f3
cat <<EOF >configuration.xml
2b56f3
2b56f3
<configuration>
2b56f3
  <resolverSettings>
2b56f3
    <prefixes>
2b56f3
      <prefix>/opt/rh/%{scl}/root</prefix>
2b56f3
    </prefixes>
2b56f3
  </resolverSettings>
2b56f3
  <installerSettings>
2b56f3
    <metadataDir>opt/rh/%{scl}/root/usr/share/maven-fragments</metadataDir>
2b56f3
  </installerSettings>
2b56f3
  <repositories>
2b56f3
    <repository>
2b56f3
      <id>%{scl}-resolve</id>
2b56f3
      <type>compound</type>
2b56f3
      <properties>
2b56f3
        <prefix>opt/rh/%{scl}/root</prefix>
2b56f3
        <namespace>%{scl}</namespace>
2b56f3
      </properties>
2b56f3
      <configuration>
2b56f3
        <repositories>
2b56f3
          <repository>base-resolve</repository>
2b56f3
        </repositories>
2b56f3
      </configuration>
2b56f3
    </repository>
2b56f3
    <repository>
2b56f3
      <id>resolve-system</id>
2b56f3
      <type>compound</type>
2b56f3
      <properties>
2b56f3
        <prefix>/</prefix>
2b56f3
      </properties>
2b56f3
      <configuration>
2b56f3
        <repositories>
2b56f3
          <repository>%{scl}-resolve</repository>
2b56f3
          <repository>base-resolve</repository>
2b56f3
        </repositories>
2b56f3
      </configuration>
2b56f3
    </repository>
2b56f3
    <repository>
2b56f3
      <id>install</id>
2b56f3
      <type>compound</type>
2b56f3
      <properties>
2b56f3
        <prefix>opt/rh/%{scl}/root</prefix>
2b56f3
        <namespace>%{scl}</namespace>
2b56f3
      </properties>
2b56f3
      <configuration>
2b56f3
        <repositories>
2b56f3
          <repository>base-install</repository>
2b56f3
        </repositories>
2b56f3
      </configuration>
2b56f3
    </repository>
2b56f3
    <repository>
2b56f3
      <id>install-raw-pom</id>
2b56f3
      <type>compound</type>
2b56f3
      <properties>
2b56f3
        <prefix>opt/rh/%{scl}/root</prefix>
2b56f3
        <namespace>%{scl}</namespace>
2b56f3
      </properties>
2b56f3
      <configuration>
2b56f3
        <repositories>
2b56f3
          <repository>base-raw-pom</repository>
2b56f3
        </repositories>
2b56f3
      </configuration>
2b56f3
    </repository>
2b56f3
    <repository>
2b56f3
      <id>install-effective-pom</id>
2b56f3
      <type>compound</type>
2b56f3
      <properties>
2b56f3
        <prefix>opt/rh/%{scl}/root</prefix>
2b56f3
        <namespace>%{scl}</namespace>
2b56f3
      </properties>
2b56f3
      <configuration>
2b56f3
        <repositories>
2b56f3
          <repository>base-effective-pom</repository>
2b56f3
        </repositories>
2b56f3
      </configuration>
2b56f3
    </repository>
2b56f3
  </repositories>
2b56f3
</configuration>
2b56f3
EOF
2b56f3
2b56f3
cat > README <<\EOF
2b56f3
%{expand:%(cat %{SOURCE3})}
2b56f3
EOF
2b56f3
# copy the license file so %%files section sees it
2b56f3
cp %{SOURCE4} .
2b56f3
2b56f3
%build
2b56f3
# temporary helper script used by help2man
2b56f3
cat > h2m_helper <<\EOF
2b56f3
#!/bin/sh
2b56f3
if [ "$1" = "--version" ]; then
2b56f3
  printf '%%s' "%{scl_name} %{version} Software Collection"
2b56f3
else
2b56f3
  cat README
2b56f3
fi
2b56f3
EOF
2b56f3
chmod a+x h2m_helper
2b56f3
# generate the man page
2b56f3
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7
2b56f3
2b56f3
%install
2b56f3
mkdir -p %{buildroot}%{_scl_scripts}/root
2b56f3
# During the build of this package, we don't know which architecture it is
2b56f3
# going to be used on, so if we build on 64-bit system and use it on 32-bit,
2b56f3
# the %{_libdir} would stay expanded to '.../lib64'. This way we determine
2b56f3
# architecture everytime the 'scl enable ...' is run and set the
2b56f3
# LD_LIBRARY_PATH accordingly
2b56f3
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
2b56f3
export PATH=%{_bindir}\${PATH:+:\${PATH}}
2b56f3
export LIBRARY_PATH=%{_libdir}\${LIBRARY_PATH:+:\${LIBRARY_PATH}}
2b56f3
export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
2b56f3
export MANPATH=%{_mandir}:\${MANPATH}
2b56f3
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}
2b56f3
export CPATH=%{_includedir}\${CPATH:+:\${CPATH}}
2b56f3
# Needed by Java Packages Tools to locate java.conf
2b56f3
export JAVACONFDIRS="%{_sysconfdir}/java:\${JAVACONFDIRS:-/etc/java}"
2b56f3
# Required by XMvn to locate its configuration file(s)
2b56f3
export XDG_CONFIG_DIRS="%{_sysconfdir}/xdg:\${XDG_CONFIG_DIRS:-/etc/xdg}"
2b56f3
# Not really needed by anything for now, but kept for consistency with
2b56f3
# XDG_CONFIG_DIRS.
2b56f3
export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
2b56f3
. scl_source enable %{scl_v8}
2b56f3
EOF
2b56f3
cat >> %{buildroot}%{_scl_scripts}/service-environment << EOF
2b56f3
# Services are started in a fresh environment without any influence of user's
2b56f3
# environment (like environment variable values). As a consequence,
2b56f3
# information of all enabled collections will be lost during service start up.
2b56f3
# If user needs to run a service under any software collection enabled, this
2b56f3
# collection has to be written into %{scl}_SCLS_ENABLED variable in
2b56f3
# /opt/rh/sclname/service-environment.
2b56f3
$(printf '%%s' '%{scl}' | tr '[:lower:][:space:]' '[:upper:]_')_SCLS_ENABLED='%{scl}'
2b56f3
EOF
2b56f3
2b56f3
install -d -m 755           %{buildroot}%{_sysconfdir}/java
2b56f3
install -p -m 644 java.conf %{buildroot}%{_sysconfdir}/java/
2b56f3
2b56f3
install -d -m 755                   %{buildroot}%{_sysconfdir}/xdg/xmvn
2b56f3
install -p -m 644 configuration.xml %{buildroot}%{_sysconfdir}/xdg/xmvn/
2b56f3
2b56f3
# install magic for java mvn provides/requires generators
2b56f3
install -Dpm0644 %{SOURCE0} %{buildroot}%{_root_sysconfdir}/rpm/macros.%{name}
2b56f3
install -Dpm0755 %{SOURCE1} %{buildroot}%{_rpmconfigdir}/%{name}-javapackages-provides-wrapper
2b56f3
install -Dpm0755 %{SOURCE2} %{buildroot}%{_rpmconfigdir}/%{name}-javapackages-requires-wrapper
2b56f3
2b56f3
# install generated man page
2b56f3
install -d -m 755               %{buildroot}%{_mandir}/man7
2b56f3
install -p -m 644 %{scl_name}.7 %{buildroot}%{_mandir}/man7/
2b56f3
2b56f3
%scl_install
2b56f3
2b56f3
# scldevel garbage
2b56f3
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel << EOF
2b56f3
%%scl_%{scl_name_base} %{scl}
2b56f3
%%scl_prefix_%{scl_name_base} %{scl_prefix}
2b56f3
%%scl_v8_%{scl_name_base} %{scl_v8}
2b56f3
EOF
2b56f3
2b56f3
%post runtime
2b56f3
# Simple copy of context from system root to DSC root.
2b56f3
# In case new version needs some additional rules or context definition,
2b56f3
# it needs to be solved.
2b56f3
semanage fcontext -a -e /var/log/mongodb /var/log/%{scl_prefix}mongodb >/dev/null 2>&1 || :
2b56f3
semanage fcontext -a -e /etc/rc.d/init.d/mongod /etc/rc.d/init.d/%{scl_prefix}mongodb >/dev/null 2>&1 || :
2b56f3
semanage fcontext -a -e /etc/rc.d/init.d/mongod /etc/rc.d/init.d/%{scl_prefix}mongodb-shard >/dev/null 2>&1 || :
2b56f3
semanage fcontext -a -e / %{_scl_root} >/dev/null 2>&1 || :
2b56f3
selinuxenabled && load_policy >/dev/null 2>&1 || :
2b56f3
restorecon -R %{_scl_root} >/dev/null 2>&1 || :
2b56f3
restorecon -R /var/log/%{scl_prefix}mongodb >/dev/null 2>&1 || :
2b56f3
restorecon /etc/rc.d/init.d/%{scl_prefix}mongod >/dev/null 2>&1 || :
2b56f3
2b56f3
%files
2b56f3
2b56f3
%files runtime
2b56f3
%doc README LICENSE
2b56f3
%scl_files
2b56f3
%config(noreplace) %{_scl_scripts}/service-environment
2b56f3
%config(noreplace) %{_sysconfdir}/java/java.conf
2b56f3
%config(noreplace) %{_sysconfdir}/xdg/xmvn/configuration.xml
2b56f3
%{_mandir}/man7/%{scl_name}.*
2b56f3
2b56f3
%files build
2b56f3
%{_root_sysconfdir}/rpm/macros.%{scl}-config
2b56f3
%{_root_sysconfdir}/rpm/macros.%{name}
2b56f3
%{_rpmconfigdir}/%{name}*
2b56f3
2b56f3
%files scldevel
2b56f3
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
2b56f3
2b56f3
%changelog
2b56f3
* Mon Mar 31 2014 Honza Horak <hhorak@redhat.com> - 1.1-5
2b56f3
- Fix path to init scripts
2b56f3
  Related: #1057097
2b56f3
2b56f3
* Fri Mar 28 2014 Jan Pacner <jpacner@redhat.com> - 1.1-4
2b56f3
- Resolves: #1075688 (metapackage shouldnt depend on another metapackage)
2b56f3
- Resolves: #1075025 (Leftovers files after mongodb packages removal)
2b56f3
2b56f3
* Fri Feb 21 2014 Jan Pacner <jpacner@redhat.com> - 1.1-3
2b56f3
- Related: #1054644 (depend on newer scl-utils; use different approach due to
2b56f3
  mess in scl-utils versioning)
2b56f3
2b56f3
* Thu Feb 13 2014 Honza Horak <hhorak@redhat.com> - 1.1-2
2b56f3
- Revert change in the exporting paths
2b56f3
  Related: #1057491
2b56f3
2b56f3
* Tue Feb 11 2014 Jan Pacner <jpacner@redhat.com> - 1.1-1
2b56f3
- Resolves: #1061449 (meta pkg should include LICENSE, README and man page - all
2b56f3
  related to meta pkg itself)
2b56f3
2b56f3
* Fri Jan 31 2014 Jan Pacner <jpacner@redhat.com> - 1-15
2b56f3
- Related: #1055555 (add -scldevel subpackage for shipped build-requires files;
2b56f3
  fix prefix in Requires:)
2b56f3
2b56f3
* Fri Jan 31 2014 Jan Pacner <jpacner@redhat.com> - 1-14
2b56f3
- Related: #1055555 (add -scldevel subpackage for shipped build-requires files;
2b56f3
  -runtime requires only v8xxx-runtime)
2b56f3
2b56f3
* Fri Jan 31 2014 Jan Pacner <jpacner@redhat.com> - 1-13
2b56f3
- Resolves: #1057491 (-build needs to depend on scl-utils-build)
2b56f3
2b56f3
* Mon Jan 20 2014 Jan Pacner <jpacner@redhat.com>
2b56f3
- Resolves: #1055555 (add -scldevel subpackage for shipped build-requires
2b56f3
  garbage)
2b56f3
2b56f3
* Fri Jan 17 2014 Jan Pacner <jpacner@redhat.com> - 1-10
2b56f3
- Resolves: RHBZ#1054644 (mongodb24-runtime needs to depend on newer scl-utils)
2b56f3
2b56f3
* Mon Dec 23 2013 Severin Gehwolf <sgehwolf@redhat.com> - 1-9
2b56f3
- Fix osgi() Requires/Provides generation.
2b56f3
- Resolves: RHBZ#1046029
2b56f3
- Fix javadoc requires/provides generation
2b56f3
- Resolves: RHBZ#1046032
2b56f3
2b56f3
* Wed Nov 27 2013 Honza Horak <hhorak@redhat.com> - 1-8
2b56f3
- Added dependency on v8314-runtime
2b56f3
2b56f3
* Tue Nov 26 2013 Severin Gehwolf <sgehwolf@redhat.com> - 1-7
2b56f3
- Revert temporary fix for thermostat1-thermostat build.
2b56f3
2b56f3
* Tue Nov 26 2013 Severin Gehwolf <sgehwolf@redhat.com> - 1-6
2b56f3
- Temporarily unbreak the thermostat1-thermostat build.
2b56f3
2b56f3
* Tue Nov 26 2013 Jan Pacner <jpacner@redhat.com> - 1-5
2b56f3
- rename system-wide v8 macro
2b56f3
2b56f3
* Thu Nov 21 2013 Jan Pacner <jpacner@redhat.com> - 1-4
2b56f3
- fix {scl}_SCLS_ENABLED variable
2b56f3
- add dependency on external v8 SCL
2b56f3
2b56f3
* Wed Nov 13 2013 Severin Gehwolf <sgehwolf@redhat.com> 1-3
2b56f3
- Add java mvn provides and requires generator wrapper.
2b56f3
2b56f3
* Thu Nov 07 2013 Severin Gehwolf <sgehwolf@redhat.com> 1-2
2b56f3
- Add java/xmvn config to runtime subpackage.
2b56f3
- Require runtime in build package so as to have java/xmvn
2b56f3
  configs available.
2b56f3
2b56f3
* Mon Aug 12 2013 Honza Horak <hhorak@redhat.com> 1-1
2b56f3
- initial packaging
2b56f3