|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package OPM::Maker::Command::dependencies;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 $OPM::Maker::Command::dependencies::VERSION = '1.17';  | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: List dependencies of OTRS packages  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
5
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
13127
 | 
 use strict;  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
44
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
544
 | 
    | 
| 
6
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
94
 | 
 use warnings;  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
38
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
516
 | 
    | 
| 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
8
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
91
 | 
 use Carp qw(croak);  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
35
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
870
 | 
    | 
| 
9
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
4725
 | 
 use XML::LibXML;  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
334981
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
117
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
5460
 | 
 use OPM::Maker -command;  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
49
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
166
 | 
    | 
| 
12
 | 
21
 | 
 
 | 
 
 | 
  
21
  
 | 
 
 | 
79008
 | 
 use OPM::Maker::Utils qw(reformat_size check_args_sopm);  | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
52
 | 
    | 
| 
 
 | 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
8411
 | 
    | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub abstract {  | 
| 
15
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
1
  
 | 
2863
 | 
     return "list dependencies for OPM packages";  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub usage_desc {  | 
| 
19
 | 
1
 | 
 
 | 
 
 | 
  
1
  
 | 
  
1
  
 | 
1459
 | 
     return "opmbuild dependencies ";  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub validate_args {  | 
| 
23
 | 
18
 | 
 
 | 
 
 | 
  
18
  
 | 
  
1
  
 | 
17007
 | 
     my ($self, $opt, $args) = @_;  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
25
 | 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
59
 | 
     my $sopm = check_args_sopm( $args, 1 );  | 
| 
26
 | 
18
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
105
 | 
     $self->usage_error( 'need path to .sopm or .opm' ) if  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         !$sopm;  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub execute {  | 
| 
31
 | 
12
 | 
 
 | 
 
 | 
  
12
  
 | 
  
1
  
 | 
11805
 | 
     my ($self, $opt, $args) = @_;  | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       | 
| 
33
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
43
 | 
     my $file = check_args_sopm( $args, 1 );  | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
35
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
33
 | 
     my %opts;  | 
| 
36
 | 
12
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
47
 | 
     if ( !$ENV{OPM_UNSECURE} ) {  | 
| 
37
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
45
 | 
         %opts = (  | 
| 
38
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             no_network      => 1,  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             expand_entities => 0,  | 
| 
40
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         );  | 
| 
41
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
42
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
43
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
135
 | 
     my $size = -s $file;  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # if file is big, but not "too big"  | 
| 
46
 | 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
36
 | 
     my $max_size = 31_457_280;  | 
| 
47
 | 
12
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
32
 | 
     if ( $ENV{OPM_MAX_SIZE} ) {  | 
| 
48
 | 
7
 | 
 
 | 
 
 | 
 
 | 
 
 | 
22
 | 
         $max_size = reformat_size( $ENV{OPM_MAX_SIZE} );  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
51
 | 
12
 | 
  
100
  
 | 
 
 | 
 
 | 
 
 | 
93
 | 
     if ( $size > $max_size ) {  | 
| 
52
 | 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
409
 | 
         croak "$file too big (max size: $max_size bytes)";  | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
55
 | 
9
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
36
 | 
     if ( $size > 10_000_000 ) {  | 
| 
56
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
         $opts{huge} = 1;  | 
| 
57
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
58
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
59
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
66
 | 
     my $parser = XML::LibXML->new( %opts );  | 
| 
60
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
877
 | 
     my $tree   = $parser->parse_file( $file );  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           | 
| 
62
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
3060
 | 
     my $root_elem = $tree->getDocumentElement;  | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
64
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     # retrieve file information  | 
| 
65
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
69
 | 
     my @package_req = $root_elem->findnodes( 'PackageRequired' );  | 
| 
66
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
465
 | 
     my @modules_req = $root_elem->findnodes( 'ModuleRequired' );  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       | 
| 
68
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
208
 | 
     my %labels = (  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         PackageRequired => 'OPM package',  | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         ModuleRequired  => 'CPAN module',  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     );  | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           | 
| 
73
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     DEP:  | 
| 
74
 | 
9
 | 
 
 | 
 
 | 
 
 | 
 
 | 
34
 | 
     for my $dependency ( @package_req, @modules_req ) {  | 
| 
75
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
89
 | 
         my $type    = $dependency->nodeName;  | 
| 
76
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
47
 | 
         my $version = $dependency->findvalue( '@Version' );  | 
| 
77
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1137
 | 
         my $name    = $dependency->textContent;  | 
| 
78
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
           | 
| 
79
 | 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
1235
 | 
         print "$name - $version (" . $labels{$type} . ")\n";  | 
| 
80
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     }  | 
| 
81
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
82
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
83
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
84
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
85
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |