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::rpm - Deploy rpm package |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
With this module you can deploy a RedHat package. |
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.rpm"; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
deploy "my-software", |
22
|
|
|
|
|
|
|
type => "rpm", |
23
|
|
|
|
|
|
|
version => "1.0", |
24
|
|
|
|
|
|
|
# below this, it is all optional |
25
|
|
|
|
|
|
|
source => "/path/to/your/software", |
26
|
|
|
|
|
|
|
path => "/path/to/deploy/target", |
27
|
|
|
|
|
|
|
description => "some description of your package", |
28
|
|
|
|
|
|
|
url => "website of the package", |
29
|
|
|
|
|
|
|
depends => [qw/httpd perl/], |
30
|
|
|
|
|
|
|
release => 1, |
31
|
|
|
|
|
|
|
epoch => 1, |
32
|
|
|
|
|
|
|
vendor => "some vendor", |
33
|
|
|
|
|
|
|
license => "your license for ex. GPL2", |
34
|
|
|
|
|
|
|
section => "some/section", |
35
|
|
|
|
|
|
|
conflicts => [qw/somepkg/], |
36
|
|
|
|
|
|
|
provides => "some-package-name", |
37
|
|
|
|
|
|
|
arch => "x86_64", |
38
|
|
|
|
|
|
|
target => "linux / the platform", |
39
|
|
|
|
|
|
|
post_install => "filename or script to run after installation", |
40
|
|
|
|
|
|
|
pre_install => "filename or script to run before installation", |
41
|
|
|
|
|
|
|
post_uninstall => "filename or script to run after uninstall", |
42
|
|
|
|
|
|
|
pre_uninstall => "filename or script to run before uninstall", |
43
|
|
|
|
|
|
|
exclude => [qw/file1 file2/], |
44
|
|
|
|
|
|
|
maintainer => "your name", |
45
|
|
|
|
|
|
|
config_files => [qw/special files for configuration mostly for etc directory/]; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
package Rex::Apache::Deploy::Package::rpm; |
51
|
|
|
|
|
|
|
|
52
|
1
|
|
|
1
|
|
1602
|
use Rex::Apache::Deploy::Package::Base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
53
|
1
|
|
|
1
|
|
29
|
use base qw(Rex::Apache::Deploy::Package::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
54
|
|
|
|
|
|
|
|
55
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
56
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
1
|
|
5
|
use Rex::Commands; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
59
|
1
|
|
|
1
|
|
834
|
use Rex::Commands::Fs; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
60
|
1
|
|
|
1
|
|
527
|
use Rex::Commands::Run; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
61
|
1
|
|
|
1
|
|
82
|
use Rex::Commands::Upload; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
62
|
1
|
|
|
1
|
|
51
|
use Rex::Apache::Build; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
390
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub new { |
65
|
0
|
|
|
0
|
0
|
|
my $that = shift; |
66
|
0
|
|
0
|
|
|
|
my $proto = ref($that) || $that; |
67
|
0
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
bless( $self, $proto ); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
0
|
|
|
|
$self->{release} ||= 1; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return $self; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub deploy { |
77
|
0
|
|
|
0
|
0
|
|
my ( $self, $package_name, %option ) = @_; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
LOCAL { |
80
|
0
|
0
|
|
0
|
|
|
if ( !-f $package_name ) { |
81
|
0
|
|
|
|
|
|
$package_name = |
82
|
|
|
|
|
|
|
$self->name . "-" |
83
|
|
|
|
|
|
|
. $self->version . "-" |
84
|
|
|
|
|
|
|
. $self->release . "." |
85
|
|
|
|
|
|
|
. $self->arch . ".rpm"; |
86
|
|
|
|
|
|
|
|
87
|
0
|
0
|
|
|
|
|
if ( !-f $package_name ) { |
88
|
0
|
|
|
|
|
|
build( $self->name, %option ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
|
upload $package_name, "/tmp"; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
run "rpm -U /tmp/$package_name"; |
96
|
0
|
0
|
|
|
|
|
if ( $? != 0 ) { |
97
|
0
|
|
|
|
|
|
die("Error installing $package_name"); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
Rex::Logger::info("Package $package_name installed."); |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
unlink "/tmp/$package_name"; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |