1

I have build an RPM from a proprietary software collection in a CentOS 7 environment but the build process required executing some Perl modules (.pm files) found within the source itself. When I execute rpm -Uvh rpm-name.rpm I get failed dependencies with the exact Perl modules found in the source. So the question is, how do I install custom Perl modules?

Some of the .pm files define a package and others define subroutines. I tried copying the directory of the scripts to /usr/lib64/perl5/ but it did not work. cpan -D Module::Name gives me Can't call method userid on an undefined value at /usr/share/perl5/App/Cpan.pm line 836. I search for creating an RPM from perl modules but it seems everyone is explaining how to create RPMs from CPAN modules.

0

2 Answers 2

1

It is not clear from your description what exactly is going on (specific error messages would help or an example package spec that reproduces the problem) but it sounds like the RPM dependencies have gone awry, somehow. There are various options depending on what exactly the problem is.

Provide the Missing Package

Indicate that the package provides the missing module in the *.spec file:

Provides: perl(Module::Name)
...

this could be done in the *.spec file for the software. This may sometimes require a shim RPM that does nothing more than provide the missing dependency, notably when you have a third-party package you cannot or do not want to modify to fix the dependencies.

Disable Autoreq

A very big hammer is to turn off automatic requirements for the package;

Autoreq: 0

this may in turn require suitable BuildRequires, Requires and other statements in the *.spec file to setup appropriate dependencies for the package (or you could instead handle that in your configuration management as to what packages need to be installed). I have had to set this flag in 4 of the 133 perl-* module packages I maintain locally, for example in perl-File-ChangeNotify.spec:

# KLUGE don't pull in IO::KQueue which in turn needs *BSD
Autoreq: 0
BuildRequires:  perl(Carp)
...
Requires:       perl(Carp)
...

Alter of Filter the Automatic Dependencies Scripts

This is more work as it requires altering or filtering the output of the code that RPM runs to determine the requirements; the RPM documentation appears to be out of date as my centos 7 test system no longer has the find-* scripts mentioned on that page, so doubtless something has changed with this process, and who knows where or if it is now documented. I instead use one of the above two methods as I haven't had time to chase down what they've changed about the requirements scripts.

1
  • The make process for the source executes some Perl scripts within the source itself. But when I try to install the result RPM I get error: Failed dependencies: perl(EPICS::Copy) is needed by. But having Autreq: 0 did the trick. It seems these scripts are being bundled with the installation directory. Thanks!
    – 3bdalla
    Nov 8, 2018 at 12:44
0

I found adding the __requires_exclude macro to the spec file extremely useful for this situation. See https://docs.fedoraproject.org/en-US/packaging-guidelines/AutoProvidesAndRequiresFiltering/ for further detail

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .