line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TAPPER'; |
2
|
|
|
|
|
|
|
$Tapper::Installer::Precondition::Repository::VERSION = '5.0.1'; |
3
|
|
|
|
|
|
|
use strict; |
4
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
77
|
|
5
|
3
|
|
|
3
|
|
13
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
62
|
|
6
|
|
|
|
|
|
|
use File::Basename; |
7
|
3
|
|
|
3
|
|
13
|
use Moose; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
144
|
|
8
|
3
|
|
|
3
|
|
14
|
extends 'Tapper::Installer::Precondition'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
24
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ($self, $repo) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
0
|
1
|
|
return "no url given to git_get" if not $repo->{url}; |
17
|
|
|
|
|
|
|
if (not $repo->{target}) { |
18
|
0
|
0
|
|
|
|
|
$repo->{target} = basename($repo->{url},(".git")); |
19
|
0
|
0
|
|
|
|
|
} |
20
|
0
|
|
|
|
|
|
$repo->{target} = $self->cfg->{paths}{base_dir}.$repo->{target}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
my ($error, $retval) = $self->log_and_exec("git","clone","-q",$repo->{url},$repo->{target}); |
23
|
|
|
|
|
|
|
return($retval) if $error; |
24
|
0
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
if ($repo->{revision}) { |
26
|
|
|
|
|
|
|
chdir ($repo->{target}); |
27
|
0
|
0
|
|
|
|
|
($error,$retval) = $self->log_and_exec("git","checkout",$repo->{revision}); |
28
|
0
|
|
|
|
|
|
return($retval) if $error; |
29
|
0
|
|
|
|
|
|
} |
30
|
0
|
0
|
|
|
|
|
return(0); |
31
|
|
|
|
|
|
|
} |
32
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my ($self, $repo) = @_; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return "no url given to hg_get" if not $repo->{url}; |
37
|
0
|
|
|
0
|
1
|
|
if (not $repo->{target}) { |
38
|
|
|
|
|
|
|
$repo->{target} = basename($repo->{url},(".hg")); |
39
|
0
|
0
|
|
|
|
|
} |
40
|
0
|
0
|
|
|
|
|
$repo->{target} = $self->cfg->{paths}{base_dir}.$repo->{target}; |
41
|
0
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
my ($error, $retval) = $self->log_and_exec("hg","clone","-q",$repo->{url},$repo->{target}); |
43
|
0
|
|
|
|
|
|
return($retval) if $error; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
if ($repo->{revision}) { |
46
|
0
|
0
|
|
|
|
|
($error, $retval) = $self->log_and_exec("hg","update",$repo->{revision}); |
47
|
|
|
|
|
|
|
return($retval) if $error; |
48
|
0
|
0
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
return(0); |
50
|
0
|
0
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my ($self, $repo) = @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->log->error("unimplemented"); |
56
|
|
|
|
|
|
|
} |
57
|
0
|
|
|
0
|
1
|
|
|
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
my ($self, $repository) = @_; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
return "No repository type given" if not $repository->{type}; |
63
|
|
|
|
|
|
|
if ($repository->{type} eq "git") { |
64
|
|
|
|
|
|
|
return $self->git_get($repository); |
65
|
0
|
|
|
0
|
1
|
|
} elsif ($repository->{type} eq "hg") { |
66
|
|
|
|
|
|
|
return $self->hg_get($repository); |
67
|
0
|
0
|
|
|
|
|
} elsif ($repository->{type} eq "svn") { |
68
|
0
|
0
|
|
|
|
|
return $self->svn_get($repository); |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
} else { |
70
|
|
|
|
|
|
|
return ("Unknown repository type:",$repository->{type}); |
71
|
0
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
return "Bug: Repository::install() got after if/else."; |
73
|
0
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=encoding UTF-8 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 NAME |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Tapper::Installer::Precondition::Repository |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 SYNOPSIS |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
use Tapper::Installer::Precondition::Repository; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
Tapper::Installer::Precondition::Repository - Install a repository to a given location |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 FUNCTIONS |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 git_get |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This function encapsulates getting data out of a git repository. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
@param hash reference - repository data |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
@retval success - 0 |
103
|
|
|
|
|
|
|
@retval error - error string |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 hg_get |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
This function encapsulates getting data out of a mercurial repository. |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
@param hash reference - repository data |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
@retval success - 0 |
112
|
|
|
|
|
|
|
@retval error - error string |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 svn_get |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This function encapsulates getting data out of a subversion repository. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
@param hash reference - repository data |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
@retval success - 0 |
121
|
|
|
|
|
|
|
@retval error - error string |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head2 install |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHORS |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over 4 |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item * |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
AMD OSRC Tapper Team <tapper@amd64.org> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item * |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Tapper Team <tapper-ops@amazon.com> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=back |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Advanced Micro Devices, Inc. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This is free software, licensed under: |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
The (two-clause) FreeBSD License |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |