| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dist::Inkt::Role::ProcessDOAPDeps; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
4
|
|
|
|
|
|
|
our $VERSION = '0.021'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
1996
|
use Moose::Role; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use namespace::autoclean; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Dist::Inkt::Role::RDFModel'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use RDF::Trine::Namespace qw[RDF RDFS OWL XSD]; |
|
12
|
|
|
|
|
|
|
my $CPAN = RDF::Trine::Namespace->new('http://purl.org/NET/cpan-uri/terms#'); |
|
13
|
|
|
|
|
|
|
my $DC = RDF::Trine::Namespace->new('http://purl.org/dc/terms/'); |
|
14
|
|
|
|
|
|
|
my $DOAP = RDF::Trine::Namespace->new('http://usefulinc.com/ns/doap#'); |
|
15
|
|
|
|
|
|
|
my $DEPS = RDF::Trine::Namespace->new('http://ontologi.es/doap-deps#'); |
|
16
|
|
|
|
|
|
|
my $FOAF = RDF::Trine::Namespace->new('http://xmlns.com/foaf/0.1/'); |
|
17
|
|
|
|
|
|
|
my $NFO = RDF::Trine::Namespace->new('http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#'); |
|
18
|
|
|
|
|
|
|
my $SKOS = RDF::Trine::Namespace->new('http://www.w3.org/2004/02/skos/core#'); |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
after PopulateMetadata => sub |
|
21
|
|
|
|
|
|
|
{ |
|
22
|
|
|
|
|
|
|
my $self = shift; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
$self->log('Processing the DOAP Deps vocabulary'); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->cpanterms_deps; |
|
27
|
|
|
|
|
|
|
$self->doap_deps; |
|
28
|
|
|
|
|
|
|
$self->doap_deps_features; |
|
29
|
|
|
|
|
|
|
}; |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub cpanterms_deps |
|
33
|
|
|
|
|
|
|
{ |
|
34
|
|
|
|
|
|
|
my $self = shift; |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $meta = $self->metadata; |
|
37
|
|
|
|
|
|
|
my $model = $self->model; |
|
38
|
|
|
|
|
|
|
my $uri = 'RDF::Trine::Node::Resource'->new($self->project_uri); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my @terms = qw(requires build_requires configure_requires test_requires recommends); |
|
41
|
|
|
|
|
|
|
my %term_map = ( |
|
42
|
|
|
|
|
|
|
requires => [ 'runtime', 'requires' ], |
|
43
|
|
|
|
|
|
|
build_requires => [ 'build', 'requires' ], |
|
44
|
|
|
|
|
|
|
configure_requires => [ 'configure', 'requires' ], |
|
45
|
|
|
|
|
|
|
test_requires => [ 'test', 'requires' ], |
|
46
|
|
|
|
|
|
|
recommends => [ 'runtime', 'recommends' ], |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
foreach my $term (@terms) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
my ($phase, $level) = @{$term_map{$term}}; |
|
51
|
|
|
|
|
|
|
my $Reqs; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
foreach my $dep ($model->objects($uri, $CPAN->$term)) |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
|
|
|
|
|
|
$Reqs ||= 'CPAN::Meta::Requirements'->from_string_hash($meta->{prereqs}{$phase}{$level} || {}); |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$self->log("WARNING: $term is deprecated in favour of http://ontologi.es/doap-deps#"); |
|
58
|
|
|
|
|
|
|
if ($dep->is_literal) |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
|
|
|
|
|
|
my ($mod, $ver) = split /\s+/, $dep->literal_value, 2; |
|
61
|
|
|
|
|
|
|
$ver ||= 0; |
|
62
|
|
|
|
|
|
|
no warnings; |
|
63
|
|
|
|
|
|
|
$meta->{prereqs}{$phase}{$level}->add_string_requirement($mod, $ver) |
|
64
|
|
|
|
|
|
|
unless $meta->{prereqs}{$phase}{$level}{$mod} > $ver; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
else |
|
67
|
|
|
|
|
|
|
{ |
|
68
|
|
|
|
|
|
|
$self->log("WARNING: Dunno what to do with ${dep}... we'll figure something out eventually."); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$meta->{prereqs}{$phase}{$level} = $Reqs->as_string_hash if $Reqs; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub doap_deps |
|
77
|
|
|
|
|
|
|
{ |
|
78
|
|
|
|
|
|
|
my $self = shift; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
my $meta = $self->metadata; |
|
81
|
|
|
|
|
|
|
my $model = $self->model; |
|
82
|
|
|
|
|
|
|
my $uri = 'RDF::Trine::Node::Resource'->new($self->project_uri); |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
foreach my $phase (qw/ configure build test runtime develop /) |
|
85
|
|
|
|
|
|
|
{ |
|
86
|
|
|
|
|
|
|
foreach my $level (qw/ requirement recommendation suggestion conflict /) |
|
87
|
|
|
|
|
|
|
{ |
|
88
|
|
|
|
|
|
|
my $Reqs; |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $term = "${phase}-${level}"; |
|
91
|
|
|
|
|
|
|
my $level2 = { |
|
92
|
|
|
|
|
|
|
requirement => 'requires', |
|
93
|
|
|
|
|
|
|
recommendation => 'recommends', |
|
94
|
|
|
|
|
|
|
suggestion => 'suggests', |
|
95
|
|
|
|
|
|
|
conflict => 'conflicts', |
|
96
|
|
|
|
|
|
|
}->{$level}; |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
foreach my $dep ( $model->objects($uri, $DEPS->uri($term)) ) |
|
99
|
|
|
|
|
|
|
{ |
|
100
|
|
|
|
|
|
|
$Reqs ||= 'CPAN::Meta::Requirements'->from_string_hash($meta->{prereqs}{$phase}{$level2} || {}); |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
if ($dep->is_literal) |
|
103
|
|
|
|
|
|
|
{ |
|
104
|
|
|
|
|
|
|
$self->log("WARNING: ". $DEPS->$term . " expects a resource, not literal $dep!"); |
|
105
|
|
|
|
|
|
|
next; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
foreach my $ident ( $model->objects($dep, $DEPS->on) ) |
|
109
|
|
|
|
|
|
|
{ |
|
110
|
|
|
|
|
|
|
unless ($ident->is_literal |
|
111
|
|
|
|
|
|
|
and $ident->has_datatype |
|
112
|
|
|
|
|
|
|
and $ident->literal_datatype eq $DEPS->CpanId->uri) |
|
113
|
|
|
|
|
|
|
{ |
|
114
|
|
|
|
|
|
|
$self->log("WARNING: Dunno what to do with ${ident}... we'll figure something out eventually."); |
|
115
|
|
|
|
|
|
|
next; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my ($mod, $ver) = split /\s+/, $ident->literal_value, 2; |
|
119
|
|
|
|
|
|
|
$ver ||= 0; |
|
120
|
|
|
|
|
|
|
no warnings; |
|
121
|
|
|
|
|
|
|
$Reqs->add_string_requirement($mod => $ver); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
if ($phase eq 'runtime' and $level eq 'conflict' and $ver =~ m{\A<= (v?[0-9_.]+)\z}) |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
|
|
|
|
|
|
$meta->{x_breaks}{$mod} = $1; |
|
126
|
|
|
|
|
|
|
} |
|
127
|
|
|
|
|
|
|
} |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
$meta->{prereqs}{$phase}{$level2} = $Reqs->as_string_hash if $Reqs; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
} |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub doap_deps_features |
|
136
|
|
|
|
|
|
|
{ |
|
137
|
|
|
|
|
|
|
my $self = shift; |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
my $meta = $self->metadata; |
|
140
|
|
|
|
|
|
|
my $model = $self->model; |
|
141
|
|
|
|
|
|
|
my $uri = 'RDF::Trine::Node::Resource'->new($self->project_uri); |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
my %F; |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
foreach my $feature ($model->objects($uri, $DEPS->feature)) |
|
146
|
|
|
|
|
|
|
{ |
|
147
|
|
|
|
|
|
|
my %f; |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
my ($label) = |
|
150
|
|
|
|
|
|
|
map $_->literal_value, |
|
151
|
|
|
|
|
|
|
grep $_->is_literal, |
|
152
|
|
|
|
|
|
|
$model->objects($feature, $DOAP->name); |
|
153
|
|
|
|
|
|
|
my ($desc) = |
|
154
|
|
|
|
|
|
|
map $_->literal_value, |
|
155
|
|
|
|
|
|
|
grep $_->is_literal, |
|
156
|
|
|
|
|
|
|
$model->objects($feature, $DOAP->shortdesc); |
|
157
|
|
|
|
|
|
|
my ($default) = |
|
158
|
|
|
|
|
|
|
map $_->literal_value, |
|
159
|
|
|
|
|
|
|
grep $_->is_literal, |
|
160
|
|
|
|
|
|
|
$model->objects($feature, $DEPS->x_default); |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
die "Feature defined with no name: $feature" unless defined $label; |
|
163
|
|
|
|
|
|
|
$f{description} = $desc if defined $desc; |
|
164
|
|
|
|
|
|
|
$f{x_default} = 0+!!( lc($default||'') eq 'true' ); |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
foreach my $phase (qw/ configure build test runtime develop /) |
|
167
|
|
|
|
|
|
|
{ |
|
168
|
|
|
|
|
|
|
foreach my $level (qw/ requirement recommendation suggestion conflict /) |
|
169
|
|
|
|
|
|
|
{ |
|
170
|
|
|
|
|
|
|
my $Reqs; |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $term = "${phase}-${level}"; |
|
173
|
|
|
|
|
|
|
my $level2 = { |
|
174
|
|
|
|
|
|
|
requirement => 'requires', |
|
175
|
|
|
|
|
|
|
recommendation => 'recommends', |
|
176
|
|
|
|
|
|
|
suggestion => 'suggests', |
|
177
|
|
|
|
|
|
|
conflict => 'conflicts', |
|
178
|
|
|
|
|
|
|
}->{$level}; |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
foreach my $dep ( $model->objects($feature, $DEPS->uri($term)) ) |
|
181
|
|
|
|
|
|
|
{ |
|
182
|
|
|
|
|
|
|
$Reqs ||= 'CPAN::Meta::Requirements'->from_string_hash($meta->{optional_features}{$label}{$phase}{$level2} || {}); |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
if ($dep->is_literal) |
|
185
|
|
|
|
|
|
|
{ |
|
186
|
|
|
|
|
|
|
$self->log("WARNING: ". $DEPS->$term . " expects a resource, not literal $dep!"); |
|
187
|
|
|
|
|
|
|
next; |
|
188
|
|
|
|
|
|
|
} |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
foreach my $ident ( $model->objects($dep, $DEPS->on) ) |
|
191
|
|
|
|
|
|
|
{ |
|
192
|
|
|
|
|
|
|
unless ($ident->is_literal |
|
193
|
|
|
|
|
|
|
and $ident->has_datatype |
|
194
|
|
|
|
|
|
|
and $ident->literal_datatype eq $DEPS->CpanId->uri) |
|
195
|
|
|
|
|
|
|
{ |
|
196
|
|
|
|
|
|
|
$self->log("WARNING: Dunno what to do with ${ident}... we'll figure something out eventually."); |
|
197
|
|
|
|
|
|
|
next; |
|
198
|
|
|
|
|
|
|
} |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
my ($mod, $ver) = split /\s+/, $ident->literal_value, 2; |
|
201
|
|
|
|
|
|
|
$ver ||= 0; |
|
202
|
|
|
|
|
|
|
no warnings; |
|
203
|
|
|
|
|
|
|
$Reqs->add_string_requirement($mod => $ver); |
|
204
|
|
|
|
|
|
|
} |
|
205
|
|
|
|
|
|
|
} |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
$f{prereqs}{$phase}{$level2} = $Reqs->as_string_hash if $Reqs; |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
$F{$label} = \%f; |
|
212
|
|
|
|
|
|
|
} |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
$meta->{optional_features} = \%F; |
|
215
|
|
|
|
|
|
|
} |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
1; |