line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::AUR::URI; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
20430
|
use warnings 'FATAL' => 'all'; |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
2310
|
|
4
|
12
|
|
|
12
|
|
199
|
use strict; |
|
12
|
|
|
|
|
41
|
|
|
12
|
|
|
|
|
398
|
|
5
|
|
|
|
|
|
|
|
6
|
12
|
|
|
12
|
|
64
|
use Carp qw(); |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
194
|
|
7
|
12
|
|
|
12
|
|
13468
|
use URI qw(); |
|
12
|
|
|
|
|
74578
|
|
|
12
|
|
|
|
|
408
|
|
8
|
12
|
|
|
12
|
|
108
|
use Exporter qw(); |
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
215
|
|
9
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
3797
|
use WWW::AUR qw(); # for global variables |
|
12
|
|
|
|
|
29
|
|
|
12
|
|
|
|
|
6878
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
13
|
|
|
|
|
|
|
our @EXPORT_OK = qw(pkgfile_uri pkgbuild_uri pkgsubmit_uri pkg_uri rpc_uri); |
14
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ @EXPORT_OK ] ); |
15
|
|
|
|
|
|
|
our $Scheme = 'https'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _pkgdir |
18
|
|
|
|
|
|
|
{ |
19
|
19
|
|
|
19
|
|
32
|
my ($pkgname) = @_; |
20
|
19
|
|
|
|
|
50
|
my $pre = substr $pkgname, 0, 2; |
21
|
19
|
|
|
|
|
153
|
return "packages/$pre/$pkgname"; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub pkgfile_uri |
25
|
|
|
|
|
|
|
{ |
26
|
14
|
|
|
14
|
1
|
390
|
my ($pkgname) = @_; |
27
|
14
|
|
|
|
|
44
|
my $dir = _pkgdir($pkgname); |
28
|
14
|
|
|
|
|
109
|
return "$Scheme://$WWW::AUR::HOST/$dir/$pkgname.tar.gz"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub pkgbuild_uri |
32
|
|
|
|
|
|
|
{ |
33
|
5
|
|
|
5
|
1
|
15
|
my ($pkgname) = @_; |
34
|
5
|
|
|
|
|
14
|
my $dir = _pkgdir($pkgname); |
35
|
5
|
|
|
|
|
36
|
return "$Scheme://$WWW::AUR::HOST/$dir/PKGBUILD" |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub pkgsubmit_uri |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
0
|
1
|
0
|
return "$Scheme://$WWW::AUR::HOST/submit/"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub pkg_uri |
44
|
|
|
|
|
|
|
{ |
45
|
4
|
|
|
4
|
1
|
32
|
my %params = @_; |
46
|
4
|
|
|
|
|
40
|
my $uri = URI->new( "$Scheme://$WWW::AUR::HOST/packages/" ); |
47
|
4
|
|
|
|
|
10536
|
$uri->query_form([ %params ]); |
48
|
4
|
|
|
|
|
704
|
return $uri->as_string; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my @_RPC_METHODS = qw/ search info multiinfo msearch /; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub rpc_uri |
54
|
|
|
|
|
|
|
{ |
55
|
123
|
|
|
123
|
1
|
2375
|
my $method = shift; |
56
|
|
|
|
|
|
|
|
57
|
492
|
|
|
|
|
2222
|
Carp::croak( "$method is not a valid AUR RPC method" ) |
58
|
123
|
50
|
|
|
|
385
|
unless grep { $_ eq $method } @_RPC_METHODS; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# The RPC only works with https. |
61
|
123
|
|
|
|
|
1075
|
my $uri = URI->new( "$Scheme://$WWW::AUR::HOST/rpc" ); |
62
|
|
|
|
|
|
|
|
63
|
123
|
|
|
|
|
116047
|
my @qparms = ( 'type' => $method ); |
64
|
123
|
100
|
|
|
|
348
|
if ($method eq 'multiinfo') { |
65
|
2
|
|
|
|
|
5
|
push @qparms, map { ( 'arg[]' => $_ ) } @_; |
|
4
|
|
|
|
|
12
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { |
68
|
121
|
|
|
|
|
396
|
push @qparms, ( 'arg' => shift ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
123
|
|
|
|
|
854
|
$uri->query_form( \@qparms ); |
72
|
123
|
|
|
|
|
16282
|
return $uri->as_string; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |