line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Win32::Vcpkg::List; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
498
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
17
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
4
|
use Win32::Vcpkg; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
7
|
1
|
|
|
1
|
|
4
|
use Path::Tiny (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
12
|
|
8
|
1
|
|
|
1
|
|
604
|
use Storable qw( dclone ); |
|
1
|
|
|
|
|
2882
|
|
|
1
|
|
|
|
|
945
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Interface to Microsoft Vcpkg List of Packages |
11
|
|
|
|
|
|
|
our $VERSION = '0.03'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub new |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
1
|
5783
|
my($class, %args) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
8
|
my $root = defined $args{root} ? Path::Tiny->new($args{root}) : Win32::Vcpkg->root; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
|
|
166
|
my $vcpkg_exe = $root->child('vcpkg.exe'); |
21
|
1
|
50
|
|
|
|
32
|
if(-x $vcpkg_exe) |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
# TODO: this is a bit flaky, the root directory might |
24
|
|
|
|
|
|
|
# not have vcpkg.exe. |
25
|
0
|
|
|
|
|
0
|
`$vcpkg_exe list`; # force a rebuild of the status file |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
47
|
my $status = $root->child('installed', 'vcpkg', 'status'); |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
33
|
my @status; |
31
|
|
|
|
|
|
|
my %arch; |
32
|
|
|
|
|
|
|
{ |
33
|
1
|
|
|
|
|
1
|
my %entry; |
|
1
|
|
|
|
|
2
|
|
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
4
|
foreach my $line ($status->lines) |
36
|
|
|
|
|
|
|
{ |
37
|
219
|
|
|
|
|
500
|
chomp $line; |
38
|
219
|
100
|
|
|
|
509
|
if($line =~ /^(.*?):\s*(.*)$/) |
|
|
50
|
|
|
|
|
|
39
|
|
|
|
|
|
|
{ |
40
|
195
|
|
|
|
|
396
|
my($k,$v) = ($1, $2); |
41
|
195
|
|
|
|
|
256
|
$entry{$k} = $v; |
42
|
195
|
100
|
|
|
|
318
|
$arch{$v}++ if $k eq 'Architecture'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
elsif($line =~ /^\s*$/) |
45
|
|
|
|
|
|
|
{ |
46
|
24
|
50
|
|
|
|
34
|
if(%entry) |
47
|
|
|
|
|
|
|
{ |
48
|
24
|
|
|
|
|
316
|
push @status, dclone(\%entry); |
49
|
24
|
|
|
|
|
67
|
%entry = (); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
1
|
50
|
|
|
|
11
|
if(%entry) |
55
|
|
|
|
|
|
|
{ |
56
|
0
|
|
|
|
|
0
|
push @status, \%entry; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
bless { |
61
|
1
|
|
|
|
|
13
|
root => $root, |
62
|
|
|
|
|
|
|
status => \@status, |
63
|
|
|
|
|
|
|
triplets => [sort keys %arch], |
64
|
|
|
|
|
|
|
}, $class; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
8
|
|
|
8
|
1
|
2602
|
sub root { shift->{root} } |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
1
|
456
|
sub triplets { @{ shift->{triplets} } } |
|
1
|
|
|
|
|
4
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub search |
75
|
|
|
|
|
|
|
{ |
76
|
4
|
|
|
4
|
1
|
964
|
my($self, $name, %options) = @_; |
77
|
4
|
|
66
|
|
|
19
|
my $triplet = $options{triplet} || Win32::Vcpkg->perl_triplet; |
78
|
4
|
100
|
|
|
|
19
|
my $debug = defined $options{debug} ? $options{debug} : $ENV{PERL_WIN32_VCPKG_DEBUG}; |
79
|
|
|
|
|
|
|
|
80
|
4
|
|
|
|
|
6
|
foreach my $status (@{ $self->{status} }) |
|
4
|
|
|
|
|
9
|
|
81
|
|
|
|
|
|
|
{ |
82
|
|
|
|
|
|
|
next unless $status->{Architecture} eq $triplet |
83
|
|
|
|
|
|
|
&& $status->{Package} eq $name |
84
|
|
|
|
|
|
|
&& !defined $status->{Feature} |
85
|
|
|
|
|
|
|
&& $status->{Version} |
86
|
50
|
50
|
100
|
|
|
132
|
&& $status->{Status} eq 'install ok installed'; |
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
33
|
|
|
|
|
87
|
|
|
|
|
|
|
|
88
|
3
|
|
|
|
|
6
|
my $version = $status->{Version}; |
89
|
3
|
|
|
|
|
7
|
my $file_list = $self->root->child('installed','vcpkg','info',sprintf("%s_%s_%s.list", $name, $version, $triplet)); |
90
|
3
|
50
|
|
|
|
112
|
if($file_list->is_file) |
91
|
|
|
|
|
|
|
{ |
92
|
3
|
|
|
|
|
69
|
my @lib; |
93
|
3
|
|
|
|
|
10
|
my $libpath = Path::Tiny->new($triplet, 'lib'); |
94
|
3
|
100
|
|
|
|
85
|
$libpath = $libpath->parent->child('debug','lib') if $debug; |
95
|
3
|
|
|
|
|
93
|
foreach my $line ($file_list->lines) |
96
|
|
|
|
|
|
|
{ |
97
|
72
|
|
|
|
|
2001
|
chomp $line; |
98
|
72
|
|
|
|
|
117
|
my $path = Path::Tiny->new($line); |
99
|
72
|
100
|
|
|
|
1510
|
if($path->basename =~ /^(.*?)\.lib$/) |
100
|
|
|
|
|
|
|
{ |
101
|
6
|
100
|
|
|
|
105
|
if($path->parent->stringify eq $libpath->stringify) |
102
|
|
|
|
|
|
|
{ |
103
|
3
|
|
|
|
|
109
|
push @lib, "$1"; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
3
|
|
|
|
|
483
|
require Win32::Vcpkg::Package; |
108
|
3
|
|
|
|
|
11
|
return Win32::Vcpkg::Package->new( |
109
|
|
|
|
|
|
|
_name => $name, |
110
|
|
|
|
|
|
|
_version => $version, |
111
|
|
|
|
|
|
|
root => $self->root, |
112
|
|
|
|
|
|
|
triplet => $triplet, |
113
|
|
|
|
|
|
|
debug => $debug, |
114
|
|
|
|
|
|
|
lib => \@lib, |
115
|
|
|
|
|
|
|
); |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
else |
118
|
|
|
|
|
|
|
{ |
119
|
0
|
|
|
|
|
0
|
require Carp; |
120
|
0
|
|
|
|
|
0
|
Carp::croak("unable to find file list for $name $version $triplet"); |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
1
|
|
|
|
|
3
|
return undef; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |