dot rc

Sign in or create your account | Project List | Help

dot rc Commit Details

Date:2009-02-05 20:00:45 (3 years 2 days ago)
Author:Luciano M. F. Rocha
Commit:c0eb1e1eb8e83a9a17715239bb06cb343c0df4f2
Message:MyConfig.pm: misc fixes for new cpan version; make it smarter

Files: rc/cpan/CPAN/MyConfig.pm (2 diffs)

Change Details

rc/cpan/CPAN/MyConfig.pm
1## vim: ts=2 sw=2 et
12
3## if normal user, use prefix = $HOME/opt/`arch`/perl
24my ($makepl_arg, $mbuildpl_arg) = ('', '');
35
4if ($<) {
5    my $uname;
6my $home = $ENV{HOME} || (getpwuid($<))[7] || "/";
67
7    for my $o (qw(-m -i -p)) {
8        $uname = `uname $o 2>/dev/null`;
9        last if $uname && $uname !~ /unknown/;
10    }
11    chomp $uname;
8if ($home && $<) {
9  my $uname;
1210
13    if ($uname =~ /i[3456]86/) {
14        $uname = "i386";
15    } elsif ($uname =~ /ower.*64/ || $uname =~ /ppc.*64/) {
16        $uname = "ppc64";
17    } elsif ($uname =~ /ower/ || $uname =~ /ppc/) {
18        $uname = "ppc";
19    }
11  for my $o (qw(-m -i -p)) {
12    $uname = `uname $o 2>/dev/null`;
13    last if $uname && $uname !~ /unknown/;
14  }
15  chomp $uname;
2016
21    my $prefix = "$ENV{HOME}/opt/$uname/perl";
22    $makepl_arg = "PREFIX=$prefix";
23    $mbuildpl_arg = "--install_base $prefix";
17  ## some archs have different names depending on CPU or OS, use a common name
18  if ($uname =~ /i[3456]86/) {
19    $uname = "i386";
20  } elsif ($uname =~ /ower.*64/ || $uname =~ /ppc.*64/) {
21    $uname = "ppc64";
22  } elsif ($uname =~ /ower/ || $uname =~ /ppc/) {
23    $uname = "ppc";
24  }
25
26  my $prefix = "$home/opt/$uname/perl";
27  $makepl_arg = "PREFIX=$prefix";
28  $mbuildpl_arg = "--install_base $prefix";
2429}
2530
31## don't require full path for system utilities
32## default path:
33my $def_path = q[/usr/local/bin:/usr/bin:/bin];
34my @path = split(/:/, $ENV{PATH} || $def_path);
35
2636sub findexec
2737{
28    my $p = `type -P $_[0] 2>/dev/null`;
29    chomp $p;
30    $p;
38  for my $c (@_) {
39    next unless $c;
40    for my $p (@path) {
41      my $pc = "$p/$c";
42      return $pc if -x $pc;
43    }
44  }
45  "";
3146}
3247
3348$CPAN::Config = {
49  'applypatch' => q[],
3450  'auto_commit' => q[0],
35  'build_cache' => q[30],
51  'build_cache' => q[100],
52  ## build sources under /tmp, path depends on uid
3653  'build_dir' => "/tmp/build.cpan.$</b",
54  'build_dir_reuse' => q[1],
55  'build_requires_install_policy' => q[ask/yes],
56  'bzip2' => findexec('bzip2'),
3757  'cache_metadata' => q[1],
58  'check_sigs' => q[0],
3859  'commandnumber_in_prompt' => q[1],
39  'cpan_home' => "$ENV{HOME}/.cpan",
40  'dontload_hash' => { },
60  'cpan_home' => "$home/.cpan",
61  'curl' => findexec('curl'),
4162  'ftp' => findexec('ftp'),
4263  'ftp_passive' => q[1],
4364  'ftp_proxy' => q[],
4465  'getcwd' => q[cwd],
4566  'gpg' => findexec('gpg'),
4667  'gzip' => findexec('gzip'),
47  'histfile' => "$ENV{HOME}/.cpan/histfile",
68  'histfile' => "$home/.cpan/histfile",
4869  'histsize' => q[100],
4970  'http_proxy' => q[],
5071  'inactivity_timeout' => q[0],
5172  'index_expire' => q[1],
5273  'inhibit_startup_message' => q[0],
74  ## sources go under /tmp, path depends on uid
5375  'keep_source_where' => "/tmp/build.cpan.$</s",
76  'links' => findexec(qw(links elinks)),
77  'load_module_verbosity' => q[v],
5478  'make' => findexec('make'),
5579  'make_arg' => q[],
5680  'make_install_arg' => q[],
...... 
6084  'mbuild_install_arg' => q[],
6185  'mbuild_install_build_command' => q[./Build],
6286  'mbuildpl_arg' => $mbuildpl_arg,
63  'ncftpget' => findexec('lftpget'),
87  'ncftp' => findexec(qw(lftp ncftp)),
88  'ncftpget' => findexec(qw(lftpget ncftpget)),
6489  'no_proxy' => q[],
65  'pager' => findexec('less'),
90  'pager' => findexec($ENV{PAGER}, qw(less more)),
91  'patch' => findexec('patch'),
92  'prefer_installer' => q[MB],
93  'prefs_dir' => "$home/.cpan/prefs",
6694  'prerequisites_policy' => q[ask],
6795  'scan_cache' => q[atstart],
68  'shell' => q[/bin/bash],
96  'shell' => findexec(qw(bash sh)),
97  'show_unparsable_versions' => q[0],
98  'show_upload_date' => q[0],
99  'show_zero_versions' => q[0],
69100  'tar' => findexec('tar'),
101  'tar_verbosity' => q[v],
70102  'term_is_latin' => q[0],
71103  'term_ornaments' => q[1],
104  'test_report' => q[0],
72105  'unzip' => findexec('unzip'),
73  'urllist' => [q[http://perl.di.uminho.pt/cpan/],
74        q[http://www.perl.org/CPAN/]],
106  'urllist' => [q[http://cpan.perl.pt/], q[http://perl.di.uminho.pt/cpan/],
107    q[http://www.perl.org/CPAN/]],
75108  'use_sqlite' => q[0],
76109  'wget' => findexec('wget'),
110  'yaml_load_code' => q[0],
111  'yaml_module' => q[YAML],
77112};
781131;
79114__END__

Archive Download the corresponding diff file

Branches:
master