line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::AUR::URI; |
2
|
|
|
|
|
|
|
|
3
|
12
|
|
|
12
|
|
12586
|
use warnings 'FATAL' => 'all'; |
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
373
|
|
4
|
12
|
|
|
12
|
|
35
|
use strict; |
|
12
|
|
|
|
|
21
|
|
|
12
|
|
|
|
|
172
|
|
5
|
|
|
|
|
|
|
|
6
|
12
|
|
|
12
|
|
31
|
use Carp qw(); |
|
12
|
|
|
|
|
10
|
|
|
12
|
|
|
|
|
114
|
|
7
|
12
|
|
|
12
|
|
5234
|
use URI qw(); |
|
12
|
|
|
|
|
37779
|
|
|
12
|
|
|
|
|
199
|
|
8
|
12
|
|
|
12
|
|
49
|
use Exporter qw(); |
|
12
|
|
|
|
|
10
|
|
|
12
|
|
|
|
|
134
|
|
9
|
|
|
|
|
|
|
|
10
|
12
|
|
|
12
|
|
1575
|
use WWW::AUR qw(); # for global variables |
|
12
|
|
|
|
|
13
|
|
|
12
|
|
|
|
|
3855
|
|
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
|
17
|
|
|
17
|
|
15
|
my ($pkgname) = @_; |
20
|
17
|
|
|
|
|
25
|
return "cgit/aur.git"; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub pkgfile_uri |
24
|
|
|
|
|
|
|
{ |
25
|
12
|
|
|
12
|
1
|
257
|
my ($pkgname) = @_; |
26
|
12
|
|
|
|
|
26
|
my $dir = _pkgdir($pkgname); |
27
|
12
|
|
|
|
|
70
|
return "$Scheme://$WWW::AUR::HOST/$dir/snapshot/$pkgname.tar.gz"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub pkgbuild_uri |
31
|
|
|
|
|
|
|
{ |
32
|
5
|
|
|
5
|
1
|
6
|
my ($pkgname) = @_; |
33
|
5
|
|
|
|
|
10
|
my $dir = _pkgdir($pkgname); |
34
|
5
|
|
|
|
|
25
|
return "$Scheme://$WWW::AUR::HOST/$dir/plain/PKGBUILD?h=$pkgname" |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub pkgsubmit_uri |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
1
|
0
|
return; |
40
|
0
|
|
|
|
|
0
|
return "$Scheme://$WWW::AUR::HOST/submit/"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub pkg_uri |
44
|
|
|
|
|
|
|
{ |
45
|
4
|
|
|
4
|
1
|
18
|
my %params = @_; |
46
|
4
|
|
|
|
|
37
|
my $uri = URI->new( "$Scheme://$WWW::AUR::HOST/packages/" ); |
47
|
4
|
|
|
|
|
6126
|
$uri->query_form([ %params ]); |
48
|
4
|
|
|
|
|
380
|
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
|
1714
|
my $method = shift; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Carp::croak( "$method is not a valid AUR RPC method" ) |
58
|
123
|
50
|
|
|
|
326
|
unless grep { $_ eq $method } @_RPC_METHODS; |
|
492
|
|
|
|
|
864
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# The RPC only works with https. |
61
|
123
|
|
|
|
|
952
|
my $uri = URI->new( "$Scheme://$WWW::AUR::HOST/rpc" ); |
62
|
|
|
|
|
|
|
|
63
|
123
|
|
|
|
|
62889
|
my @qparms = ( 'type' => $method ); |
64
|
123
|
100
|
|
|
|
315
|
if ($method eq 'multiinfo') { |
65
|
2
|
|
|
|
|
6
|
push @qparms, map { ( 'arg[]' => $_ ) } @_; |
|
4
|
|
|
|
|
10
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
else { |
68
|
121
|
|
|
|
|
282
|
push @qparms, ( 'arg' => shift ); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
123
|
|
|
|
|
646
|
$uri->query_form( \@qparms ); |
72
|
123
|
|
|
|
|
9147
|
return $uri->as_string; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |