How to add a new package to RHSCL perl516 for RHEL

The Red Hat Software Collection (RHSCL) perl516 contains only a part of the packages which are packaged in RHEL or Fedora. It is not hard to add a new package to RHSCL. The following steps show how to convert a conventional spec file into a Software Collection spec file. The SCL spec file can then be used in both the conventional package and the Software Collection. We will use perl-Pod-Perldoc is used for an example.

Before you start, spec2scl rpm has to be installed.

Everything you need to grow your career.

With your free Red Hat Developer program membership, unlock our library of cheat sheets and ebooks on next-generation application development.

SIGN UP

Run the following command to convert rpm specfile to be SCL ready:

spec2scl perl-Pod-Perldoc.spec < perl-Pod-Perldoc.spec.scl

Then the list of dependencies have to be checked:

    • Remove %{scl_prefix} from all non-perl BuildRequires/Requires.
@@ -20,3 +20,3 @@
# Pod::Perldoc::ToMan executes roff
-BuildRequires: %{?scl_prefix}groff-base
+BuildRequires: groff-base
BuildRequires: %{?scl_prefix}perl(Carp)
@@ -56,3 +56,3 @@
# Pod::Perldoc::ToMan executes roff
-Requires: %{?scl_prefix}groff-base
+Requires: groff-base
Requires: %{?scl_prefix}perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
    • Use conditions if required is provided by different packages on RHEL 6 or 7 Beta.
@@ -20,3 +20,7 @@
# Pod::Perldoc::ToMan executes roff
+%if 0%{?rhel} && 0%{?rhel} < 7
+BuildRequires: groff
+%else
BuildRequires: groff-base
+%endif
BuildRequires: %{?scl_prefix}perl(Carp)
@@ -56,3 +60,7 @@
# Pod::Perldoc::ToMan executes roff
+%if 0%{?rhel} && 0%{?rhel} < 7
+Requires: groff
+%else
Requires: groff-base
+%endif
Requires: %{?scl_prefix}perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
    • Update getting of value for Requirement: perl(MODULE_COMPAT_<version>).
@@ -65,3 +65,3 @@
%endif
-Requires: %{?scl_prefix}perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
+Requires: %{?scl_prefix}perl(:MODULE_COMPAT_%(%{?scl:scl enable %{scl} '}eval "`perl -V:version`"; echo $version%{?scl:'}))
Requires: %{?scl_prefix}perl(Encode)
    • If there are any filters of Provides or Requires valid for rpm >= 4.9, then also add a filter which works for rpm < 4.9 to be able to build properly for rpm on RHEL 6.
@@ -82,6 +82,11 @@
# Remove underspecified dependencies
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\(Pod::Man|Pod::Simple::XMLOutStream|Pod::Simple::RTF\)\s*$

+%if ( 0%{?rhel} &amp;&amp; 0%{?rhel} &lt; 7 )
+%filter_from_requires /perl((Pod::Man|Pod::Simple::XMLOutStream|Pod::Simple::RTF))s*$/d
+%filter_setup
+%endif
+
%description
perldoc looks up a piece of documentation in .pod format that is embedded
in the perl installation tree or in a perl script, and displays it via

NOTE:

      The macro

%{perl_default_filter}

      works for both RHEL6 and 7 Beta.

    • Increase Release and update the Changelog.
@@ -6,5 +6,5 @@
# let's overwrite the module from perl.srpm
Version: %(echo '%{cpan_version}' | sed 's/_/./')
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Look up Perl documentation in Pod format
License: GPL+ or Artistic
@@ -125,4 +125,7 @@

%changelog
+* Thu Mar 27 2014 Jitka Plesnikova &amp;lt;jplesnik@redhat.com&amp;gt; - 3.21-2
+- Initial import to SCL
+
* Mon Jan 06 2014 Petr Pisar &amp;lt;ppisar@redhat.com&amp;gt; - 3.21-1
- 3.21 bump

All spec files used in this post are placed here.

Now, if you find RHSCL is missing your build-requires and run-requires, you should be able to build a new rpm.

More information about RHSCL can be found at Software Collections Guide.

Share