HenrikBengtsson / CBI-software

A Scientific Software Stack for HPC (CentOS oriented)
https://wynton.ucsf.edu/hpc/software/software-repositories.html
5 stars 2 forks source link

cpan-config: Generic CPAN configuration? #115

Open HenrikBengtsson opened 10 months ago

HenrikBengtsson commented 10 months ago

Investigate whether it's possible to have cpan-config module that sets up a generic CPAN configuration. For instance, using cpan, it wants to add the following to ~/.bashrc:

PATH="${HOME}/perl5/bin${PATH:+:${PATH}}"; export PATH;
PERL5LIB="${HOME}/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
PERL_LOCAL_LIB_ROOT="${HOME}/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
PERL_MB_OPT="--install_base \"${HOME}/perl5\""; export PERL_MB_OPT;
PERL_MM_OPT="INSTALL_BASE=${HOME}/perl5"; export PERL_MM_OPT;

where ${HOME} are the expanded, hard-coded paths.

Writing things like this to ~/.bashrc is asking for problems in the long term. It would be better if this would be handled by an environment module that can be agile to future changes.

When using cpan's default configuration, it creates a ~/.cpan folder with files such as:

$ cat /wynton/home/bengtsson/hb-test/.cpan/CPAN/MyConfig.pm
$CPAN::Config = {
  'applypatch' => q[],
  'auto_commit' => q[0],
  'build_cache' => q[100],
  'build_dir' => q[/wynton/home/bengtsson/hb-test/.cpan/build],
  'build_dir_reuse' => q[0],
  'build_requires_install_policy' => q[yes],
  'bzip2' => q[/usr/bin/bzip2],
  'cache_metadata' => q[1],
  'check_sigs' => q[0],
  'cleanup_after_install' => q[0],
  'colorize_output' => q[0],
  'commandnumber_in_prompt' => q[1],
  'connect_to_internet_ok' => q[1],
  'cpan_home' => q[/wynton/home/bengtsson/hb-test/.cpan],
  'ftp_passive' => q[1],
  'ftp_proxy' => q[http://prox1:3128/],
  'getcwd' => q[cwd],
  'gpg' => q[/usr/bin/gpg],
  'gzip' => q[/usr/bin/gzip],
  'halt_on_failure' => q[0],
  'histfile' => q[/wynton/home/bengtsson/hb-test/.cpan/histfile],
  'histsize' => q[100],
  'http_proxy' => q[http://prox1:3128/],
  'inactivity_timeout' => q[0],
  'index_expire' => q[1],
  'inhibit_startup_message' => q[0],
  'keep_source_where' => q[/wynton/home/bengtsson/hb-test/.cpan/sources],
  'load_module_verbosity' => q[none],
  'make' => q[/usr/bin/make],
  'make_arg' => q[],
  'make_install_arg' => q[],
  'make_install_make_command' => q[/usr/bin/make],
  'makepl_arg' => q[],
  'mbuild_arg' => q[],
  'mbuild_install_arg' => q[],
  'mbuild_install_build_command' => q[./Build],
  'mbuildpl_arg' => q[],
  'no_proxy' => q[localhost,127.0.0.1],
  'pager' => q[/usr/bin/less],
  'patch' => q[/usr/bin/patch],
  'perl5lib_verbosity' => q[none],
  'plugin_list' => [],
  'prefer_external_tar' => q[1],
  'prefer_installer' => q[MB],
  'prefs_dir' => q[/wynton/home/bengtsson/hb-test/.cpan/prefs],
  'prerequisites_policy' => q[follow],
  'proxy_user' => q[],
  'recommends_policy' => q[1],
  'scan_cache' => q[atstart],
  'shell' => q[/bin/bash],
  'show_unparsable_versions' => q[0],
  'show_upload_date' => q[0],
  'show_zero_versions' => q[0],
  'suggests_policy' => q[0],
  'tar' => q[/usr/bin/tar],
  'tar_verbosity' => q[none],
  'term_is_latin' => q[1],
  'term_ornaments' => q[1],
  'test_report' => q[0],
  'trust_test_report_history' => q[0],
  'unzip' => q[/usr/bin/unzip],
  'urllist' => [q[http://www.cpan.org/]],
  'use_prompt_default' => q[0],
  'use_sqlite' => q[0],
  'version_timeout' => q[15],
  'wget' => q[/usr/bin/wget],
  'yaml_load_code' => q[0],
  'yaml_module' => q[YAML],
};
1;
__END__

It also creates ~/perl5/;

$ tree -a perl5/
perl5/
├── bin
└── lib
    └── perl5
        ├── 5.26.3
        │   └── x86_64-linux-thread-multi
        └── x86_64-linux-thread-multi
            ├── auto
            │   └── local
            │       └── lib
            │           └── .packlist
            └── perllocal.pod

10 directories, 2 files