line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# vim: set ts=3 sw=3 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
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
package Rex::Apache::Deploy::Package::rpm; |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
2949
|
use Rex::Apache::Deploy::Package::Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use base qw(Rex::Apache::Deploy::Package::Base); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
use strict; |
57
|
|
|
|
|
|
|
use warnings; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
use Rex::Commands; |
60
|
|
|
|
|
|
|
use Rex::Commands::Fs; |
61
|
|
|
|
|
|
|
use Rex::Commands::Run; |
62
|
|
|
|
|
|
|
use Rex::Commands::Upload; |
63
|
|
|
|
|
|
|
use Rex::Apache::Build; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub new { |
66
|
|
|
|
|
|
|
my $that = shift; |
67
|
|
|
|
|
|
|
my $proto = ref($that) || $that; |
68
|
|
|
|
|
|
|
my $self = $proto->SUPER::new(@_); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
bless($self, $proto); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$self->{release} ||= 1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
return $self; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub deploy { |
78
|
|
|
|
|
|
|
my ($self, $package_name, %option) = @_; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
LOCAL { |
81
|
|
|
|
|
|
|
if(! -f $package_name) { |
82
|
|
|
|
|
|
|
$package_name = $self->name . "-" . $self->version . "-". $self->release . "." . $self->arch . ".rpm"; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
if(! -f $package_name) { |
85
|
|
|
|
|
|
|
build($self->name, %option); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
upload $package_name, "/tmp"; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
run "rpm -U /tmp/$package_name"; |
93
|
|
|
|
|
|
|
if($? != 0) { |
94
|
|
|
|
|
|
|
die("Error installing $package_name"); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Rex::Logger::info("Package $package_name installed."); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
unlink "/tmp/$package_name"; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |