line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# vim: set ts=2 sw=2 tw=0: |
5
|
|
|
|
|
|
|
# vim: set expandtab: |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Rex::Apache::Deploy::tgz - Deploy tgz package |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
With this module you can deploy a TGZ packages. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
If the package is not build yet, it will pass all the arguments to the build() function and executes the build on the local machine. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
deploy "my-software.tgz"; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
deploy "my-software", |
22
|
|
|
|
|
|
|
type => "rpm", |
23
|
|
|
|
|
|
|
version => "1.0", |
24
|
|
|
|
|
|
|
# below this, it is all optional |
25
|
|
|
|
|
|
|
source => "html", |
26
|
|
|
|
|
|
|
path => "/var/www/html"; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
package Rex::Apache::Deploy::Package::tgz; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
1547
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
33
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
1
|
|
5
|
use Rex::Apache::Build; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
90
|
|
36
|
1
|
|
|
1
|
|
5
|
use Rex::Commands; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
37
|
1
|
|
|
1
|
|
862
|
use Rex::Commands::Upload; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
38
|
1
|
|
|
1
|
|
48
|
use Rex::Commands::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
39
|
1
|
|
|
1
|
|
77
|
use Rex::Commands::Fs; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
40
|
1
|
|
|
1
|
|
418
|
use Rex::Apache::Deploy::Package::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
41
|
1
|
|
|
1
|
|
29
|
use base qw(Rex::Apache::Deploy::Package::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
328
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub new { |
44
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
45
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
46
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return $self; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub deploy { |
54
|
0
|
|
|
0
|
0
|
|
my ( $self, $package_name, %option ) = @_; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
LOCAL { |
57
|
0
|
0
|
|
0
|
|
|
if ( !-f $package_name ) { |
58
|
0
|
|
|
|
|
|
$package_name = $self->name . "-" . $self->version . ".tar.gz"; |
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
if ( !-f $package_name ) { |
61
|
0
|
|
|
|
|
|
build( $self->name, %option ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
0
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
upload $package_name, "/tmp"; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $to = $self->prefix; |
69
|
0
|
|
|
|
|
|
run "tar -C $to -xzf /tmp/$package_name"; |
70
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
71
|
0
|
|
|
|
|
|
die("Error installing $package_name"); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
Rex::Logger::info("Package $package_name installed."); |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
unlink "/tmp/$package_name"; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |