line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package OTRS::OPM::Maker::Command::dependencies; |
2
|
|
|
|
|
|
|
$OTRS::OPM::Maker::Command::dependencies::VERSION = '0.19'; |
3
|
|
|
|
|
|
|
# ABSTRACT: List dependencies of OTRS packages |
4
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
10600
|
use strict; |
|
14
|
|
|
|
|
36
|
|
|
14
|
|
|
|
|
458
|
|
6
|
14
|
|
|
14
|
|
75
|
use warnings; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
358
|
|
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
2755
|
use XML::LibXML; |
|
14
|
|
|
|
|
226157
|
|
|
14
|
|
|
|
|
100
|
|
9
|
|
|
|
|
|
|
|
10
|
14
|
|
|
14
|
|
3673
|
use OTRS::OPM::Maker -command; |
|
14
|
|
|
|
|
34
|
|
|
14
|
|
|
|
|
121
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub abstract { |
13
|
1
|
|
|
1
|
1
|
5296
|
return "list dependencies for OTRS packages"; |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub usage_desc { |
17
|
1
|
|
|
1
|
1
|
1038
|
return "opmbuild dependencies "; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub validate_args { |
21
|
9
|
|
|
9
|
1
|
9584
|
my ($self, $opt, $args) = @_; |
22
|
|
|
|
|
|
|
|
23
|
9
|
100
|
100
|
|
|
168
|
$self->usage_error( 'need path to .sopm or .opm' ) if |
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
24
|
|
|
|
|
|
|
!$args or |
25
|
|
|
|
|
|
|
'ARRAY' ne ref $args or |
26
|
|
|
|
|
|
|
!defined $args->[0] or |
27
|
|
|
|
|
|
|
$args->[0] !~ /\.s?opm\z/ or |
28
|
|
|
|
|
|
|
!-f $args->[0]; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub execute { |
32
|
3
|
|
|
3
|
1
|
3849
|
my ($self, $opt, $args) = @_; |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
|
|
8
|
my $file = $args->[0]; |
35
|
3
|
|
|
|
|
29
|
my $parser = XML::LibXML->new; |
36
|
3
|
|
|
|
|
66
|
my $tree = $parser->parse_file( $file ); |
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
|
|
1202
|
my $root_elem = $tree->getDocumentElement; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# retrieve file information |
41
|
3
|
|
|
|
|
25
|
my @package_req = $root_elem->findnodes( 'PackageRequired' ); |
42
|
3
|
|
|
|
|
171
|
my @modules_req = $root_elem->findnodes( 'ModuleRequired' ); |
43
|
|
|
|
|
|
|
|
44
|
3
|
|
|
|
|
86
|
my %labels = ( |
45
|
|
|
|
|
|
|
PackageRequired => 'OTRS add on', |
46
|
|
|
|
|
|
|
ModuleRequired => 'CPAN module', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
DEP: |
50
|
3
|
|
|
|
|
26
|
for my $dependency ( @package_req, @modules_req ) { |
51
|
4
|
|
|
|
|
24
|
my $type = $dependency->nodeName; |
52
|
4
|
|
|
|
|
12
|
my $version = $dependency->findvalue( '@Version' ); |
53
|
4
|
|
|
|
|
327
|
my $name = $dependency->textContent; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
125
|
print "$name - $version (" . $labels{$type} . ")\n"; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |