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
|
|
|
|
|
|
|
package Rex::Apache::Deploy::Package; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
2069
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
10
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Cwd qw(getcwd); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
13
|
1
|
|
|
1
|
|
7
|
use File::Basename; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
99
|
|
14
|
1
|
|
|
1
|
|
15
|
use Rex::Apache::Build; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
132
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
7
|
use vars qw(@EXPORT); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
447
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
@EXPORT = qw(deploy); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub deploy { |
21
|
0
|
|
|
0
|
0
|
|
my ( $name, %option ) = @_; |
22
|
|
|
|
|
|
|
|
23
|
0
|
0
|
|
|
|
|
unless ($name) { |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# if no file is given, use directory name |
26
|
0
|
|
|
|
|
|
$name = basename( getcwd() ); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
if ( !%option ) { |
30
|
0
|
0
|
|
|
|
|
if ( Rex::Config->get("package_option") ) { |
31
|
0
|
|
|
|
|
|
%option = %{ Rex::Config->get("package_option") }; |
|
0
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if ( !exists $option{type} ) { |
36
|
0
|
0
|
|
|
|
|
if ( $name =~ m/\.deb$/ ) { |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$option{type} = "deb"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
elsif ( $name =~ m/\.rpm$/ ) { |
40
|
0
|
|
|
|
|
|
$option{type} = "rpm"; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
elsif ( $name =~ m/(\.tgz|\.gz)$/ ) { |
43
|
0
|
|
|
|
|
|
$option{type} = "tgz"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
0
|
|
|
|
|
|
$option{type} = "tgz"; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $klass = "Rex::Apache::Deploy::Package::" . $option{type}; |
51
|
0
|
|
|
|
|
|
eval "use $klass"; |
52
|
0
|
0
|
|
|
|
|
if ($@) { |
53
|
0
|
|
|
|
|
|
die("Error loading deploy class of type $option{type}\n"); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
$option{name} = $name; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
my $deploy = $klass->new(%option); |
59
|
0
|
|
|
|
|
|
$deploy->deploy( $name, %option ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub import { |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
1
|
|
8
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
140
|
|
65
|
0
|
|
|
0
|
|
|
for my $func (@EXPORT) { |
66
|
0
|
|
|
|
|
|
Rex::Logger::debug("Registering main::$func"); |
67
|
0
|
|
|
|
|
|
*{"$_[1]::$func"} = \&$func; |
|
0
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
1; |