Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

How to Create Dependent Software Collections

September 4, 2014
Marcela Maslanova
Related topics:
Linux
Related products:
Red Hat Enterprise Linux

    Are you fed up by enabling multiple collections, which are dependent on themselves? We were. For example, thermostat needs mongo, mongo needs v8.  Enabling them looks like:

    scl enable thermostat1 mongodb24 v8314 bash
    

    There another reason to use dependent collections:  when you are missing packages in a RHSCL collection and you want to add them. Obviously, we don't plan to package everything because some packages have high maintenance costs or they are changing too fast even for two or three years of support.

    Dependent collections have been available since RHSCL 1.1 and are supported by scl-utils-20131017 and higher.

    Where are dependent collections are useful

    Let's say you are using the ruby193 collection and would like to use additional gems. Some users are doing a rebuild of the existing ruby193 collection and mixing their gems with those provided by ruby193. It might lead to a problem, however, especially if RHSCL adds the same package as you previously added. It already has happened to the passenger gem where the user's version was overridden by RHSCL passenger and they were quite surprised by the new version. The correct solution is to package additional gems as a dependent collection. Another benefit would be portability to a new version of a ruby collection, so you could use your dependent collection even with ruby210 (or whatever will be in the next RHSCL Ruby release). It does work for passenger - see the passenger testing collection on the upstream pages.

    How to create dependent collection

    Now let's show you how to write specfiles to create a dependent collection. Let's look at the best existing example of dependent collections:  Ruby on Rails (ror40) and Ruby (ruby200) as two collections and made them dependent.

    Into ruby200.spec add scldevel subpackage:

    %package scldevel
    Summary: Package shipping development files for %scl
    %description scldevel
    Package shipping development files, especially usefull for development of
    packages depending on %scl Software Collection.
    ...
    cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel << EOF
    %%scl_%{scl_name_base} %{scl}
    %%scl_prefix_%{scl_name_base} %{scl_prefix}
    EOF
    ...
    %files scldevel
    %{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
    

    This code will create file installed into /etc/rpm/macros.ruby-scldevel. It contains basic macros needed for dependent collection.

    %scl_ruby ruby200
    %scl_prefix_ruby ruby200-
    

    You can access the whole source rpm package on upstream page and look at the whole specfile. No git yet, we are sorry.

    How can you enable ruby200 collection as dependent collection? Just add scl_source macro into another specfile e.g. ror40 (ruby on rails). The dependent collection will be also automatically enabled, you will need to run only scl enable ror40 and ruby200 will be enabled automatically. You can enable more collections than one. Let's look at example of ror40 specfile:

    # Fallback to ruby200 in case ruby200-scldevel is not available.
    %{!?scl_ruby:%global scl_ruby ruby200}
    # Must be defined for enabling ruby200 collection because standard       
    # scl_prefix macro will contain ror40 in this specfile.
     %{!?scl_prefix_ruby:%global scl_prefix_ruby %{scl_ruby}-}
    ...
    # Don't forget to add ruby200-scldevel into build requirements of package
     BuildRequires: %{scl_prefix_ruby}scldevel
    ...
    # Install section calls scl_source for enabling ruby200 collection in ror40 enable scriptlet.
    %install
    %scl_install
    cat >> %{buildroot}%{_scl_scripts}/enable << EOF
    export PATH=%{_bindir}${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=%{_libdir}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    export MANPATH=%{_mandir}:${MANPATH}
    export PKG_CONFIG_PATH=%{_libdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
    export GEM_PATH=%{gem_dir}:${GEM_PATH:+${GEM_PATH}}${GEM_PATH:-`scl enable %{scl_ruby} -- ruby -e "print Gem.path.join(':')"`}
    
    . scl_source enable %{scl_ruby}
    EOF
    

    The source rpm is again on the upstream page. You can access complete collections on softwarecollections.org for more experiments.

    Where to put scl_source

    The dependency between Ruby and RoR was obvious, but in other cases it may not be so straight forward. For example v8 as javascript interpreter is enabled by rubygem-rubyracer, which is using it. The v8 is not automatically enabled for all of ror40, because not all gems or all customers use it. It's up to your actual use-case where you put the scl_source.

    Last updated: November 2, 2023

    Recent Posts

    • Testing infrastructure red teaming with abliterated models

    • Build an enterprise RAG system with OGX

    • Solutions for SELinux MCS challenges with GitLab runners

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.