-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I am debugging issues with the GitLab CI pipeline of my project Coocook. A job fails because DBD::Pg is missing although it is declared as suggested dependency in the cpanfile. I think I found that cpm misses installing that when the cpanfile comes from my dist tarball. My dist is using ExtUtils::MakeMaker::CPANfile to declare dependencies in one central place with the cpanfile.
Real world issue
I verified the issue can be easily replicated inside a clean Docker container using my dist file from GitLab: https://gitlab.com/coocook/coocook/-/jobs/11040878371/artifacts/raw/Coocook-0.005.tar.gz
$ podman run -it --rm docker.io/library/perl bash
root@888cf4216380:/usr/src/app# cpm install --no-test --with-suggests https://gitlab.com/coocook/coocook/-/jobs/11040878371/artifacts/raw/Coocook-0.005.tar.gz
DONE install File-ShareDir-Install-0.14
DONE install Module-CPANfile-1.1004
DONE install ExtUtils-MakeMaker-CPANfile-0.09
...
DONE install DBD-SQLite-1.76
...
DONE install https://gitlab.com/coocook/coocook/-/jobs/11040878371/artifacts/raw/Coocook-0.005.tar.gz
247 distributions installed.cpm seems to be really satisfied with the result and refuses to add anything:
root@888cf4216380:/usr/src/app# cpm install --no-test --with-suggests /root/.perl-cpm/work/1755425938.4/Coocook-0.005.tar.gz
DONE install file:///root/.perl-cpm/work/1755425938.4/Coocook-0.005.tar.gz
1 distribution installed.Extracting the cpanfile and installing dependencies from there then suddenly does install DBD::Pg:
root@888cf4216380:/usr/src/app# tar xf /root/.perl-cpm/work/1755425938.4/Coocook-0.005.tar.gz Coocook-0.005/cpanfile
root@888cf4216380:/usr/src/app# cd Coocook-0.005/
root@888cf4216380:/usr/src/app/Coocook-0.005# ls
cpanfile
root@888cf4216380:/usr/src/app/Coocook-0.005# cpm install --no-test --with-suggests
Loading requirements from cpanfile...
...
DONE install DBD-SQLite-1.76 (using prebuilt)
...
DONE install DBD-Pg-3.18.0
...
295 distributions installed.Minimal example
While writing this issue I had the idea how to write a minimal example of this and successfully verified the issue with that:
$ cat << EOF > Makefile.PL
> use strict;
use warnings;
use ExtUtils::MakeMaker::CPANfile;
WriteMakefile( NAME => 'Test' );
> EOF
$ echo 'suggests "V";' > cpanfile
$ perl Makefile.PL && make manifest && make dist
Generating a Unix-style Makefile
Writing Makefile for Test
Writing MYMETA.yml and MYMETA.json
"/usr/bin/perl" "-MExtUtils::Manifest=mkmanifest" -e mkmanifest
Added to MANIFEST: cpanfile
Added to MANIFEST: Makefile.PL
Added to MANIFEST: MANIFEST
rm -rf Test-
"/usr/bin/perl" "-MExtUtils::Manifest=manicopy,maniread" \
-e "manicopy(maniread(),'Test-', 'best');"
mkdir Test-
Generating META.yml
Generating META.json
tar cvf Test-.tar Test-
Test-/
Test-/MANIFEST
Test-/Makefile.PL
Test-/cpanfile
Test-/META.yml
Test-/META.json
rm -rf Test-
gzip --best Test-.tar
Created Test-.tar.gz
$ podman run -it --rm -v "$PWD:/dist" docker.io/library/perl bash
root@4cc0779b7bac:/usr/src/app# cpm install --with-suggests /dist/Test-.tar.gz
DONE install Module-CPANfile-1.1004
DONE install ExtUtils-MakeMaker-CPANfile-0.09
DONE install file:///dist/Test-.tar.gz
3 distributions installed.
root@4cc0779b7bac:/usr/src/app# tar xf /dist/Test-.tar.gz Test-/cpanfile
root@4cc0779b7bac:/usr/src/app# cd Test-/
root@4cc0779b7bac:/usr/src/app/Test-# cpm install --with-suggests
Loading requirements from cpanfile...
DONE install V-0.22
1 distribution installed.
root@4cc0779b7bac:/usr/src/app/Test-# cpm --version
cpm 0.997017 (/usr/local/bin/cpm)
This is a self-contained version, 0.997017 (https://github.com/skaji/cpm/tree/0.997017)
perl version v5.42.0 (/usr/local/bin/perl)
%Config:
archname=x86_64-linux-gnu
installsitelib=/usr/local/lib/perl5/site_perl/5.42.0
installsitebin=/usr/local/bin
sitearchexp=/usr/local/lib/perl5/site_perl/5.42.0/x86_64-linux-gnu
sitelibexp=/usr/local/lib/perl5/site_perl/5.42.0
vendorarch=/usr/local/lib/perl5/vendor_perl/5.42.0/x86_64-linux-gnu
vendorlibexp=/usr/local/lib/perl5/vendor_perl/5.42.0
archlibexp=/usr/local/lib/perl5/5.42.0/x86_64-linux-gnu
privlibexp=/usr/local/lib/perl5/5.42.0
%ENV:
@INC:
FatPacked::94367620603096=HASH(0x55d3ac811cd8)
/usr/local/lib/perl5/site_perl/5.42.0/x86_64-linux-gnu
/usr/local/lib/perl5/site_perl/5.42.0
/usr/local/lib/perl5/vendor_perl/5.42.0/x86_64-linux-gnu
/usr/local/lib/perl5/vendor_perl/5.42.0
/usr/local/lib/perl5/5.42.0/x86_64-linux-gnu
/usr/local/lib/perl5/5.42.0