| 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::Build::deb - Build deb packages |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
With this module you can build Debian packages to distribute your application. |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
build "my-software", |
|
18
|
|
|
|
|
|
|
type => "deb", |
|
19
|
|
|
|
|
|
|
version => "1.0", |
|
20
|
|
|
|
|
|
|
source => "/path/to/your/software", |
|
21
|
|
|
|
|
|
|
path => "/path/to/deploy/target", |
|
22
|
|
|
|
|
|
|
# below this, it is all optional |
|
23
|
|
|
|
|
|
|
description => "some description of your package", |
|
24
|
|
|
|
|
|
|
url => "website of the package", |
|
25
|
|
|
|
|
|
|
depends => [qw/apache2 perl/], |
|
26
|
|
|
|
|
|
|
release => 1, |
|
27
|
|
|
|
|
|
|
epoch => 1, |
|
28
|
|
|
|
|
|
|
vendor => "some vendor", |
|
29
|
|
|
|
|
|
|
license => "your license for ex. GPL2", |
|
30
|
|
|
|
|
|
|
section => "some/section", |
|
31
|
|
|
|
|
|
|
conflicts => [qw/somepkg/], |
|
32
|
|
|
|
|
|
|
provides => "some-package-name", |
|
33
|
|
|
|
|
|
|
arch => "amd64", |
|
34
|
|
|
|
|
|
|
target => "linux / the platform", |
|
35
|
|
|
|
|
|
|
post_install => "filename or script to run after installation", |
|
36
|
|
|
|
|
|
|
pre_install => "filename or script to run before installation", |
|
37
|
|
|
|
|
|
|
post_uninstall => "filename or script to run after uninstall", |
|
38
|
|
|
|
|
|
|
pre_uninstall => "filename or script to run before uninstall", |
|
39
|
|
|
|
|
|
|
exclude => [qw/file1 file2/], |
|
40
|
|
|
|
|
|
|
maintainer => "your name", |
|
41
|
|
|
|
|
|
|
priority => "optional", |
|
42
|
|
|
|
|
|
|
config_files => [qw/special files for configuration mostly for etc directory/]; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
package Rex::Apache::Build::deb; |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
1
|
|
2466
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
87
|
|
|
50
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
50
|
|
|
51
|
1
|
|
|
1
|
|
9
|
use attributes; |
|
|
1
|
|
|
|
|
2757
|
|
|
|
1
|
|
|
|
|
6
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
1
|
|
|
1
|
|
103
|
use Cwd qw(getcwd); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
47
|
|
|
54
|
1
|
|
|
1
|
|
6
|
use Digest::MD5; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
34
|
|
|
55
|
1
|
|
|
1
|
|
4
|
use Rex -base; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
8
|
|
|
56
|
1
|
|
|
1
|
|
162594
|
use Rex::Template; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
10
|
|
|
57
|
1
|
|
|
1
|
|
26
|
use Data::Dumper; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
64
|
|
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$Rex::Template::DO_CHOMP = TRUE; |
|
60
|
|
|
|
|
|
|
|
|
61
|
1
|
|
|
1
|
|
8
|
use Rex::Apache::Build::Base; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
12
|
|
|
62
|
1
|
|
|
1
|
|
24
|
use base qw(Rex::Apache::Build::Base); |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
1915
|
|
|
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
|
|
|
|
|
if($self->{arch} eq "x86_64") { |
|
72
|
0
|
|
|
|
|
|
$self->{arch} = "amd64"; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
0
|
|
|
|
$self->{priority} ||= "optional"; |
|
76
|
0
|
|
0
|
|
|
|
$self->{exclude} ||= []; |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
push(@{ $self->{exclude} }, qr{^Rexfile$}, qr{^Rexfile\.lock$}, qr{^\.git}, qr{^\.svn}, qr{.*~$}, qr{\.sw[a-z]$}, qr{\.deb$}); |
|
|
0
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $self; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub build { |
|
84
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
|
0
|
|
|
|
$name ||= $self->{name}; |
|
87
|
0
|
|
|
|
|
|
my $version = $self->version; |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $old_dir = getcwd; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
mkdir "temp-deb-build"; |
|
92
|
0
|
|
|
|
|
|
mkdir "temp-deb-build/control"; |
|
93
|
0
|
|
|
|
|
|
mkdir "temp-deb-build/tree"; |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
$self->copy_files_to_tmp; |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
file "temp-deb-build/debian-binary", |
|
98
|
|
|
|
|
|
|
content => "2.0\n"; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
file "temp-deb-build/control/control", |
|
102
|
|
|
|
|
|
|
content => template('@control.file', pkg => $self); |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
file "temp-deb-build/control/md5sums", |
|
105
|
|
|
|
|
|
|
content => $self->get_md5sums; |
|
106
|
|
|
|
|
|
|
|
|
107
|
0
|
|
|
|
|
|
$self->create_config_files; |
|
108
|
0
|
|
|
|
|
|
$self->create_scripts; |
|
109
|
|
|
|
|
|
|
|
|
110
|
0
|
|
|
|
|
|
$self->package_data; |
|
111
|
0
|
|
|
|
|
|
$self->package_control; |
|
112
|
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
rmdir "temp-deb-build/tree"; |
|
114
|
0
|
|
|
|
|
|
rmdir "temp-deb-build/control"; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
chdir "temp-deb-build"; |
|
117
|
|
|
|
|
|
|
|
|
118
|
0
|
|
|
|
|
|
my $arch = $self->{arch}; |
|
119
|
0
|
|
|
|
|
|
my $package_name = "${name}_${version}_${arch}.deb"; |
|
120
|
0
|
|
|
|
|
|
run "ar -qc ../$package_name debian-binary control.tar.gz data.tar.gz"; |
|
121
|
0
|
|
|
|
|
|
chdir ".."; |
|
122
|
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
rmdir "temp-deb-build"; |
|
124
|
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
Rex::Logger::info("Your build is now available: $package_name"); |
|
126
|
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
return $package_name; |
|
128
|
|
|
|
|
|
|
} |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub create_config_files { |
|
131
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
132
|
|
|
|
|
|
|
|
|
133
|
0
|
0
|
|
|
|
|
if($self->{config_files}) { |
|
134
|
|
|
|
|
|
|
file "temp-deb-build/control/conffiles", |
|
135
|
0
|
|
|
|
|
|
content => join("\n", @{ $self->{config_files} }); |
|
|
0
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub create_scripts { |
|
140
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
0
|
|
|
|
|
if($self->{post_install}) { |
|
143
|
0
|
|
|
|
|
|
my $post_install = $self->{post_install}; |
|
144
|
0
|
0
|
0
|
|
|
|
if($post_install !~ m/\n/sim && -f $post_install) { |
|
145
|
0
|
|
|
|
|
|
$post_install = eval { local(@ARGV, $/) = ($post_install); <>; }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
|
file "temp-deb-build/control/postinst", |
|
149
|
|
|
|
|
|
|
content => $post_install, |
|
150
|
|
|
|
|
|
|
mode => 755; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
0
|
0
|
|
|
|
|
if($self->{pre_install}) { |
|
154
|
0
|
|
|
|
|
|
my $pre_install = $self->{pre_install}; |
|
155
|
0
|
0
|
0
|
|
|
|
if($pre_install !~ m/\n/sim && -f $pre_install) { |
|
156
|
0
|
|
|
|
|
|
$pre_install = eval { local(@ARGV, $/) = ($pre_install); <>; }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
} |
|
158
|
|
|
|
|
|
|
|
|
159
|
0
|
|
|
|
|
|
file "temp-deb-build/control/preinst", |
|
160
|
|
|
|
|
|
|
content => $pre_install, |
|
161
|
|
|
|
|
|
|
mode => 755; |
|
162
|
|
|
|
|
|
|
} |
|
163
|
|
|
|
|
|
|
|
|
164
|
0
|
0
|
|
|
|
|
if($self->{post_uninstall}) { |
|
165
|
0
|
|
|
|
|
|
my $post_uninstall = $self->{post_uninstall}; |
|
166
|
0
|
0
|
0
|
|
|
|
if($post_uninstall !~ m/\n/sim && -f $post_uninstall) { |
|
167
|
0
|
|
|
|
|
|
$post_uninstall = eval { local(@ARGV, $/) = ($post_uninstall); <>; }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
} |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
file "temp-deb-build/control/postrm", |
|
171
|
|
|
|
|
|
|
content => $post_uninstall, |
|
172
|
|
|
|
|
|
|
mode => 755; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
|
|
|
|
|
|
|
|
175
|
0
|
0
|
|
|
|
|
if($self->{pre_uninstall}) { |
|
176
|
0
|
|
|
|
|
|
my $pre_uninstall = $self->{pre_uninstall}; |
|
177
|
0
|
0
|
0
|
|
|
|
if($pre_uninstall !~ m/\n/sim && -f $pre_uninstall) { |
|
178
|
0
|
|
|
|
|
|
$pre_uninstall = eval { local(@ARGV, $/) = ($pre_uninstall); <>; }; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
|
file "temp-deb-build/control/prerm", |
|
182
|
|
|
|
|
|
|
content => $pre_uninstall, |
|
183
|
|
|
|
|
|
|
mode => 755; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
} |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub package_data { |
|
189
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
190
|
|
|
|
|
|
|
|
|
191
|
0
|
|
|
|
|
|
chdir "temp-deb-build/tree"; |
|
192
|
0
|
|
|
|
|
|
run "tar czf ../data.tar.gz ."; |
|
193
|
0
|
|
|
|
|
|
chdir "../../"; |
|
194
|
|
|
|
|
|
|
} |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub package_control { |
|
197
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
198
|
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
|
chdir "temp-deb-build/control"; |
|
200
|
0
|
|
|
|
|
|
run "tar czf ../control.tar.gz ."; |
|
201
|
0
|
|
|
|
|
|
chdir "../../"; |
|
202
|
|
|
|
|
|
|
} |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub copy_files_to_tmp { |
|
206
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
207
|
|
|
|
|
|
|
|
|
208
|
0
|
|
0
|
|
|
|
my $prefix = $self->prefix || "."; |
|
209
|
0
|
|
|
|
|
|
mkdir "temp-deb-build/tree/$prefix"; |
|
210
|
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
my @dirs = ($self->{source}); |
|
212
|
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
|
for my $dir (@dirs) { |
|
214
|
0
|
0
|
|
|
|
|
opendir(my $dh, $dir) or die($!); |
|
215
|
|
|
|
|
|
|
|
|
216
|
0
|
|
|
|
|
|
DIR_ENTRY: while(my $entry = readdir($dh)) { |
|
217
|
0
|
0
|
0
|
|
|
|
next if ($entry eq "." or $entry eq ".." or $entry eq "temp-deb-build"); |
|
|
|
|
0
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
|
|
|
|
|
for my $ex (@{ $self->exclude }) { |
|
|
0
|
|
|
|
|
|
|
|
220
|
0
|
0
|
|
|
|
|
if($entry =~ m/$ex/) { |
|
221
|
0
|
|
|
|
|
|
next DIR_ENTRY; |
|
222
|
|
|
|
|
|
|
} |
|
223
|
|
|
|
|
|
|
} |
|
224
|
|
|
|
|
|
|
|
|
225
|
0
|
|
|
|
|
|
my $new_dir = "$dir/$entry"; |
|
226
|
0
|
|
|
|
|
|
$new_dir =~ s/^$dirs[0]//; |
|
227
|
0
|
|
|
|
|
|
$new_dir =~ s/^\///; |
|
228
|
|
|
|
|
|
|
|
|
229
|
0
|
0
|
|
|
|
|
if(-d "$dir/$entry") { |
|
230
|
0
|
|
|
|
|
|
mkdir "temp-deb-build/tree$prefix/$new_dir"; |
|
231
|
|
|
|
|
|
|
|
|
232
|
0
|
|
|
|
|
|
push(@dirs, "$dir/$entry"); |
|
233
|
0
|
|
|
|
|
|
next DIR_ENTRY; |
|
234
|
|
|
|
|
|
|
} |
|
235
|
|
|
|
|
|
|
|
|
236
|
0
|
|
|
|
|
|
cp "$dir/$entry", "temp-deb-build/tree$prefix/$new_dir"; |
|
237
|
|
|
|
|
|
|
} # DIR_ENTRY |
|
238
|
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
|
closedir($dh); |
|
240
|
|
|
|
|
|
|
} |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
} |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
sub get_md5sums { |
|
245
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
246
|
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
|
my @s = (); |
|
248
|
0
|
|
|
|
|
|
chdir "temp-deb-build/tree"; |
|
249
|
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
|
my @dirs = ("."); |
|
251
|
0
|
|
|
|
|
|
for my $dir (@dirs) { |
|
252
|
0
|
|
|
|
|
|
opendir(my $dh, $dir); |
|
253
|
0
|
|
|
|
|
|
while(my $entry = readdir($dh)) { |
|
254
|
0
|
0
|
|
|
|
|
next if($entry eq "."); |
|
255
|
0
|
0
|
|
|
|
|
next if($entry eq ".."); |
|
256
|
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
my $file = "$dir/$entry"; |
|
258
|
|
|
|
|
|
|
|
|
259
|
0
|
0
|
|
|
|
|
if(-d $file) { |
|
260
|
0
|
|
|
|
|
|
push(@dirs, $file); |
|
261
|
0
|
|
|
|
|
|
next; |
|
262
|
|
|
|
|
|
|
} |
|
263
|
|
|
|
|
|
|
|
|
264
|
0
|
|
|
|
|
|
my $md5 = Digest::MD5->new; |
|
265
|
0
|
0
|
|
|
|
|
open(my $fh, "<", $file) or die($!); |
|
266
|
0
|
|
|
|
|
|
$file =~ s/^\.\///; |
|
267
|
0
|
|
|
|
|
|
$md5->addfile($fh); |
|
268
|
0
|
|
|
|
|
|
push(@s, $md5->hexdigest . " " . $file); |
|
269
|
0
|
|
|
|
|
|
close($fh); |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
} |
|
273
|
0
|
|
|
|
|
|
closedir($dh); |
|
274
|
|
|
|
|
|
|
} |
|
275
|
|
|
|
|
|
|
|
|
276
|
0
|
|
|
|
|
|
chdir "../.."; |
|
277
|
|
|
|
|
|
|
|
|
278
|
0
|
|
|
|
|
|
return join("\n", @s); |
|
279
|
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
} |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub description { |
|
283
|
0
|
|
|
0
|
0
|
|
my ($self, $desc) = @_; |
|
284
|
|
|
|
|
|
|
|
|
285
|
0
|
0
|
|
|
|
|
if($desc) { |
|
286
|
0
|
|
|
|
|
|
$self->{description} = $desc; |
|
287
|
|
|
|
|
|
|
} |
|
288
|
|
|
|
|
|
|
|
|
289
|
0
|
|
|
|
|
|
my $s = ""; |
|
290
|
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
|
my @lines = split(/\n/, $self->{description}); |
|
292
|
0
|
|
|
|
|
|
$s = shift(@lines); |
|
293
|
|
|
|
|
|
|
|
|
294
|
0
|
|
|
|
|
|
for (@lines) { |
|
295
|
0
|
|
|
|
|
|
$s .= " $_"; |
|
296
|
|
|
|
|
|
|
} |
|
297
|
|
|
|
|
|
|
|
|
298
|
0
|
|
|
|
|
|
return $s; |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
sub depends { |
|
302
|
0
|
|
|
0
|
0
|
|
my ($self, $dep) = @_; |
|
303
|
|
|
|
|
|
|
|
|
304
|
0
|
0
|
|
|
|
|
if($dep) { |
|
305
|
0
|
|
|
|
|
|
$self->{depends} = $dep; |
|
306
|
|
|
|
|
|
|
} |
|
307
|
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
my @s = (); |
|
309
|
|
|
|
|
|
|
|
|
310
|
0
|
|
|
|
|
|
for my $dep (@{ $self->{depends} }) { |
|
|
0
|
|
|
|
|
|
|
|
311
|
0
|
0
|
|
|
|
|
if(ref($dep)) { |
|
312
|
0
|
|
|
|
|
|
my ($pkg) = keys %{ $dep }; |
|
|
0
|
|
|
|
|
|
|
|
313
|
0
|
|
|
|
|
|
my ($ver) = values %{ $dep }; |
|
|
0
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
|
|
315
|
0
|
|
|
|
|
|
push(@s, $pkg . "($ver)"); |
|
316
|
|
|
|
|
|
|
} |
|
317
|
|
|
|
|
|
|
else { |
|
318
|
0
|
|
|
|
|
|
push(@s, $dep); |
|
319
|
|
|
|
|
|
|
} |
|
320
|
|
|
|
|
|
|
} |
|
321
|
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
return join(", ", @s); |
|
323
|
|
|
|
|
|
|
} |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub installed_size { |
|
326
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
327
|
|
|
|
|
|
|
|
|
328
|
0
|
|
|
|
|
|
my $size = 0; |
|
329
|
|
|
|
|
|
|
|
|
330
|
0
|
|
|
|
|
|
chdir "temp-deb-build/tree"; |
|
331
|
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
|
my @dirs = ("."); |
|
333
|
0
|
|
|
|
|
|
for my $dir (@dirs) { |
|
334
|
0
|
|
|
|
|
|
opendir(my $dh, $dir); |
|
335
|
0
|
|
|
|
|
|
while(my $entry = readdir($dh)) { |
|
336
|
0
|
0
|
|
|
|
|
next if($entry eq "."); |
|
337
|
0
|
0
|
|
|
|
|
next if($entry eq ".."); |
|
338
|
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
|
my $file = "$dir/$entry"; |
|
340
|
|
|
|
|
|
|
|
|
341
|
0
|
0
|
|
|
|
|
if(-d $file) { |
|
342
|
0
|
|
|
|
|
|
push(@dirs, $file); |
|
343
|
0
|
|
|
|
|
|
next; |
|
344
|
|
|
|
|
|
|
} |
|
345
|
0
|
|
|
|
|
|
$size += -s $file; |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
} |
|
348
|
0
|
|
|
|
|
|
closedir($dh); |
|
349
|
|
|
|
|
|
|
} |
|
350
|
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
|
chdir "../.."; |
|
352
|
|
|
|
|
|
|
|
|
353
|
0
|
|
|
|
|
|
return $size; |
|
354
|
|
|
|
|
|
|
} |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
1; |
|
358
|
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
__DATA__ |