0

I have created a custom RPM package that provides a specific version of Ruby with a custom set of rubygems pre-installed. The RPM package installs ruby in a custom location: /usr/local/ruby_alt/. So the installed ruby would be at: /usr/local/ruby_alt/bin/ruby.

Some of the gems in the package have scripts that have a she-bang line referencing the custom Ruby installation (e.g. #!/usr/local/ruby_alt/bin/ruby).

The RPM package was created with AutoReqProv=yes (meaning rpmbuild will scan the contents of the package automatically for dependencies). rpmbuild correctly identifies /usr/local/ruby_alt/bin/ruby as a dependency.

This package successfully installs on a CentOS 6 environment using the rpm command (e.g. rpm -i ruby_alt_pvdgm...) with no errors or warnings.

When this rpm is placed in a custom yum repository and an attempt is made to install it using yum, we get:

$ sudo yum install ruby_alt_pvdgm
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: repos.redrockhost.com
 * epel: fedora-epel.mirror.lstn.net
 * extras: centos-distro.cavecreek.net
 * updates: mirrors.loosefoot.com
Resolving Dependencies
--> Running transaction check
---> Package ruby_alt_pvdgm.x86_64 0:2.2.1-2.el6 will be installed
--> Processing Dependency: /usr/local/ruby_alt/bin/ruby for package: ruby_alt_pvdgm-2.2.1-2.el6.x86_64
--> Processing Dependency: /usr/local/ruby_alt/bin/ruby for package: ruby_alt_pvdgm-2.2.1-2.el6.x86_64

Packages skipped because of dependency problems:
    ruby_alt_pvdgm-2.2.1-2.el6.x86_64 from fury

I understand that /usr/local/ruby_alt/bin/ruby does not exist at the time of installation, but the package itself satisfies the dependency, so there should be no difficulty. Indeed, the rpm command - as mentioned earlier - installs the package with no problems.

Why would yum refuse to install this RPM package when the rpm command has no complaint?

EDIT: I have verified that both rpm and yum show /usr/local/ruby_alt/bin/ruby as a dependency, so this is not a case of yum having more extensive dependency checking than the rpm command. Has no one else encountered a case where yum would refuse to install a package that satisfied it's own dependencies? As you recall from the discussion above, the package in question satisfies this dependency, which the rpm command seems to understand.

Dave
  • 1
  • 1
  • 2
  • yum does more extensive dependency checking, of course. – Thomas Dickey Apr 11 '15 at 01:20
  • A couple of thoughts: (1) That repeated "processing" line for the dependency looks odd (does it repeat if you do `rpm -qpR` on the package?). (2) If you happened to install the package using rpm (and did not uninstall it), and rebuilt the package, yum will refuse to install the rebuilt package because the version is identical. – Thomas Dickey Apr 14 '15 at 00:56
  • 1) The repeated 'processing line bothered me as well. Running `rpm -qpR` on the package showed only a single dependency on `/usr/local/ruby_alt/bin/ruby`. 2) After installing with rpm I had erased the package and cleaned up the caches before attempting to install with yum. – Dave Apr 15 '15 at 14:05
  • I made a to-do to see if I can reproduce your problem, and provide more specific advice. By the way, you should also be able to test with a third method: using "yum install package-file.rpm" without putting it in the repository. That should give the same result as the repository, but less work. – Thomas Dickey Apr 17 '15 at 10:34

1 Answers1

0

As discussed in Check RPM dependencies, you can ask both yum and rpm about dependencies, e.g.,

yum -q deplist $PKG
rpm -qpR $PKG

Because yum has more information available, when you install a package, it will attempt to satisfy the dependencies by installing them as well. rpm cannot do this, and will silently allow some dependencies to not be satisfies.

Here are a few relevant discussions:

Rereading, the comment about "satisfies its own dependencies" reminds me of problems I have had with Perl (packaging vi-like-emacs). One of the workarounds which I used (more than one was needed) was to add a line in the script (mime.pl) which showed up as a dependency which looked like this:

our $RPM_Provides = 'mime.pl perl(mime.pl)';

as well as in the spec file:

Provides:       perl(mime.pl)

That is, RPM was appeased by those hints -- and they were both necessary according to different versions of RPM and platform. There are similar workarounds for Ruby, e.g.,

Tinkering with the automatic dependency mechanism seems a bad idea, but it is a possibility.

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105
  • Both commands provided above show the `/usr/local/ruby_alt/bin/ruby` as a dependency. I will edit my original question to note this. – Dave Apr 13 '15 at 15:00
  • 1
    "Suggested edit queue is full" Oh well, note Automatic Dependencies link is here now: https://ftp.osuosl.org/pub/rpm/max-rpm/s1-rpm-depend-auto-depend.html – JGurtz Oct 18 '22 at 00:02