Bug 1386757

Summary: rubygem-execjs: FTBFS rubygems NoMethodError
Product: Red Hat Software Collections Reporter: Jun Aruga <jaruga>
Component: rubygem-execjsAssignee: Pavel Valena <pvalena>
Status: CLOSED EOL QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rh-ror42CC: pvalena
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-14 13:06:50 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:
Attachments:
Description Flags
Patch - reverse order of enabled SCLs none

Description Jun Aruga 2016-10-19 14:55:59 UTC
Description of problem:

Failed to build for rh-ror42.

Version-Release number of selected component (if applicable):
rubygem-execjs-2.2.0-4.el7

How reproducible:


Steps to Reproduce:
1. $ git co rhscl-2.3-rh-ror42-rhel-7
2. $ rhpkg srpm
3. $ mock -r rhscl-2.3-rh-ror42-rhel-7-x86-64 rubygem-execjs-2.2.0-4.el7.src.rpm

Actual results:

Build failed with below message.

```
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.7oUR6B
+ umask 022
+ cd /builddir/build/BUILD
+ cd /builddir/build/BUILD
+ rm -rf rubygem-execjs-2.2.0
+ /usr/bin/mkdir -p rubygem-execjs-2.2.0
+ cd rubygem-execjs-2.2.0
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ scl enable rh-ror42 rh-nodejs4 -
/opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/defaults/operating_system.rb:131:in `default_dir': undefined method `[]' for nil:NilClass (NoMethodError)
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:38:in `default_specifications_dir'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:84:in `default_gem?'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/specification.rb:2079:in `base_dir'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:98:in `extensions_dir'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:91:in `extension_dir'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:243:in `require_paths'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:279:in `lib_dirs_glob'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/basic_specification.rb:269:in `matches_for_glob'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:468:in `block in find_latest_files'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:467:in `map'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:467:in `find_latest_files'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems.rb:995:in `load_plugins'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/gem_runner.rb:82:in `<top (required)>'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /opt/rh/rh-ruby23/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
  from /opt/rh/rh-ruby23/root/usr/bin/gem:9:in `<main>'
error: Bad exit status from /var/tmp/rpm-tmp.7oUR6B (%prep)
```

Expected results:

Build succeeded.

Additional info:

Scratch build:
$ rhpkg scratch-build --srpm
https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=11921731

Comment 1 Pavel Valena 2016-10-19 15:55:43 UTC
Created attachment 1212193 [details]
Patch  - reverse order of enabled SCLs

Hi Jun,

thank you for reporting.

As Vít Ondruch suggested, this is an error caused by [1] and changing the order of enabling of the SCLs does solve the issue (see attached diff).

[1] http://pkgs.devel.redhat.com/cgit/rpms/ruby/commit/?h=rhscl-2.3-rh-ruby23-rhel-7&id=ddcdf2b199fae3a0689b8bf4e75ea650a6433d19

Comment 2 Jun Aruga 2016-10-19 16:30:28 UTC
Pavel,
Thank you for your checking.
Okay.

When I ran below code, I got above error.

rubygem-execjs.spec

```
 %prep
 %setup -n %{pkg_name}-%{version} -q -c -T
 %{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
 %gem_install -n %{SOURCE0}
 %{?scl:EOF}
```

But when I changed the code
from

```
 %{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
```

to

```
 %{?scl:scl enable %{scl_nodejs} %{scl} - << \EOF}
```

It worked successfully.


So, maybe do we want it to work on on any case including %{scl}?

Such as 

-  %{?scl:scl enable %{scl} %{scl_nodejs} - << \EOF}
-  %{?scl:scl enable %{scl_nodejs} %{scl} - << \EOF}
-  %{?scl:scl enable %{scl_foo} ... %{scl} ... %{scl_bar} - << \EOF}

Comment 3 Pavel Valena 2016-10-20 13:39:07 UTC
Hi Jun,

our additional testing revealed that only in case `%gem_install` is encapsulated (follows the SCL enabling) the error occurs. This is unavoidable, in current state of scl-utils, and it will be documented.
Also, in this specific case, you can remove the `%{scl_nodejs}` enabling preceding %gem_install entirely. It is not needed anymore.

I the second case, when the tests are run, the order of enabling does not matter.

Comment 4 Jun Aruga 2016-10-20 14:09:04 UTC
(In reply to Pavel Valena from comment #3)
> Hi Jun,
> 
> our additional testing revealed that only in case `%gem_install` is
> encapsulated (follows the SCL enabling) the error occurs. This is
> unavoidable, in current state of scl-utils, and it will be documented.
> Also, in this specific case, you can remove the `%{scl_nodejs}` enabling
> preceding %gem_install entirely. It is not needed anymore.
> 
> I the second case, when the tests are run, the order of enabling does not
> matter.

Hi Pavel,
Okay in the specific case: rubygem-execjs, I could see that it worked successfully after removing `%{scl_nodejs}` in the part of %gem_install.

Comment 9 Joe Orton 2019-03-14 11:02:42 UTC
Red Hat does not currently plan to provide any further changes to this collection in a Red Hat Software Collections update release.

This software collection is nearing the retirement date (May 2019) after which customers are encouraged to upgrade to a later release.

Please contact Red Hat Support if you have further questions, or refer to the support lifecycle page for more information. https://access.redhat.com/support/policy/updates/rhscl/

Comment 10 Joe Orton 2019-06-14 13:06:50 UTC
In accordance with the Red Hat Software Collections Product Life Cycle, the support period for this collection has ended.

New bug fix, enhancement, and security errata updates, as well as technical support services will no longer be made available for this collection.

Customers are encouraged to upgrade to a later release.

Please contact Red Hat Support if you have further questions, or refer to the support lifecycle page for more information. https://access.redhat.com/support/policy/updates/rhscl/