Hide Forgot
Created attachment 1205175 [details] Brew build log Description of problem: Not able to build a rubygem RPM with another SCL package Version-Release number of selected component (if applicable): rh-ruby23 Steps to Reproduce: In %build section of RPM spec file, enable 2 SCL packages and run a build %{?scl:scl enable %{scl} rh-postgresql95 - << \EOF} %gem_install %{?scl:EOF} Actual results: The build fails with the following error: /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:123:in `default_dir': undefined method `[]' for nil:NilClass (NoMethodError) Additional info: Tried swapping the order of %{scl} and rh-postgresql95, as well as splitting to 2 'scl enable' lines but neither worked. Enabling an additional SCL package worked with rh-ruby22. .spec file to reproduce this issue: http://pkgs.devel.redhat.com/cgit/rpms/rubygem-pg/tree/rubygem-pg.spec?h=cfme-rh-ruby23-5.7-rhel-7&id=128d2dec737c257ca369d587df38733213fdd789 Brew scratch build: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=11812821
I don't understand why the default_dir logic is failing in operating_system.rb (will leave that to Vit & Pavel), but you could work around that by over-riding X_SCLS: %{?scl:scl enable %{scl} rh-postgresql95 - << \EOF} X_SCLS="rh-ruby23" %gem_install %{?scl:EOF} AFAICT this shouldn't make any difference to the build.
Thank you for the workaround, verified it builds fine with X_SCLS.
(In reply to Joe Orton from comment #1) > X_SCLS="rh-ruby23" This is definitely not the right solution, since it installs the gem files into rh-ruby23 directory structure. What is the collection you are working on? Is it the "cfme" collection and is this [1] the metapackage? I am asking, since the error is actually in your collection metapackage. It does not set GEM_PATH env variable, as is suggested by the guidelines [2]. But this metapackage is complete rubbish I must say (no offense). It does not even contain the 'enable' scriptlet nor other stuff we commonly provide in meta package, such as -build, -runtime and -scldevel subpackages. Please take look at rh-ror42 metapackage [3], which is metapackage of collection building atop of rh-ruby23. [1] http://pkgs.devel.redhat.com/cgit/rpms/cfme/tree/cfme.spec?h=cfme-rh-ruby23-5.7-rhel-7 [2] https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/2/html/Packaging_Guide/sect-Extending_the_rh-ruby22_Software_Collections.html [3] http://pkgs.devel.redhat.com/cgit/rpms/rh-ror42/tree/rh-ror42.spec?h=rhscl-2.3-rh-ror42-rhel-7
No, it's not 'cfme', but it's 'rubygem-pg' [1]. This itself isn't a new collection, but just a rubygem RPM that goes with rh-ruby23. So I don't think we need to build all those subpackages described in the guideline. But I will go over the document. Thank you for the reference. I've added "X_SCLS=%{scl}" in the spec file (rather than hard-coding rh-ruby23). I see rh-ror42 is setting it the same way, so at least that part is good, I hope. [1] http://pkgs.devel.redhat.com/cgit/rpms/rubygem-pg/tree/rubygem-pg.spec?h=cfme-rh-ruby23-5.7-rhel-7&id=ebbb088138aca7a3f03e589ec5c13da9f474f57c
(In reply to Satoe Imaishi from comment #4) > No, it's not 'cfme', but it's 'rubygem-pg' [1]. > > This itself isn't a new collection, but just a rubygem RPM that goes with > rh-ruby23. I am sorry, but something like this is not supported. The only supported way how to extend the collection is described in the documentation I referred above. > So I don't think we need to build all those subpackages > described in the guideline. But I will go over the document. Thank you for > the reference. > > I've added "X_SCLS=%{scl}" in the spec file (rather than hard-coding > rh-ruby23). You are not supposed to install anything into rh-ruby23 directory structure. > I see rh-ror42 is setting it the same way, so at least that part > is good, I hope. rh-ror42 is doing so, because it is metapackage. That is completely different reason. I am sorry, but I am closing this ticket, since you are not following guidelines and best practices.
Of course please don't hesitate to contact me if you need some help creating proper SCL extension, i.e. proper metapackage and rubygem-pg packages.