Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Build.PL of Astro::Catalog module has near the end ...

etc_files => { 'etc/skycat.cfg' => 'etc/skycat.cfg', 'etc/sss.cfg' => 'etc/sss.cfg', }, install_path => { 'etc' => File::Spec->catdir($Config{installprefix}, 'etc'), },

That $Config{installprefix} is /usr here, which a non-superuser cannot modify. As I am trying to build as non-superuser, that results in ...

... All tests successful. Files=27, Tests=3453, 15 wallclock secs ( 0.19 usr 0.05 sys + 11.09 c +usr 1.56 csys = 12.89 CPU) Result: PASS GSB/Astro-Catalog-4.37.tar.gz ./Build test -- OK Running Build install for GSB/Astro-Catalog-4.37.tar.gz Building Astro-Catalog !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! ERROR: Can't create '/usr/etc' mkdir /usr/etc: Permission denied at /usr/share/perl5/vendor_perl/ExtU +tils/Install.pm line 489. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +!! at /some/dir/perl/lib/perl5/Module/Build/Base.pm line 3576. GSB/Astro-Catalog-4.37.tar.gz ./Build install -- NOT OK Stopping: 'install' failed for 'Astro::Catalog'.

Setting {install_base,prefix,installprefix} had not help yet. What could I be missing?

# Environment. # Setting *prefix here only because of the "$Config{installprefix}". PERL_MB_OPT=--install_base '/some/dir/perl' --config installprefix='/s +ome/dir/perl' --config prefix='/some/dir/perl' PERL_MM_OPT=INSTALL_BASE='/some/dir/perl' PREFIX='/some/dir/perl' # In the .cpan/build directory. grep -C 1 -r 'install|prefix' _build | grep -v orig _build/build_params- { _build/build_params: 'prefix' => '/some/dir/perl' _build/build_params- }, -- _build/build_params- 'include_dirs' => [], _build/build_params: 'install_base' => '/some/dir/perl', _build/build_params: 'install_base_relpaths' => {}, ## "/usr" did not change. _build/build_params: 'install_path' => { _build/build_params- 'etc' => '/usr/etc' _build/build_params- }, _build/build_params: 'install_sets' => {}, _build/build_params: 'installdirs' => 'site', _build/build_params- 'libdoc_dirs' => [ -- _build/build_params- 'perl' => '/usr/bin/perl', -- _build/build_params- 'pollute' => undef, _build/build_params: 'prefix' => undef, _build/build_params: 'prefix_relpaths' => {}, _build/build_params- 'prereq_action_types' => [ -- _build/runtime_params- 'config' => { _build/runtime_params: 'prefix' => '/some/dir/perl +' _build/runtime_params- }, _build/runtime_params: 'install_base' => '/some/dir/perl', _build/runtime_params- 'verbose' => '1'

Replies are listed 'Best First'.
Re: Module::Build- Overriding default $Config{installprefix}
by karlgoethebier (Abbot) on Jul 29, 2023 at 16:53 UTC

    Doesn't this work with something like perl Build.PL install_base=/home/anon ?

    «The Crux of the Biscuit is the Apostrophe»

      No, setting install_path did not change the path for etc directory; see the OP, namely PERL_MB_OPT assignment & result of grep ... _build.

      I had not tried doing the manual installation for the offending module, for I need to install that thing in an automated way (as it is only one of many dependencies of App::SourcePlot).

        Maybe sudo is your friend? This can be adjusted quite finely. Best would be - as already mentioned above - your own Perl.

        «The Crux of the Biscuit is the Apostrophe»

Re: Module::Build- Overriding default $Config{installprefix} (cpan Distroprefs )
by Anonymous Monk on Jul 29, 2023 at 10:45 UTC

      Thanks for the clue of install_path.

      This did not work ...

      --install_path /some/dir/perl/etc

      ... needed to do ...

      --install_path etc=/some/dir/perl/etc

      ... "worked" in the sense installation did not fail due to permission error; have yet to try running the software. If that would still be a problem, then just /have to/ edit the damn installed file(s).

      All in all, setting various paths is damn fucking fiddly to install software in a user-controlled directory. Much less irritating was building own perl (& installing in user-controlled directory) and using that perl to install everything else. But decision is not mine to make :-|

        All that was for 💩

        _set_cfg_file sub in Astro::Catalog::Query::SkyCat searches for configuration file in equivalent of %ENV|$HOME|dirname($^X)/../etc (there is nice comment there about the last one).

        No message is produced by App::SourcePlot to set up a catalog file in HOME on the first run. On subsequent runs, using the Tk widget to use "default" catalog results on console ...

        Tk::Error: Unable to read catalog since no file specified and no defau +lt known. at /some/dir/perl/lib/perl5/Astro/Catalog.pm line 842. Tk callback for .toplevel1.frame1.menubutton.menu Tk::__ANON__ at /some/dir/perl/lib/perl5/x86_64-linux-thread-multi/Tk +.pm line 251 Tk::Menu::Invoke at /some/dir/perl/lib/perl5/x86_64-linux-thread-mult +i/Tk/Menu.pm line 532 <ButtonRelease> (command bound to event)

        👍

        Yes, I can _NOW_ shove the configuration files in HOME only after trying to debug the issue of not being able to specify a path for etc directory of *::Catalog.

        Much less irritating was building own perl (& installing in user-controlled directory) and using that perl to install everything else. But decision is not mine to make :-|

        Why is this decision not yours to make? In case it helps you make a case for building your own Perl, you might make some of the arguments mentioned recently here.