author | Alexander Eremin <a.eremin@nexenta.com> |
Tue, 25 Oct 2011 16:50:09 +0400 | |
changeset 462 | 12f6fd8fe2bc |
parent 449 | 2a36deca4819 |
child 464 | c51702debae2 |
permissions | -rwxr-xr-x |
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
1 |
#!/usr/bin/env perl |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
2 |
|
462
12f6fd8fe2bc
Added Nexenta copyrights into tools
Alexander Eremin <a.eremin@nexenta.com>
parents:
449
diff
changeset
|
3 |
# Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. |
12f6fd8fe2bc
Added Nexenta copyrights into tools
Alexander Eremin <a.eremin@nexenta.com>
parents:
449
diff
changeset
|
4 |
|
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
5 |
# Based on ideas of cpan2tgz by Jason Woodward <[email protected]> |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
6 |
# http://software.jaos.org/ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
7 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
8 |
use strict; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
9 |
use warnings FATAL => 'all'; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
10 |
use integer; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
11 |
use Data::Dumper; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
12 |
use Getopt::Long qw(:config no_ignore_case); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
13 |
use File::Copy; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
14 |
use File::Basename; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
15 |
use Cwd; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
16 |
use CPAN; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
17 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
18 |
sub blab { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
19 |
print 'cpan2ips: ', @_, "\n"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
20 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
21 |
sub warning { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
22 |
blab 'WARNING: ', @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
23 |
sleep 2; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
24 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
25 |
sub fatal { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
26 |
blab 'FATAL: ', @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
27 |
exit 1; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
28 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
29 |
sub my_chdir { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
30 |
my ($path) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
31 |
chdir $path or fatal "Can't chdir() to `$path': $!"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
32 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
33 |
sub my_mkdir { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
34 |
my ($path, $mode) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
35 |
if (defined $mode) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
36 |
mkdir $path, oct($mode) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
37 |
or fatal "Can't create dir `$path' with mode `$mode': $!"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
38 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
39 |
mkdir $path |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
40 |
or fatal "Can't create dir `$path': $!"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
41 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
42 |
} |
448
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
43 |
sub uniq { |
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
44 |
my ($array_ref) = @_; |
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
45 |
my %hash = map { $_, 1 } @$array_ref; |
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
46 |
@$array_ref = keys %hash; |
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
47 |
} |
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
48 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
49 |
sub shell_exec { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
50 |
my ($cmd) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
51 |
blab "executing `$cmd'"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
52 |
system($cmd); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
53 |
if ($? == -1) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
54 |
fatal "failed to execute: $!"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
55 |
} elsif ($? & 127) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
56 |
fatal (printf "child died with signal %d, %s coredump", |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
57 |
($? & 127), ($? & 128) ? 'with' : 'without') |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
58 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
59 |
my $rc = $? >> 8; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
60 |
if ($rc != 0) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
61 |
warning "child exited with value $rc"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
62 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
63 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
64 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
65 |
sub write_file { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
66 |
my ($filename, $content) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
67 |
blab "Writing file `$filename'"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
68 |
if (open FD, '>', $filename) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
69 |
print FD $content; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
70 |
close FD; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
71 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
72 |
fatal "Can't write to file `$filename': $!" |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
73 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
74 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
75 |
sub get_output { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
76 |
my ($cmd) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
77 |
blab "absorbing `$cmd'"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
78 |
if (open OUT, "$cmd |") { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
79 |
my @lines = <OUT>; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
80 |
close OUT; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
81 |
chomp @lines; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
82 |
warning "Empty output from `$cmd'" unless @lines; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
83 |
return \@lines; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
84 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
85 |
fatal "Can't execute `$cmd': $!" |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
86 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
87 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
88 |
sub get_output_line { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
89 |
return (@{get_output @_})[0]; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
90 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
91 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
92 |
sub trim { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
93 |
# works with refs: |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
94 |
$$_ =~ s/^\s*(.*)\s*$/$1/ foreach @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
95 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
96 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
97 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
98 |
my $PERL_MODS_DIR = getcwd; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
99 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
100 |
our $HAS_YAML = 1; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
101 |
eval "no warnings 'all'; use YAML;"; if ($@) { $HAS_YAML = 0 } |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
102 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
103 |
my %MODS_CACHE = (); |
449
2a36deca4819
cpan2ips.pl: removed dead code
Igor Pashev <igor.pashev@nexenta.com>
parents:
448
diff
changeset
|
104 |
if (opendir(my $perl_modules, $PERL_MODS_DIR)) { |
2a36deca4819
cpan2ips.pl: removed dead code
Igor Pashev <igor.pashev@nexenta.com>
parents:
448
diff
changeset
|
105 |
$MODS_CACHE{$_} = 1 foreach grep { ! m/^\.+$/ } readdir($perl_modules); |
2a36deca4819
cpan2ips.pl: removed dead code
Igor Pashev <igor.pashev@nexenta.com>
parents:
448
diff
changeset
|
106 |
closedir $perl_modules; |
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
107 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
108 |
fatal "Can't read directory `$PERL_MODS_DIR': $!"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
109 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
110 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
111 |
my @modules = @ARGV; |
449
2a36deca4819
cpan2ips.pl: removed dead code
Igor Pashev <igor.pashev@nexenta.com>
parents:
448
diff
changeset
|
112 |
do_package($_) foreach @modules; |
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
113 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
114 |
sub do_package |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
115 |
{ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
116 |
my ($module_name) = @_; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
117 |
return unless $module_name; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
118 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
119 |
my $module = CPAN::Shell->expand('Module', $module_name) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
120 |
|| CPAN::Shell->expand('Bundle', $module_name) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
121 |
|| CPAN::Shell->expand('Distribution', $module_name); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
122 |
fatal "Failed to find module: $module_name\n" unless $module; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
123 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
124 |
blab "Processing `$module_name'"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
125 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
126 |
my $pack; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
127 |
if ($module->can('distribution')) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
128 |
$pack = $module->distribution; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
129 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
130 |
$pack = $CPAN::META->instance('CPAN::Distribution', $module->cpan_file()); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
131 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
132 |
fatal "Failed to initialize CPAN::Distribution object for $module_name: $!" unless $pack; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
133 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
134 |
$pack->get(); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
135 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
136 |
my $cpan_file = $module->cpan_file(); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
137 |
my $cpan_dir = 'http://search.cpan.org/CPAN/authors/id/' . (dirname $cpan_file); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
138 |
my $mod_id = $module->id(); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
139 |
my $cpan_file_basename = basename $cpan_file; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
140 |
$cpan_file_basename =~ /^(.+)-([^-]+)\.tar\.(.+)$/ || fatal "Can't parse $cpan_file_basename"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
141 |
my ($cpan_name, $pkg_version, $tar_comp) = ($1, $2, $3); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
142 |
my $pkg_name = lc $cpan_name; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
143 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
144 |
blab "CPAN file: $cpan_file"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
145 |
blab "Package name: $pkg_name"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
146 |
blab "Package version: $pkg_version"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
147 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
148 |
if (exists $MODS_CACHE{$mod_id} || exists $MODS_CACHE{$pkg_name}) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
149 |
blab "Module `$mod_id' already in queue or incorporated"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
150 |
return $pkg_name; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
151 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
152 |
$MODS_CACHE{$mod_id} = 1; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
153 |
$MODS_CACHE{$pkg_name} = 1; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
154 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
155 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
156 |
if ($pack->isa_perl()) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
157 |
blab "Skipping `$mod_id': it is a Perl core module"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
158 |
return; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
159 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
160 |
eval { $pack->make() or die $!; }; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
161 |
if ($@) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
162 |
if (!($!{ENOTTY} && $HAS_YAML)) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
163 |
fatal "make ERROR [$module_name]: $!\n"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
164 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
165 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
166 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
167 |
my @mod_deps = (); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
168 |
if (my $deps = $pack->prereq_pm()) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
169 |
@mod_deps = grep { $_ && m/\w+/; } |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
170 |
map { defined $MODS_CACHE{$_} ? undef : $_ } |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
171 |
map { eval "no warnings 'all'; use $_;"; if ($@) { $_ } } |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
172 |
map { m/requires$/ ? keys %{$deps->{$_}} : $_ } |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
173 |
keys %{$deps}; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
174 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
175 |
blab "Required for `$mod_id' modules: ", (join ', ', @mod_deps); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
176 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
177 |
my @pkg_deps = (); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
178 |
foreach (@mod_deps) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
179 |
my $dep_pkg_name = do_package($_); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
180 |
push @pkg_deps, $dep_pkg_name if $dep_pkg_name; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
181 |
} |
448
11a4d6c5b270
cpan2ips.pl: Filter unique deps
Igor Pashev <igor.pashev@nexenta.com>
parents:
447
diff
changeset
|
182 |
uniq \@pkg_deps; |
447
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
183 |
blab "Required for `$pkg_name' packages: ", (join ', ', @pkg_deps); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
184 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
185 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
186 |
my $tmp_dest_dir = "/tmp/cpan2ips-$pkg_name"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
187 |
my $pack_dir = $pack->dir(); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
188 |
if ( -f "$pack_dir/Build" ) { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
189 |
shell_exec "cd $pack_dir && ./Build install_vendor destdir=$tmp_dest_dir"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
190 |
} else { |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
191 |
shell_exec "cd $pack_dir && make install_vendor DESTDIR=$tmp_dest_dir"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
192 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
193 |
fatal "Build failed" unless -d $tmp_dest_dir; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
194 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
195 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
196 |
my $pkg_summary = get_output_line "cd $pack_dir && [ -f META.yml ] && grep abstract: META.yml | sed 's,abstract: *,,'"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
197 |
my $ips_manifest = <<MANIFEST; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
198 |
<transform file path=usr.*/man/.+ -> default mangler.man.stability uncommitted> |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
199 |
set name=pkg.fmri value=pkg:/library/perl-5/$pkg_name@\$(IPS_COMPONENT_VERSION),\$(BUILD_VERSION) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
200 |
set name=info.classification value="org.opensolaris.category.2008:Development/Perl" |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
201 |
set name=pkg.summary value="$pkg_summary (Perl module)" |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
202 |
MANIFEST |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
203 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
204 |
$ips_manifest .= join "\n", (grep !/(\.packlist|perllocal.pod)$/, |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
205 |
@{get_output |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
206 |
"cd $tmp_dest_dir && \ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
207 |
gfind * -type d -printf 'dir path=%p\\n' \ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
208 |
gfind * -type f -printf 'file path=%p\\n' \ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
209 |
gfind * -type l -printf 'link path=%p target=%l\\n' \ |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
210 |
"}); |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
211 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
212 |
$ips_manifest .= "\n"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
213 |
$ips_manifest .= "depend fmri=pkg:/library/perl-5/$_ type=require\n" |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
214 |
foreach @pkg_deps; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
215 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
216 |
shell_exec "rm -rf $tmp_dest_dir"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
217 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
218 |
my $sha1sum = get_output_line "sha1sum $CPAN::Config->{'keep_source_where'}/authors/id/$cpan_file | cut -d ' ' -f 1"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
219 |
my $makefile = <<MAKEFILE; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
220 |
include ../../../make-rules/shared-macros.mk |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
221 |
COMPONENT_NAME = $cpan_name |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
222 |
COMPONENT_VERSION = $pkg_version |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
223 |
COMPONENT_SRC = \$(COMPONENT_NAME)-\$(COMPONENT_VERSION) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
224 |
COMPONENT_ARCHIVE = \$(COMPONENT_SRC).tar.$tar_comp |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
225 |
COMPONENT_ARCHIVE_HASH = sha1:$sha1sum |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
226 |
COMPONENT_ARCHIVE_URL = $cpan_dir/\$(COMPONENT_ARCHIVE) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
227 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
228 |
include \$(WS_TOP)/make-rules/prep.mk |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
229 |
include \$(WS_TOP)/make-rules/ips.mk |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
230 |
include \$(WS_TOP)/make-rules/makemaker.mk |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
231 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
232 |
build: \$(BUILD_32) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
233 |
install: \$(INSTALL_32) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
234 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
235 |
COMPONENT_TEST_TARGETS = test |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
236 |
test: \$(TEST_32) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
237 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
238 |
BUILD_PKG_DEPENDENCIES = \$(BUILD_TOOLS) |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
239 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
240 |
include \$(WS_TOP)/make-rules/depend.mk |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
241 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
242 |
MAKEFILE |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
243 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
244 |
my_mkdir "$PERL_MODS_DIR/$pkg_name"; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
245 |
write_file "$PERL_MODS_DIR/$pkg_name/$pkg_name.p5m", $ips_manifest; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
246 |
write_file "$PERL_MODS_DIR/$pkg_name/Makefile", $makefile; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
247 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
248 |
return $pkg_name; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
249 |
} |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
250 |
|
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
251 |
exit 0; |
f1790f276df9
Added cpan2ips.pl - recursively add perl modules into consolidation tree; removed cpan2ips.sh
Igor Pashev <igor.pashev@nexenta.com>
parents:
diff
changeset
|
252 |