-
Notifications
You must be signed in to change notification settings - Fork 7
Failure in Prefix environment #52
Description
I've installed g-cpan in a Gentoo Prefix environment on macOS (it's not keyworded, but it builds with ** in package.accept_keywords), and after setting GCPAN_OVERLAY in make.conf, when I try to run g-cpan -p -g Mac::Finder::DSStore, it gives the following:
Subroutine logconfess redefined at /Users/kingjon/Gentoo/usr/lib/perl5/vendor_perl/5.42/Log/Agent/Driver/File.pm line 371.
Error opendir on '/etc/portage/repos.conf': No such file or directory at /Users/kingjon/Gentoo/usr/lib/perl5/vendor_perl/5.42/Gentoo/Portage/Q.pm line 117.
($EPREFIX is /Users/kingjon/Gentoo.)
I read the source code and found that line 117 is looking for the path $EROOT/etc/portage/repos.conf, but somehow $EROOT isn't getting detected properly. I then tried passing it as a variable via the command line (EROOT=/Users/kingjon/Gentoo/ g-cpan -p -g Mac::Finder::DSStore), and this gives the following output:
Subroutine logconfess redefined at /Users/kingjon/Gentoo/usr/lib/perl5/vendor_perl/5.42/Log/Agent/Driver/File.pm line 371.
* Insufficient permissions to edit /etc/portage/categories
* Please run g-cpan as a user with sufficient permissions
And looking in the source here, the categories file path is hardcoded to /etc/portage/categories, not prefixed. So (since it checks for /etc/portage/categories as one of the first things it does in its equivalent of main()) g-cpan can only ever run in unprefixed environments (and Prefix guests running on a host OS with a writable /etc/portage, but writing to anything in the host environment is plainly wrong ...)