line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Win32::Vcpkg::List; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
425
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
18
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
4
|
use Win32::Vcpkg; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
7
|
1
|
|
|
1
|
|
5
|
use Path::Tiny (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
8
|
1
|
|
|
1
|
|
592
|
use Storable qw( dclone ); |
|
1
|
|
|
|
|
2856
|
|
|
1
|
|
|
|
|
621
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Interface to Microsoft Vcpkg List of Packages |
11
|
|
|
|
|
|
|
our $VERSION = '0.02'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
1
|
5739
|
my($class, %args) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
8
|
my $root = defined $args{root} ? Path::Tiny->new($args{root}) : Win32::Vcpkg->root; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
189
|
my $status = $root->child('installed', 'vcpkg', 'status'); |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
34
|
my @status; |
23
|
|
|
|
|
|
|
my %arch; |
24
|
|
|
|
|
|
|
{ |
25
|
1
|
|
|
|
|
2
|
my %entry; |
|
1
|
|
|
|
|
2
|
|
26
|
|
|
|
|
|
|
|
27
|
1
|
|
|
|
|
5
|
foreach my $line ($status->lines) |
28
|
|
|
|
|
|
|
{ |
29
|
219
|
|
|
|
|
554
|
chomp $line; |
30
|
219
|
100
|
|
|
|
583
|
if($line =~ /^(.*?):\s*(.*)$/) |
|
|
50
|
|
|
|
|
|
31
|
|
|
|
|
|
|
{ |
32
|
195
|
|
|
|
|
439
|
my($k,$v) = ($1, $2); |
33
|
195
|
|
|
|
|
341
|
$entry{$k} = $v; |
34
|
195
|
100
|
|
|
|
386
|
$arch{$v}++ if $k eq 'Architecture'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
elsif($line =~ /^\s*$/) |
37
|
|
|
|
|
|
|
{ |
38
|
24
|
50
|
|
|
|
42
|
if(%entry) |
39
|
|
|
|
|
|
|
{ |
40
|
24
|
|
|
|
|
362
|
push @status, dclone(\%entry); |
41
|
24
|
|
|
|
|
71
|
%entry = (); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
1
|
50
|
|
|
|
24
|
if(%entry) |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
|
|
0
|
push @status, \%entry; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
bless { |
53
|
1
|
|
|
|
|
18
|
root => $root, |
54
|
|
|
|
|
|
|
status => \@status, |
55
|
|
|
|
|
|
|
triplets => [sort keys %arch], |
56
|
|
|
|
|
|
|
}, $class; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
8
|
|
|
8
|
1
|
2927
|
sub root { shift->{root} } |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
1
|
|
|
1
|
1
|
496
|
sub triplets { @{ shift->{triplets} } } |
|
1
|
|
|
|
|
4
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub search |
67
|
|
|
|
|
|
|
{ |
68
|
4
|
|
|
4
|
1
|
1022
|
my($self, $name, %options) = @_; |
69
|
4
|
|
66
|
|
|
20
|
my $triplet = $options{triplet} || Win32::Vcpkg->perl_triplet; |
70
|
4
|
100
|
|
|
|
24
|
my $debug = defined $options{debug} ? $options{debug} : $ENV{PERL_WIN32_VCPKG_DEBUG}; |
71
|
|
|
|
|
|
|
|
72
|
4
|
|
|
|
|
6
|
foreach my $status (@{ $self->{status} }) |
|
4
|
|
|
|
|
9
|
|
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
next unless $status->{Architecture} eq $triplet |
75
|
|
|
|
|
|
|
&& $status->{Package} eq $name |
76
|
|
|
|
|
|
|
&& !defined $status->{Feature} |
77
|
50
|
50
|
100
|
|
|
145
|
&& $status->{Version}; |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
3
|
|
|
|
|
15
|
my $version = $status->{Version}; |
80
|
3
|
|
|
|
|
9
|
my $file_list = $self->root->child('installed','vcpkg','info',sprintf("%s_%s_%s.list", $name, $version, $triplet)); |
81
|
3
|
50
|
|
|
|
134
|
if($file_list->is_file) |
82
|
|
|
|
|
|
|
{ |
83
|
3
|
|
|
|
|
83
|
my @lib; |
84
|
3
|
|
|
|
|
10
|
my $libpath = Path::Tiny->new($triplet, 'lib'); |
85
|
3
|
100
|
|
|
|
95
|
$libpath = $libpath->parent->child('debug','lib') if $debug; |
86
|
3
|
|
|
|
|
83
|
foreach my $line ($file_list->lines) |
87
|
|
|
|
|
|
|
{ |
88
|
72
|
|
|
|
|
1795
|
chomp $line; |
89
|
72
|
|
|
|
|
140
|
my $path = Path::Tiny->new($line); |
90
|
72
|
100
|
|
|
|
1682
|
if($path->basename =~ /^(.*?)\.lib$/) |
91
|
|
|
|
|
|
|
{ |
92
|
6
|
100
|
|
|
|
116
|
if($path->parent->stringify eq $libpath->stringify) |
93
|
|
|
|
|
|
|
{ |
94
|
3
|
|
|
|
|
116
|
push @lib, "$1"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
3
|
|
|
|
|
541
|
require Win32::Vcpkg::Package; |
99
|
3
|
|
|
|
|
11
|
return Win32::Vcpkg::Package->new( |
100
|
|
|
|
|
|
|
_name => $name, |
101
|
|
|
|
|
|
|
_version => $version, |
102
|
|
|
|
|
|
|
root => $self->root, |
103
|
|
|
|
|
|
|
triplet => $triplet, |
104
|
|
|
|
|
|
|
debug => $debug, |
105
|
|
|
|
|
|
|
lib => \@lib, |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
else |
109
|
|
|
|
|
|
|
{ |
110
|
0
|
|
|
|
|
0
|
require Carp; |
111
|
0
|
|
|
|
|
0
|
Carp::croak("unable to find file list for $name $version $triplet"); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
1
|
|
|
|
|
4
|
return undef; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
__END__ |