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