?

Log in

Previous Entry | Next Entry

SCL scldevel sub-packages

Some time ago was released RHSCL-1.1. At this point we had more collections with more dependencies and we were looking for something like shared group of packages among collections. For example there are Ruby&Rails collection and it might need node.js for processing javascripts or mongodb can use v8 for their work. The v8 was needed by more collections, it didn't make any sense to "bundle" it into all of them. The v8 collection was created as separated thing and other collections could use it. There was slight risk that node.js might want newer version of v8 soon, but still possible maintenance of two v8 versions looked better than start bundling v8 into three collections right now.

There exists one v8 collection called v8314. Rpmbuild must be aware about existence of some v8 macros, but v8314-build can't be installed, because then all prefixes of mongodb would be also v8. The build sub-package was split into two parts and it's highly recommended to create -build and -scldevel for all new meta-packages.

The build sub-package contains just:
cat /etc/rpm/macros.v8314-config
%scl v8314
%scl_vendor rh


The scldevel sub-package contain macros, which are needed also for build of mongodb, when looking for v8 during build:
cat /etc/rpm/macros.v8-scldevel
%scl_v8 v8314
%scl_prefix_v8 v8314-


Okay, now just define v8314 in mongodb24 specfile and you can build it with support of v8. The solution is far from perfect, but it works.

%{!?scl_name_base:%global scl_name_base mongodb}
%{!?scl_name_version:%global scl_name_version 24}
# particularly useful for mock
%{!?scl:%global scl %{scl_name_base}%{scl_name_version}}
%scl_package %scl
# define version of v8, we want to use. Requires cant' be defined as %{?scl_v8_%{scl_name_base}}, because it would append mongodb.
%global scl_v8 v8314
%{?scl:%global scl_v8_prefix %{scl_v8}-}
# do not produce empty debuginfo package
%global debug_package %{nil}

Summary: Package that installs %scl
Name: %scl_name
Version: 1.1
Release: 2%{?dist}
Requires: %{scl_v8}
Requires: %{scl_prefix}mongodb-server
BuildRequires: scl-utils-build, help2man
...
%package runtime
Summary: Package that handles %scl Software Collection.
Group: Applications/File
Requires: scl-utils
Requires: %{?scl_v8_prefix}runtime
Requires(post): policycoreutils-python, libselinux-utils
...
%install
# enable script needs to source v8 collection defined at the start of this specfile
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
export PATH=%{_bindir}\${PATH:+:\${PATH}}
...
export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
. scl_source enable %{scl_v8}
EOF
#create scldevel
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel << EOF
%%scl_%{scl_name_base} %{scl}
%%scl_prefix_%{scl_name_base} %{scl_prefix}
%%scl_v8_%{scl_name_base} %{scl_v8}
EOF
...

The scl_source macro will automatically enable v8, when you enable mongodb, because it's hard requirement of mongodb. Otherwise users would have to enable both collections manually. In scldevel is needed only definition of name of v8 collection.