-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup-deps.pl
executable file
·53 lines (48 loc) · 1.59 KB
/
setup-deps.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl -w
use strict;
use CPAN::MyConfig;
use CPAN;
use CPAN::HandleConfig;
use CPAN::Shell;
my $root;
BEGIN {
$root = $INC[0];
if ($root !~ s:/_cpan$::) {
die "Please invoke this script via .../setup.sh."
}
if ( ! exists $CPAN::Config{cpan_home} ) {
$CPAN::Config = {
'auto_commit' => 1,
'cpan_home' => "$root/_cpan",
'ftp_passive' => 1,
'install_help' => 'manual',
'urllist' => [@CPAN::Defaultsites]
};
}
# $CPAN::DEBUG ||= $CPAN::DEBUG{'FTP'};
CPAN::HandleConfig->load(autoconfig => 1, auto_pick => 1, doit => 1);
CPAN::Shell::setup_output;
CPAN::Index->reload;
my $ll = CPAN::Shell->expandany('local::lib');
if ( ! $ll->inst_file && ! -d "$root/aux/lib/perl5/local" ) {
$ll->get;
system('mkdir', '-p', "$root/aux/lib/perl5/local");
system('cp', $ll->distribution->dir . "/lib/local/lib.pm",
"$root/aux/lib/perl5/local/lib.pm");
}
}
use lib "$root/aux/lib/perl5";
use local::lib("$root/aux", '--no-create');
my @lwp_deps = qw(Encode::Locale File::Listing
HTML::Parser HTML::Tagset HTML::Tree
HTTP:Cookies HTTP::Date HTTP::Message HTTP::Negotiate
LWP::MediaTypes LWP::Protocol::HTTPS
Net::HTTP URI WWW::RobotRules);
for my $module (@lwp_deps, 'Time::HiRes') {
if ( ! CPAN::Shell->expandany($module)->inst_file ) {
CPAN::Shell->install($module);
}
}
if ( ! CPAN::Shell->expandany('LWP')->inst_file ) {
CPAN::Shell->install('Bundle::LWP');
}