Home > Mobile >  DNF install cannot find Perl dependencies, there is a way to figure out which @INC is being used?
DNF install cannot find Perl dependencies, there is a way to figure out which @INC is being used?

Time:12-26

I'm installing a custom rpm for the EOL MongoDB Perl driver; The RPM build went fine (I'm using fpm):

fpm -t rpm -s cpan --maintainer 'Jose Vicente Nunez <[email protected]>' BSON
sudo dnf install -y perl-BSON-v1.12.2-1.noarch.rpm
fpm -t rpm -s cpan --maintainer 'Jose Vicente Nunez <[email protected]>' MongoDB

And after going through the dependency hell, I tried to install it:

sudo dnf install perl-MongoDB-v2.2.2-1.noarch.rpm
Last metadata expiration check: 0:14:46 ago on Thu 22 Dec 2022 10:21:34 AM EST.
Error:
 Problem: conflicting requests
  - nothing provides perl(BSON) >= 1.012000 needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Bytes) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Code) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::DBRef) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::OID) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Raw) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Regex) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Time) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Timestamp) needed by perl-MongoDB-v2.2.2-1.noarch
  - nothing provides perl(BSON::Types) needed by perl-MongoDB-v2.2.2-1.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)

Now here comes the odd thing: BSON and its modules are available and installed:

rpm -ql perl-BSON
/usr/local/share/man/man3/BSON.3pm
/usr/local/share/man/man3/BSON::Array.3pm
/usr/local/share/man/man3/BSON::Binary.3pm
/usr/local/share/man/man3/BSON::Bool.3pm
/usr/local/share/man/man3/BSON::Bytes.3pm
/usr/local/share/man/man3/BSON::Code.3pm
/usr/local/share/man/man3/BSON::DBPointer.3pm
/usr/local/share/man/man3/BSON::DBRef.3pm
/usr/local/share/man/man3/BSON::Decimal128.3pm
/usr/local/share/man/man3/BSON::Doc.3pm
/usr/local/share/man/man3/BSON::Double.3pm
/usr/local/share/man/man3/BSON::Int32.3pm
/usr/local/share/man/man3/BSON::Int64.3pm
/usr/local/share/man/man3/BSON::MaxKey.3pm
/usr/local/share/man/man3/BSON::MinKey.3pm
/usr/local/share/man/man3/BSON::OID.3pm
/usr/local/share/man/man3/BSON::ObjectId.3pm
/usr/local/share/man/man3/BSON::PP.3pm
/usr/local/share/man/man3/BSON::Raw.3pm
/usr/local/share/man/man3/BSON::Regex.3pm
/usr/local/share/man/man3/BSON::String.3pm
/usr/local/share/man/man3/BSON::Symbol.3pm
/usr/local/share/man/man3/BSON::Time.3pm
/usr/local/share/man/man3/BSON::Timestamp.3pm
/usr/local/share/man/man3/BSON::Types.3pm
/usr/local/share/perl5/BSON.pm
/usr/local/share/perl5/BSON/Array.pm
/usr/local/share/perl5/BSON/Binary.pm
/usr/local/share/perl5/BSON/Bool.pm
/usr/local/share/perl5/BSON/Bytes.pm
/usr/local/share/perl5/BSON/Code.pm
/usr/local/share/perl5/BSON/DBPointer.pm
/usr/local/share/perl5/BSON/DBRef.pm
/usr/local/share/perl5/BSON/Decimal128.pm
/usr/local/share/perl5/BSON/Doc.pm
/usr/local/share/perl5/BSON/Double.pm
/usr/local/share/perl5/BSON/Int32.pm
/usr/local/share/perl5/BSON/Int64.pm
/usr/local/share/perl5/BSON/MaxKey.pm
/usr/local/share/perl5/BSON/MinKey.pm
/usr/local/share/perl5/BSON/OID.pm
/usr/local/share/perl5/BSON/ObjectId.pm
/usr/local/share/perl5/BSON/PP.pm
/usr/local/share/perl5/BSON/Raw.pm
/usr/local/share/perl5/BSON/Regex.pm
/usr/local/share/perl5/BSON/String.pm
/usr/local/share/perl5/BSON/Symbol.pm
/usr/local/share/perl5/BSON/Time.pm
/usr/local/share/perl5/BSON/Timestamp.pm
/usr/local/share/perl5/BSON/Types.pm

And just to confirm system Perl knows about it:

 for m in BSON  BSON::Bytes  BSON::Code  BSON::DBRef  BSON::OID  BSON::Raw  BSON::Regex  BSON::Time  BSON::Timestamp  BSON::Types; do
> perl -M${m} -e ';' > /dev/null 2>&1 && echo "OK: ${m}"|| echo "ERROR: ${m}"
> done
OK: BSON
OK: BSON::Bytes
OK: BSON::Code
OK: BSON::DBRef
OK: BSON::OID
OK: BSON::Raw
OK: BSON::Regex
OK: BSON::Time
OK: BSON::Timestamp
OK: BSON::Types

I can only think that then @INC used by DNF is different from the one used by Perl on the CLI. Mine looks like this (perl -V, /usr/local/share/perl5 is there):

  Built under linux
  Compiled at Feb 16 2021 15:25:15
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5

Any ideas what I'm doing wrong?

Thanks!

CodePudding user response:

I ended doing some trickery by borrowing a SRPM, and just commented out a boot-strapping test on BSON and re-compiled.

curl --location --url https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/37/Everything/source/tree/Packages/p/perl-BSON-1.12.2-9.fc37.src.rpm --fail --output rpmbuild/SRPMS/perl-BSON-1.12.2-9.fc37.src.rpm
curl --fail --location --url https://download-ib01.fedoraproject.org/pub/fedora/linux/releases/37/Everything/source/tree/Packages/p/perl-MongoDB-2.2.2-7.fc37.src.rpm --output rpmbuild/SRPMS/perl-MongoDB-2.2.2-7.fc37.src.rpm

Hopefully someone knows the answer and can share it here, I decided to solve this using a different trick.

Thanks!

CodePudding user response:

You have several flaws there. But let's focus on the main culprit:

The name of the package perl-BSON-v1.12.2-1.noarch.rpm indicates that you put in:

Version: v1.12.2

But the per-MongoDB tells you:

nothing provides perl(BSON) >= 1.012000 needed by perl-MongoDB-v2.2.2-1.noarch

Now let's ask rpm what it thinks - which version is higher:

$ rpmdev-vercmp v1.12.2 1.012000
v1.12.2 < 1.012000

So here it is. Your perl-MongoDB needs something higher than 1.012000. Which is more trickier than it you may think. See:

$ rpmdev-vercmp 1.12.2 1.012000
1.12.2 < 1.012000
12$ rpmdev-vercmp 1.122 1.012000
1.122 < 1.012000
$ rpmdev-vercmp 1.0122 1.012000
1.0122 < 1.012000
$ rpmdev-vercmp 1.012200 1.012000
1.012200 > 1.012000
  • Related