Bug 1002434

Summary: depending collections can't point into correct directory
Product: Red Hat Software Collections Reporter: Marcela Mašláňová <mmaslano>
Component: distributionAssignee: Brian Gollaher <bgollahe>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: drieden, jstribny, rcollet
Target Milestone: ---Keywords: Tracking
Target Release: 1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-21 13:41:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1008474, 1008482, 1008483, 1008484, 1008486, 1008846, 1034638    
Bug Blocks:    

Description Marcela Mašláňová 2013-08-29 08:06:51 UTC
Description of problem:
- ruby193-rubygems-devel ship with some macros for convenient usage in other specs:
-- %{gem_dir} macro, that defines the top dir of rubygems hierarchy
-- %{gem_*} macros, that use %{gem_dir} to point to some of its subdirectories
- the value of %{gem_dir} however points to /opt/rh/ruby193/... which makes _all_ the macros unusable in depending collections, since they need to point into their path
- an easy (and generally wrong) solution is to redefine %{gem_dir} somewhere in the depending collection - but the macro file of that collection would have to be interpreted after macros.rubygems, meaning it would always need to be later in alphabetical order (which is wrong solution by design).

There is a pretty nice way to solve it that uses the %scl_package_override macro:
- define e.g. %ruby193_gem_dir that will hold the correct value, this will be part of macros.rubygems (generally a collection package other than the metapackage)
- in metapackage macros file, use something like:

%scl_package_override() {%global gem_dir %ruby193_gem_dir}

Additional info:
All packages in next release of RHSCL should fix it.

Comment 3 Remi Collet 2013-09-16 14:04:44 UTC
(In reply to Marcela Mašláňová from comment #0)
> - in metapackage macros file, use something like:
> 
> %scl_package_override() {%global gem_dir %ruby193_gem_dir}

Isn't rather in the <main-scl-package>-build package ?

> All packages in next release of RHSCL should fix it.

Can you also open a bug against php54-php-pear which also provides lot of macros ?

Comment 4 Marcela Mašláňová 2013-09-17 07:33:53 UTC
(In reply to Remi Collet from comment #3)
> (In reply to Marcela Mašláňová from comment #0)
> > - in metapackage macros file, use something like:
> > 
> > %scl_package_override() {%global gem_dir %ruby193_gem_dir}
> 
> Isn't rather in the <main-scl-package>-build package ?
> 
The comment was incorrect. Even ruby193 has those macros in -build subpackage.

> > All packages in next release of RHSCL should fix it.
> 
> Can you also open a bug against php54-php-pear which also provides lot of
> macros ?
Will do.

Comment 6 Josef Stribny 2013-11-07 12:28:40 UTC
The problem with %gem_dir macro is that it's hardcoded during ruby build for ruby193. I believe this can be solved by altering %%gem_dir macro in macros.rubygems.ruby193:

diff --git a/ruby.spec b/ruby.spec
index 18fc482..b7452b6 100644
--- a/ruby.spec
+++ b/ruby.spec
@@ -427,7 +427,7 @@ EOF
 
 cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.rubygems%{?scl:.%{scl}} << \EOF
 # The RubyGems root folder.
-%%gem_dir %{gem_dir}
+%%gem_dir %%{_datadir}/gems
 
 # Common gem locations and files.
 %%gem_instdir %%{gem_dir}/gems/%%{gem_name}-%%{version}


This way the macro will be expanding with each build depending on the -build sub-package of the depending collection. This is how it's done in ruby200 where this is no issue.

Comment 7 Marcela Mašláňová 2014-02-21 13:38:13 UTC
(In reply to Josef Stribny from comment #6)
> The problem with %gem_dir macro is that it's hardcoded during ruby build for
> ruby193. I believe this can be solved by altering %%gem_dir macro in
> macros.rubygems.ruby193:
> 
> diff --git a/ruby.spec b/ruby.spec
> index 18fc482..b7452b6 100644
> --- a/ruby.spec
> +++ b/ruby.spec
> @@ -427,7 +427,7 @@ EOF
>  
>  cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.rubygems%{?scl:.%{scl}}
> << \EOF
>  # The RubyGems root folder.
> -%%gem_dir %{gem_dir}
> +%%gem_dir %%{_datadir}/gems
>  
>  # Common gem locations and files.
>  %%gem_instdir %%{gem_dir}/gems/%%{gem_name}-%%{version}
> 
> 
> This way the macro will be expanding with each build depending on the -build
> sub-package of the depending collection. This is how it's done in ruby200
> where this is no issue.

Fixed in rhbz#1034638