Bug 1982410

Summary: rubygem-rspec-support: FTBFS related to require 'rake/file_utils'
Product: Red Hat Enterprise Linux 9 Reporter: Florian Weimer <fweimer>
Component: rubygem-rspec-supportAssignee: Pavel Valena <pvalena>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Houska <jhouska>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: CentOS StreamCC: bstinson, hhorak, jhouska, jwboyer, pvalena, vondruch
Target Milestone: betaKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-rspec-core-3.10.1-7.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:52:33 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:    
Bug Blocks: 1980998    
Attachments:
Description Flags
build.log none

Description Florian Weimer 2021-07-14 19:12:03 UTC
Created attachment 1801625 [details]
build.log

A rebuild of rubygem-rspec-support-3.10.2-1.el9.1 fails with an error during the %check phase:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.yvfb9P
+ umask 022
+ cd /builddir/build/BUILD
+ cd rspec-support-3.10.2
+ LANG=C.UTF-8
+ FAILFILE=()
+ FAILTEST=()
+ (( i = 0 ))
+ (( i < 0 ))
+ ruby -rrubygems -Ilib/ -S rspec spec/
Simplecov could not be loaded
An error occurred while loading ./spec/rspec/support/spec/shell_out_spec.rb. - Did you mean?
                    rspec ./spec/rspec/support/spec/stderr_splitter_spec.rb
                    rspec ./spec/rspec/support/source/node_spec.rb
Failure/Error: require 'rake/file_utils'
LoadError:
  cannot load such file -- rake/file_utils
# ./spec/rspec/support/spec/shell_out_spec.rb:1:in `<top (required)>'
An error occurred while loading ./spec/rspec/support/warnings_spec.rb. - Did you mean?
                    rspec ./spec/rspec/support/differ_spec.rb
                    rspec ./spec/rspec/support_spec.rb
                    rspec ./spec/rspec/support/source_spec.rb
Failure/Error: require 'rake/file_utils'
LoadError:
  cannot load such file -- rake/file_utils

Comment 1 Pavel Valena 2021-07-14 20:12:36 UTC
`rubygem-rake` is missing in the buildroot.

It should've been required by rubygem-rspec-core, but it seems the runtime require is missing. Only difference I was able to found (in comparison to Fedora) is this:
https://gitlab.com/redhat/centos-stream/rpms/rubygem-rspec-core/-/commit/ae1a6bd84e49a2588bfcf06bb40aa450ff1f4280

Other possibile difference is in soft dependencies handling, as the rubygem-rspec-core spec file contains:
```
Recommends:	rubygem(rake)
```

I'd simply modify the runtime dependency from Recommends to Requires in the rubygem-rspec-core package, at least temporarily, as it achieves the exact desired state without any side-effects (it's not intended for other than buildroot use, AFAIK).

Merge Request: https://gitlab.com/redhat/centos-stream/rpms/rubygem-rspec-core/-/merge_requests/2

Comment 2 Florian Weimer 2021-07-14 20:16:45 UTC
mock doesn't install weak dependencies in my experience (at least in the configurations we use).

You could use this:

Recommends: rubygem(rake)
Requires: (rubygem(rake) if redhat-rpm-config)

here redhat-rpm-config serves as a marker package for “this is a buildroot-like environment”. This way, you can keep the dependency optional for other kinds of environments.

It's what we plan to use for glibc-gconv-extra, which has similar issues around the buildroot (should be uninstallable for end users, so weak dependency, but must be included in the buildroot).

Comment 3 Pavel Valena 2021-07-14 20:30:52 UTC
Thanks! Amended.

Comment 4 Pavel Valena 2021-07-15 14:54:16 UTC
(In reply to Florian Weimer from comment #2)
> mock doesn't install weak dependencies in my experience (at least in the
> configurations we use).
> 
> You could use this:
> 
> Recommends: rubygem(rake)
> Requires: (rubygem(rake) if redhat-rpm-config)

Actually, upon more investigation, it turns out the `Recommends` was only RHEL- change. Probably with the intention to drop it. Not sure how that would be possible with current build failures. Also it previously built ok, so it was most probably pulled into the buildroot along with other dependencies.

I'll revert the change.

Comment 6 Pavel Valena 2021-07-15 15:21:59 UTC
I've just stumbled upon this:

https://gitlab.com/redhat/centos-stream/rpms/rubygem-rake/
 - it is a 404


Where does the `rubygem-rake` package come from?

Why is it available, without a repository, or a koji build?

https://kojihub.stream.rdu2.redhat.com/koji/search?match=glob&type=package&terms=rubygem-rake

Comment 7 Florian Weimer 2021-07-15 15:30:12 UTC
rubygem-rake is a subpackage of ruby:

$ dnf info info rubygem-rake
[…]
Name         : rubygem-rake
Version      : 13.0.3
Release      : 150.el9
Architecture : noarch
Size         : 91 k
Source       : ruby-3.0.1-150.el9.src.rpm
Repository   : build
Summary      : Ruby based make-like utility
URL          : https://www.ruby-lang.org/
License      : MIT
Description  : Rake is a Make-like program implemented in Ruby. Tasks and
             : dependencies are specified in standard Ruby syntax.

Comment 8 Pavel Valena 2021-07-16 09:35:34 UTC
(In reply to Florian Weimer from comment #7)
> rubygem-rake is a subpackage of ruby:
> 

You're right, my bad, I confused it with rack... sorry, I should've run the query.

Comment 9 Pavel Valena 2021-07-16 10:39:52 UTC
Should be fixed now, when built with: rubygem-rspec-core-3.10.1-7.el9

Comment 10 Pavel Valena 2021-07-20 16:12:19 UTC
Please note that the rubygem-rspec-core build is held on gating-yaml.validation (probably missing gating).

Comment 11 Vít Ondruch 2021-07-27 10:00:39 UTC
Previous version of rspec-core with runtime dependency on Rake was used when building the new version, therefore the rubygem-rake was pulled in. With updated version with the soft dependency, it cannot work anymore. Not easy to catch, sorry for the breakage.

Nevertheless, I still think the soft dependency is the right solution and the Rake should be specified explicitly when needed. I had an discussion about it with Fedora maintainer, but it could have been prior weak dependencies were available.

Comment 12 Pavel Valena 2021-07-27 10:16:47 UTC
(In reply to Vít Ondruch from comment #11)
> Previous version of rspec-core with runtime dependency on Rake was used when
> building the new version, therefore the rubygem-rake was pulled in. With
> updated version with the soft dependency, it cannot work anymore. Not easy
> to catch, sorry for the breakage.

It's required for multiple test suites, including the rspec-core one. As it's already included in Ruby, I opted for the easier solution, sorry. Alternative would be to have something like in Comment 2 (there's still time for a "fix").

> 
> Nevertheless, I still think the soft dependency is the right solution and
> the Rake should be specified explicitly when needed. I had an discussion
> about it with Fedora maintainer, but it could have been prior weak
> dependencies were available.

Yes, this is unfortunate. I still think it would be easier to test it in Fedora first, and merge into c9s subsequently, as it requires changes in multiple packages.

Comment 13 Florian Weimer 2021-07-27 10:20:52 UTC
(In reply to Pavel Valena from comment #12)
> Yes, this is unfortunate. I still think it would be easier to test it in
> Fedora first, and merge into c9s subsequently, as it requires changes in
> multiple packages.

I can validate changes on a CentOS Stream side tag over some weekend in August. The c9s builders have lots of spare capacity, and I have got scripts to submit builds. This is how I found this issue in the first place.

Rebuilding Fedora is much harder. It's both larger, and the builders tend to be much more loaded.

Eventually, I would like to see a program-level initiative to ensure that packages still build and pass gating, all the time, but it doesn't exist as of today. (Fedora is actually better in this regard, there is Koschei to find build problems.)

Comment 14 Vít Ondruch 2021-07-27 10:30:14 UTC
(In reply to Pavel Valena from comment #12)
> > Nevertheless, I still think the soft dependency is the right solution and
> > the Rake should be specified explicitly when needed. I had an discussion
> > about it with Fedora maintainer, but it could have been prior weak
> > dependencies were available.
> 
> Yes, this is unfortunate. I still think it would be easier to test it in
> Fedora first, and merge into c9s subsequently, as it requires changes in
> multiple packages.

I have opened this PR to narrow this in Fedora:

https://src.fedoraproject.org/rpms/rubygem-rspec-core/pull-request/4

There is probably no point to bother with this in RHEL9, so please keep the changes as they already are.

Comment 17 Pavel Valena 2021-07-30 10:19:21 UTC
Waived, as agreed on with PO and QE. As of current situation this BuildRoot package gating test would be of little value.