← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 20:36:06 2020
Reported on Wed Feb 12 21:42:25 2020

Filename/root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
StatementsExecuted 295734 statements in 1.43s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1991011954ms304sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557]
199111205ms145sRBM::DefaultConfig::::lsb_releaseRBM::DefaultConfig::lsb_release
378294177.7ms77.7msRBM::DefaultConfig::::CORE:matchRBM::DefaultConfig::CORE:match (opcode)
19911164.2ms152sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578]
19921143.8ms9.53sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156]
19911141.5ms41.5msRBM::DefaultConfig::::CORE:ftfileRBM::DefaultConfig::CORE:ftfile (opcode)
39761138.6ms141sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605]
19901127.8ms1610sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606] (recurses: max depth 11, inclusive time 6762s)
2611555µs6.33msRBM::DefaultConfig::::rbm_tmp_dirRBM::DefaultConfig::rbm_tmp_dir
11120µs20µsRBM::DefaultConfig::::BEGIN@13RBM::DefaultConfig::BEGIN@13
11118µs20µsRBM::DefaultConfig::::BEGIN@3RBM::DefaultConfig::BEGIN@3
1119µs27µsRBM::DefaultConfig::::BEGIN@15RBM::DefaultConfig::BEGIN@15
1119µs60µsRBM::DefaultConfig::::BEGIN@16RBM::DefaultConfig::BEGIN@16
1118µs28µsRBM::DefaultConfig::::BEGIN@14RBM::DefaultConfig::BEGIN@14
1117µs7µsRBM::DefaultConfig::::BEGIN@6RBM::DefaultConfig::BEGIN@6
1117µs41µsRBM::DefaultConfig::::BEGIN@12RBM::DefaultConfig::BEGIN@12
1115µs19µsRBM::DefaultConfig::::BEGIN@4RBM::DefaultConfig::BEGIN@4
111700ns700nsRBM::DefaultConfig::::__ANON__RBM::DefaultConfig::__ANON__ (xsub)
0000s0sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:534]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:534]
0000s0sRBM::DefaultConfig::::__ANON__[rbm/lib/RBM/DefaultConfig.pm:607]RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:607]
0000s0sRBM::DefaultConfig::::docker_versionRBM::DefaultConfig::docker_version
0000s0sRBM::DefaultConfig::::get_archRBM::DefaultConfig::get_arch
0000s0sRBM::DefaultConfig::::git_describeRBM::DefaultConfig::git_describe
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package RBM::DefaultConfig;
2
3220µs223µs
# spent 20µs (18+3) within RBM::DefaultConfig::BEGIN@3 which was called: # once (18µs+3µs) by RBM::BEGIN@20 at line 3
use strict;
# spent 20µs making 1 call to RBM::DefaultConfig::BEGIN@3 # spent 3µs making 1 call to strict::import
4242µs233µs
# spent 19µs (5+14) within RBM::DefaultConfig::BEGIN@4 which was called: # once (5µs+14µs) by RBM::BEGIN@20 at line 4
use warnings;
# spent 19µs making 1 call to RBM::DefaultConfig::BEGIN@4 # spent 14µs making 1 call to warnings::import
5
6
# spent 7µs within RBM::DefaultConfig::BEGIN@6 which was called: # once (7µs+0s) by RBM::BEGIN@20 at line 10
BEGIN {
71200ns require Exporter;
814µs our @ISA = qw(Exporter);
913µs our @EXPORT = qw(%default_config);
10118µs17µs}
# spent 7µs making 1 call to RBM::DefaultConfig::BEGIN@6
11
12220µs275µs
# spent 41µs (7+34) within RBM::DefaultConfig::BEGIN@12 which was called: # once (7µs+34µs) by RBM::BEGIN@20 at line 12
use File::Basename;
# spent 41µs making 1 call to RBM::DefaultConfig::BEGIN@12 # spent 34µs making 1 call to Exporter::import
13237µs221µs
# spent 20µs (20+700ns) within RBM::DefaultConfig::BEGIN@13 which was called: # once (20µs+700ns) by RBM::BEGIN@20 at line 13
use RBM;
# spent 20µs making 1 call to RBM::DefaultConfig::BEGIN@13 # spent 700ns making 1 call to RBM::DefaultConfig::__ANON__
14224µs248µs
# spent 28µs (8+20) within RBM::DefaultConfig::BEGIN@14 which was called: # once (8µs+20µs) by RBM::BEGIN@20 at line 14
use Cwd qw(getcwd);
# spent 28µs making 1 call to RBM::DefaultConfig::BEGIN@14 # spent 20µs making 1 call to Exporter::import
15223µs244µs
# spent 27µs (9+17) within RBM::DefaultConfig::BEGIN@15 which was called: # once (9µs+17µs) by RBM::BEGIN@20 at line 15
use IO::CaptureOutput qw(capture_exec);
# spent 27µs making 1 call to RBM::DefaultConfig::BEGIN@15 # spent 17µs making 1 call to Exporter::import
1621.70ms2112µs
# spent 60µs (9+52) within RBM::DefaultConfig::BEGIN@16 which was called: # once (9µs+52µs) by RBM::BEGIN@20 at line 16
use File::Temp;
# spent 60µs making 1 call to RBM::DefaultConfig::BEGIN@16 # spent 52µs making 1 call to Exporter::import
17
18sub git_describe {
19 my ($project, $options) = @_;
20 my $git_hash = RBM::project_config($project, 'git_hash', $options)
21 || RBM::exit_error('No git_hash specified');
22 my %res;
23 $RBM::config->{projects}{$project}{describe} = {};
24 my $old_cwd = getcwd;
25 RBM::git_clone_fetch_chdir($project, $options);
26 my ($stdout, $stderr, $success, $exit_code)
27 = capture_exec('git', 'describe', '--long', $git_hash);
28 if ($success) {
29 @res{qw(tag tag_reach hash)} = $stdout =~ m/^(.+)-(\d+)-g([^-\n]+)$/;
30 }
31 chdir($old_cwd);
32 return $success ? \%res : undef;
33}
34
35
# spent 145s (205ms+145) within RBM::DefaultConfig::lsb_release which was called 1991 times, avg 72.7ms/call: # 1991 times (205ms+145s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 72.7ms/call
sub lsb_release {
3619915.14ms my ($project, $options) = @_;
3719915.64ms19910s my $distribution = RBM::project_config($project, 'distribution', $options);
# spent 2.20s making 1991 calls to RBM::project_config, avg 1.11ms/call, recursion: max depth 52, sum of overlapping time 2.20s
3819911.26ms if ($distribution) {
39 my ($id, $release) = split '-', $distribution;
40 return { id => $id, release => $release };
41 }
4219911.86ms my $res = {};
43
44199156.2ms199141.5ms if (-f '/usr/bin/sw_vers') {
# spent 41.5ms making 1991 calls to RBM::DefaultConfig::CORE:ftfile, avg 21µs/call
45 # If sw_vers exists, we assume we are on OSX and use it
46 my ($stdout, $stderr, $success, $exit_code)
47 = capture_exec('/usr/bin/sw_vers', '-productName');
48 RBM::exit_error("sw_vers: unknown ProductName")
49 unless $success;
50 ($res->{id}) = split("\n", $stdout);
51 ($stdout, $stderr, $success, $exit_code)
52 = capture_exec('/usr/bin/sw_vers', '-productVersion');
53 RBM::exit_error("sw_vers: unknown ProductVersion")
54 unless $success;
55 ($res->{release}) = split("\n", $stdout);
56 $res->{codename} = $res->{release};
57 return $res;
58 }
59
60199116.1ms1991142s my ($stdout, $stderr, $success, $exit_code)
# spent 142s making 1991 calls to IO::CaptureOutput::capture_exec, avg 71.4ms/call
61 = capture_exec('lsb_release', '-irc');
6219911.88ms if ($success) {
63199112.5ms foreach (split "\n", $stdout) {
64597380.3ms597332.8ms $res->{id} = $1 if (m/^Distributor ID:\s+(.+)$/);
# spent 32.8ms making 5973 calls to RBM::DefaultConfig::CORE:match, avg 5µs/call
65597335.2ms59736.42ms $res->{release} = $1 if (m/^Release:\s+(.+)$/);
# spent 6.42ms making 5973 calls to RBM::DefaultConfig::CORE:match, avg 1µs/call
66597339.2ms59736.44ms $res->{codename} = $1 if (m/^Codename:\s+(.+)$/);
# spent 6.44ms making 5973 calls to RBM::DefaultConfig::CORE:match, avg 1µs/call
67 }
68199119.7ms return $res;
69 }
70
71 ($stdout, $stderr, $success, $exit_code)
72 = capture_exec('uname', '-s');
73 RBM::exit_error("Unknown OS") unless $success;
74 ($res->{id}) = split("\n", $stdout);
75 ($stdout, $stderr, $success, $exit_code)
76 = capture_exec('uname', '-r');
77 RBM::exit_error("Unknown OS release") unless $success;
78 ($res->{release}) = split("\n", $stdout);
79 $res->{codename} = $res->{release};
80 return $res;
81}
82
83sub get_arch {
84 my ($stdout, $stderr, $success, $exit_code) = capture_exec('uname', '-m');
85 return "unknown" unless $success;
86 chomp $stdout;
87 return $stdout;
88}
89
90sub docker_version {
91 my ($stdout, $stderr, $success)
92 = capture_exec('docker', 'version', '--format', '{{.Client.Version}}');
93 if ($success) {
94 chomp $stdout;
95 return $stdout;
96 }
97 ($stdout, $stderr, $success) = capture_exec('docker', 'version');
98 RBM::exit_error("Error running 'docker version'") unless $success;
99 foreach my $line (split "\n", $stdout) {
100 return $1 if ($line =~ m/Client version: (.*)$/);
101 }
102 RBM::exit_error("Could not find docker version");
103}
104
105
# spent 6.33ms (555µs+5.78) within RBM::DefaultConfig::rbm_tmp_dir which was called 26 times, avg 244µs/call: # 26 times (555µs+5.78ms) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 244µs/call
sub rbm_tmp_dir {
1062694µs my ($project, $options) = @_;
107 CORE::state $rbm_tmp_dir;
10826489µs50540µs return $rbm_tmp_dir->dirname if $rbm_tmp_dir;
# spent 361µs making 25 calls to File::Temp::NUMIFY, avg 14µs/call # spent 178µs making 25 calls to File::Temp::Dir::dirname, avg 7µs/call
10914µs14.85ms my $tmp_dir = RBM::get_tmp_dir($project, $options)
# spent 4.85ms making 1 call to RBM::get_tmp_dir
110 || RBM::exit_error('No tmp_dir specified');
11118µs1380µs $rbm_tmp_dir = File::Temp->newdir(TEMPLATE => 'rbm-XXXXXX',
# spent 380µs making 1 call to File::Temp::newdir
112 DIR => $tmp_dir);
11317µs13µs return $rbm_tmp_dir->dirname;
# spent 3µs making 1 call to File::Temp::Dir::dirname
114}
115
116our %default_config = (
117 sysconf_file => '/etc/rbm.conf',
118 localconf_file=> 'rbm.local.conf',
119 tmp_dir => '[% GET ENV.TMPDIR ? ENV.TMPDIR : "/tmp"; %]',
120 rbm_tmp_dir => \&rbm_tmp_dir,
121 projects_dir => 'projects',
122 output_dir => 'out',
123 git_clone_dir => 'git_clones',
124 hg_clone_dir => 'hg_clones',
125 fetch => 'if_needed',
126 rpmspec => '[% SET tmpl = project _ ".spec"; INCLUDE $tmpl -%]',
127 build => '[% INCLUDE build -%]',
128 build_log => '-',
129 build_log_append => '1',
130 notmpl => [ qw(projects_dir) ],
131 describe => \&git_describe,
132 abbrev_length => '12',
133 abbrev => '[%
134 IF c("git_url");
135 exec("git log -1 --abbrev=" _ c("abbrev_length") _ " --format=%h " _ c("git_hash"));
136 ELSE;
137 exec(c("hg") _ " id -i -r " _ c("hg_hash"));
138 END;
139 %]',
140
# spent 9.53s (43.8ms+9.49) within RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] which was called 1992 times, avg 4.78ms/call: # 1992 times (43.8ms+9.49s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 4.78ms/call
timestamp => sub {
14119928.25ms my ($project, $options) = @_;
14219927.47ms29880s if (RBM::project_config($project, 'git_url', $options)) {
# spent 4.98s making 2988 calls to RBM::project_config, avg 1.67ms/call, recursion: max depth 51, sum of overlapping time 4.98s
1439962.81ms9960s my $git_hash = RBM::project_config($project, 'git_hash', $options);
# spent 2.55s making 996 calls to RBM::project_config, avg 2.56ms/call, recursion: max depth 48, sum of overlapping time 2.55s
14499610.8ms9961.96s return RBM::execute($project,
# spent 1.96s making 996 calls to RBM::execute, avg 1.96ms/call
145 "git show -s --format=format:%ct ${git_hash}^{commit}", $options);
146 } elsif (RBM::project_config($project, 'hg_url', $options)) {
147 my $hg = RBM::project_config($project, 'hg', $options);
148 my $hg_hash = RBM::project_config($project, 'hg_hash', $options);
149 my $changeset = RBM::execute($project,
150 "$hg export --noninteractive -r $hg_hash", $options);
151 foreach my $line (split "\n", $changeset) {
152 return $1 if ($line =~ m/^# Date (\d+) \d+/);
153 }
154 }
1559965.49ms return '946684800';
156 },
157 debug => 0,
158 version => <<END,
159[%-
160 IF c('version_command');
161 exec(c('version_command'));
162 ELSIF c(['describe', 'tag']);
163 c(['describe', 'tag']);
164 ELSE;
165 exit_error('No version specified');
166 END;
167-%]
168END
169####
170####
171####
172 pkg_type => 'build',
173 rpm => '[% c("rpmbuild", { rpmbuild_action => "-ba" }) %]',
174 srpm => '[% c("rpmbuild", { rpmbuild_action => "-bs" }) %]',
175####
176####
177####
178 rpmbuild => <<END,
179[% USE date -%]
180#!/bin/sh
181set -e -x
182srcdir=\$(pwd)
183cat > '[% project %].spec' << 'RBM_END_RPM_SPEC'
184[% c('rpmspec') %]
185RBM_END_RPM_SPEC
186touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %] [% project %].spec
187rpmbuild [% c('rpmbuild_action', {error_if_undef => 1}) %] --define "_topdir \$srcdir" \\
188 --define "_sourcedir \$srcdir" \\
189 --define '_srcrpmdir [% dest_dir %]' \\
190 --define '_rpmdir [% dest_dir %]' \\
191 --define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \\
192 "\$srcdir/[% project %].spec"
193END
194####
195####
196####
197 rpm_rel => <<OPT_END,
198[%-
199 IF c('pkg_rel').defined;
200 GET c('pkg_rel');
201 ELSIF c('describe/tag_reach');
202 GET '1.' _ c('describe/tag_reach') _ '.g' _ c('describe/hash');
203 ELSE;
204 GET '1.g' _ c('abbrev');
205 END;
206-%]
207OPT_END
208####
209####
210####
211 gpg_bin => 'gpg',
212 gpg_args => '',
213 gpg_keyring_dir => '[% config.basedir %]/keyring',
214 gpg_wrapper => <<GPGEND,
215#!/bin/sh
216export LC_ALL=C
217[%
218 IF c('gpg_keyring');
219 SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir')))
220 _ ' --no-default-keyring --no-auto-check-trustdb --trust-model always';
221 END;
222-%]
223exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "\$@"
224GPGEND
225####
226####
227####
228 debian_create => <<DEBEND,
229[%-
230 FOREACH f IN c('debian_files');
231 GET 'cat > ' _ tmpl(f.name) _ " << 'END_DEBIAN_FILE'\n";
232 GET tmpl(f.content);
233 GET "\nEND_DEBIAN_FILE\n\n";
234 END;
235-%]
236DEBEND
237####
238####
239####
240 deb_src => <<DEBEND,
241#!/bin/sh
242set -e -x
243[% SET tarfile = project _ '-' _ c('version') _ '.tar.' _ c('compress_tar') -%]
244tar xvf [% tarfile %]
245mv [% tarfile %] [% dest_dir %]/[% project %]_[% c('version') %].orig.tar.[% c('compress_tar') %]
246cd [% project %]-[% c('version') %]
247builddir=\$(pwd)
248mkdir debian debian/source
249cd debian
250[% c('debian_create') %]
251cd [% dest_dir %]
252dpkg-source -b "\$builddir"
253DEBEND
254####
255####
256####
257 deb => <<DEBEND,
258#!/bin/sh
259set -e -x
260[% SET tarfile = project _ '-' _ c('version') _ '.tar.' _ c('compress_tar') -%]
261tar xvf [% tarfile %]
262mv [% tarfile %] [% project %]_[% c('version') %].orig.tar.[% c('compress_tar') %]
263cd [% project %]-[% c('version') %]
264builddir=\$(pwd)
265mkdir debian debian/source
266cd debian
267[% c('debian_create') %]
268cd ..
269ls ..
270[% IF c('debsign_keyid');
271 pdebuild_sign = '--debsign-k ' _ c('debsign_keyid');
272 debuild_sign = '-k' _ c('debsign_keyid');
273ELSE;
274 pdebuild_sign = '';
275 debuild_sign = '-uc -us';
276END -%]
277[% IF c('use_pbuilder') -%]
278pdebuild [% pdebuild_sign %] --buildresult [% dest_dir %]
279[% ELSE -%]
280debuild [% debuild_sign %]
281cd ..
282rm -f build
283for file in *
284do
285 if [ -f "\$file" ]
286 then
287 mv "\$file" [% dest_dir %]
288 fi
289done
290[% END -%]
291DEBEND
292####
293####
294####
295 debian_revision => <<OPT_END,
296[%-
297IF c('pkg_rel');
298 GET c('pkg_rel').defined;
299ELSIF c('describe/tag_reach');
300 GET '1.' _ c('describe/tag_reach') _ '~g' _ c('describe/hash');
301ELSE;
302 GET '1';
303END;
304-%]
305OPT_END
306####
307####
308####
309 ssh_remote_exec => <<OPT_END,
310[%-
311 ssh_user = c('exec_as_root') ? '-l root' : '';
312-%]
313ssh [% GET c('ssh_options') IF c('ssh_options') %] [% ssh_user %] [% GET '-p ' _ c('ssh_port') IF c('ssh_port') %] [% c('ssh_host') %] [% shell_quote(c('exec_cmd')) -%]
314OPT_END
315####
316####
317####
318 chroot_remote_exec => <<OPT_END,
319[%-
320 chroot_user = c('exec_as_root') ? '' : shell_quote(c("chroot_user", { error_if_undef => 1 }));
321-%]
322sudo -- chroot [% shell_quote(c("chroot_path", { error_if_undef => 1 })) %] su - [% chroot_user %] -c [% shell_quote(c("exec_cmd")) -%]
323OPT_END
324####
325####
326####
327 remote_exec => <<OPT_END,
328[%
329 IF c('remote_docker');
330 GET c('docker_remote_exec');
331 RETURN;
332 END;
333 IF c('remote_ssh');
334 GET c('ssh_remote_exec');
335 RETURN;
336 END;
337 IF c('remote_chroot');
338 GET c('chroot_remote_exec');
339 RETURN;
340 END;
341-%]
342OPT_END
343####
344####
345####
346 remote_get => <<OPT_END,
347[%
348 IF c('remote_docker');
349 GET c('docker_remote_get');
350 RETURN;
351 END;
352
353 SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
354 SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
355-%]
356#!/bin/sh
357set -e
358mkdir -p [% dst %]
359cd [% dst %]
360if [% c('remote_exec', { exec_cmd => 'test -f ' _ src }) %]
361then
362 [% c('remote_exec', { exec_cmd => 'cd \$(dirname ' _ src _ ') && tar -cf - \$(basename ' _ src _ ')' }) %] | tar -xf -
363else
364 [% c('remote_exec', { exec_cmd => 'cd ' _ src _ ' && tar -cf - .' }) %] | tar -xf -
365fi
366OPT_END
367####
368####
369####
370 remote_put => <<OPT_END,
371[%
372 IF c('remote_docker');
373 GET c('docker_remote_put');
374 RETURN;
375 END;
376
377 SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
378 SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
379-%]
380#!/bin/sh
381set -e
382if [ -f [% src %] ]
383then
384 cd \$(dirname [% src %])
385 tar -cf - \$(basename [% src %]) | [% c('remote_exec', { exec_cmd => 'mkdir -p ' _ dst _ '&& cd ' _ dst _ '&& tar -xf -' }) %]
386else
387 cd [% src %]
388 tar -cf . | [% c('remote_exec', { exec_cmd => 'mkdir -p' _ dst _ '&& cd ' _ dst _ '&& tar -xf -' }) %]
389fi
390
391OPT_END
392####
393####
394####
395 remote_start => <<OPT_END,
396[%
397 IF c('remote_docker');
398 GET c('docker_remote_start');
399 RETURN;
400 END;
401-%]
402OPT_END
403####
404####
405####
406 remote_finish => <<OPT_END,
407[%
408 IF c('remote_docker');
409 GET c('docker_remote_finish');
410 RETURN;
411 END;
412-%]
413OPT_END
414####
415####
416####
417 docker_version => \&docker_version,
418####
419####
420####
421 docker_build_image => 'rbm-[% sha256(c("build_id")).substr(0, 12) %]',
422####
423####
424####
425 docker_remote_start => <<OPT_END,
426#!/bin/sh
427set -e
428ciddir=\$(mktemp -d)
429cidfile="\$ciddir/cid"
430[%
431 SET user=c('docker_user');
432 SET cmd = '/bin/sh -c ' _ shell_quote("id \$user >/dev/null 2>&1 || adduser -m \$user || useradd -m \$user");
433-%]
434docker run --cidfile="\$cidfile" [% c("docker_opt") %] [% shell_quote(c('docker_image', {error_if_undef => 1})) %] [% cmd %]
435cid=\$(cat \$cidfile)
436rm -rf "\$ciddir"
437docker commit \$cid [% c('docker_build_image') %] > /dev/null < /dev/null
438docker rm -f \$cid > /dev/null
439OPT_END
440####
441####
442####
443 docker_remote_finish => <<OPT_END,
444#!/bin/sh
445set -e
446[% IF c('docker_save_image') -%]
447docker tag [% IF versioncmp(c('docker_version'), '1.10.0') == -1; GET '-f'; END; %] [% c('docker_build_image') %] [% c('docker_save_image') %]
448[% END -%]
449docker rmi -f [% c('docker_build_image') %] > /dev/null
450OPT_END
451####
452####
453####
454 docker_user => 'rbm',
455####
456####
457####
458 docker_remote_exec => <<OPT_END,
459#!/bin/sh
460set -e
461ciddir=\$(mktemp -d)
462cidfile="\$ciddir/cid"
463set +e
464docker run [% IF c('interactive') %]-i -t[% END %] \\
465 [% IF c('exec_as_root') %]-u=root[%
466 ELSE %]-u=[% shell_quote(c('docker_user')) %][% END %] \\
467 --cidfile="\$cidfile" [% c("docker_opt") %] [% c('docker_build_image') %] \\
468 /bin/sh -c [% shell_quote(c('exec_cmd')) %]
469ret=\$?
470set -e
471cid=\$(cat \$cidfile)
472rm -rf "\$ciddir"
473docker commit \$cid [% c('docker_build_image') %] > /dev/null < /dev/null
474docker rm -f \$cid > /dev/null
475test \$ret -eq 0
476OPT_END
477####
478####
479####
480 docker_remote_put => <<OPT_END,
481[%
482 SET src = c('put_src', { error_if_undef => 1 });
483 SET dst = c('put_dst', { error_if_undef => 1 });
484 SET p = fileparse(src);
485 SET src_filename = shell_quote(p.0);
486 SET src_dir = shell_quote(p.1);
487 SET dst = shell_quote(dst);
488 GET c("docker_remote_exec", { docker_opt => '-v ' _ src_dir _ ':/rbm_copy',
489 exec_as_root => 1,
490 exec_cmd => 'su ' _ c('docker_user') _ " -c 'mkdir -p " _ dst _ "';"
491 _ 'cp -ar /rbm_copy/' _ src_filename _ ' ' _ dst
492 _ '; chown -h ' _ c('docker_user') _ ' ' _ dst _ '/' _ src_filename
493 _ '; chown ' _ c('docker_user') _ ' ' _ dst });
494%]
495OPT_END
496####
497####
498####
499 uid => $>,
500 docker_remote_get => <<OPT_END,
501[%
502 SET src = c('get_src', { error_if_undef => 1 });
503 SET dst = c('get_dst', { error_if_undef => 1 });
504-%]
505#!/bin/sh
506set -e
507tmpdir=\$(mktemp -d)
508[%
509 GET c("docker_remote_exec", { docker_opt => '-v \$tmpdir:/rbm_copy',
510 exec_as_root => 1,
511 exec_cmd => 'cd ' _ src _ '; tar -cf - . | tar -C /rbm_copy -xf -; chown -R ' _ c('uid') _ ' /rbm_copy'});
512%]
513cd \$tmpdir
514tar -cf - . | tar -C [% dst %] --no-same-owner -xf -
515cd - > /dev/null
516rm -Rf \$tmpdir
517OPT_END
518####
519####
520####
521 lsb_release => \&lsb_release,
522 pkg_type => sub {
523 my ($project, $options) = @_;
524 my $distro = RBM::project_config($project, 'lsb_release/id', $options);
525 my %pkg_types = qw(
526 Fedora rpm
527 CentOS rpm
528 Mageia rpm
529 openSuSe rpm
530 Debian deb
531 Ubuntu deb
532 );
533 return $pkg_types{$distro};
534 },
535
# spent 304s (954ms+303) within RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] which was called 19910 times, avg 15.2ms/call: # 19910 times (954ms+303s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 15.2ms/call
install_package => sub {
5361991019.4ms my ($project, $options) = @_;
5371991067.7ms199100s my $distro = RBM::project_config($project, 'lsb_release/id', $options);
# spent 151s making 19910 calls to RBM::project_config, avg 7.61ms/call, recursion: max depth 52, sum of overlapping time 151s
5381991079.0ms199100s my $release = RBM::project_config($project, 'lsb_release/release', $options);
# spent 151s making 19910 calls to RBM::project_config, avg 7.59ms/call, recursion: max depth 52, sum of overlapping time 151s
5391991026.2ms my $yum = 'rpm -q [% c("pkg_name") %] > /dev/null || yum install -y [% c("pkg_name") %]';
5401991015.9ms my $dnf = 'rpm -q [% c("pkg_name") %] > /dev/null || dnf install -y [% c("pkg_name") %]';
5411991013.5ms my $zypper = 'rpm -q [% c("pkg_name") %] > /dev/null || zypper install [% c("pkg_name") %]';
5421991014.4ms my $urpmi = 'rpm -q [% c("pkg_name") %] > /dev/null || urpmi [% c("pkg_name") %]';
5431991010.4ms my $apt = 'dpkg -s [% c("pkg_name") %] 2> /dev/null | grep -q "^Status: install ok installed\$" || DEBIAN_FRONTEND=noninteractive apt-get install -q -y [% c("pkg_name") %]';
54419910217ms my %install = (
545 Fedora => $dnf,
546 'Fedora-20' => $yum,
547 'Fedora-21' => $yum,
548 CentOS => $dnf,
549 Mageia => $urpmi,
550 openSuSe => $zypper,
551 Debian => $apt,
552 Ubuntu => $apt,
553 );
55419910180ms1991032.0ms return $yum if "$distro-$release" =~ m/^Centos-[56]\./;
# spent 32.0ms making 19910 calls to RBM::DefaultConfig::CORE:match, avg 2µs/call
5551991035.8ms return $install{"$distro-$release"} if $install{"$distro-$release"};
55619910275ms return $install{$distro};
557 },
558 urlget => <<URLGET,
559#!/bin/sh
560set -e
561tmpfile="\$(mktemp -p [% shell_quote(c("tmp_dir")) %])"
562wget -O"\$tmpfile" [% shell_quote(c("URL")) %]
563mv -f "\$tmpfile" [% shell_quote(dest_dir _ "/" _ c("filename")) %]
564URLGET
565 sig_ext => [ qw(gpg asc sig) ],
566 enable => 1,
567
# spent 152s (64.2ms+152) within RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578] which was called 1991 times, avg 76.2ms/call: # 1991 times (64.2ms+152s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 76.2ms/call
gnu_utils => sub {
56819918.75ms my ($project, $options) = @_;
56919917.17ms19910s my $distro = RBM::project_config($project, 'lsb_release/id', $options);
# spent 152s making 1991 calls to RBM::project_config, avg 76.1ms/call, recursion: max depth 51, sum of overlapping time 152s
570199130.4ms my %non_gnu = (
571 'Mac OS X' => 1,
572 NetBSD => 1,
573 OpenBSD => 1,
574 FreeBSD => 1,
575 DragonFly => 1,
576 );
577199117.3ms return ! $non_gnu{$distro};
578 },
579 tar => <<TAR_END,
580[%- SET src = c('tar_src', { error_if_undef => 1 }) -%]
581find [% src.join(' ') %] [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 700 {} \\;
582find [% src.join(' ') %] ! [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 600 {} \\;
583find [% src.join(' ') %] | sort | \
584 GZIP="--no-name \${GZIP}" tar --no-recursion [% IF c('gnu_utils') -%]
585 --owner=root --group=root --mtime=@[% c('timestamp') %]
586 [%- END -%]
587 [% c('tar_args', { error_if_undef => 1 }) %] -T -
588TAR_END
589####
590####
591####
592 zip => <<ZIP_END,
593[%- SET src = c('zip_src', { error_if_undef => 1 }) -%]
594[% USE date -%]
595find [% src.join(' ') %] -exec touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %] -- {} +
596find [% src.join(' ') %] [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 700 {} \\;
597find [% src.join(' ') %] ! [% IF c('gnu_utils') %]-executable[% ELSE %]-perm +0111[% END %] -exec chmod 600 {} \\;
598find [% src.join(' ') %] | sort | \
599 zip -q -@ -X [% c('zip_args', { error_if_undef => 1 }) %]
600ZIP_END
601####
602####
603####
604 arch => \&get_arch,
605397675.4ms39762.46s
# spent 141s (38.6ms+141) within RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605] which was called 3976 times, avg 35.5ms/call: # 3976 times (38.6ms+141s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 35.5ms/call
input_files_by_name => sub { RBM::input_files('getfnames', @_); },
# spent 141s making 3976 calls to RBM::input_files, avg 35.5ms/call, recursion: max depth 11, sum of overlapping time 139s
606199028.7ms19901084s
# spent 1610s (27.8ms+1610) within RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606] which was called 1990 times, avg 809ms/call: # 1990 times (27.8ms+1610s) by RBM::config_p at line 94 of /root/tor-browser-build/rbm/lib/RBM.pm, avg 809ms/call
input_files_id => sub { RBM::input_files('input_files_id', @_); },
# spent 8372s making 1990 calls to RBM::input_files, avg 4.21s/call, recursion: max depth 11, sum of overlapping time 7287s
607 input_files_paths => sub { RBM::input_files('getfpaths', @_); },
608152µs steps => {
609 srpm => 'rpm',
610 'deb-src' => 'deb',
611 },
612 suexec => 'sudo -- [% c("suexec_cmd") %]',
613 hg => 'hg [% c("hg_opt") %]',
614);
615
616116µs1;
617# vim: expandtab sw=4
 
# spent 41.5ms within RBM::DefaultConfig::CORE:ftfile which was called 1991 times, avg 21µs/call: # 1991 times (41.5ms+0s) by RBM::DefaultConfig::lsb_release at line 44, avg 21µs/call
sub RBM::DefaultConfig::CORE:ftfile; # opcode
# spent 77.7ms within RBM::DefaultConfig::CORE:match which was called 37829 times, avg 2µs/call: # 19910 times (32.0ms+0s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] at line 554, avg 2µs/call # 5973 times (32.8ms+0s) by RBM::DefaultConfig::lsb_release at line 64, avg 5µs/call # 5973 times (6.44ms+0s) by RBM::DefaultConfig::lsb_release at line 66, avg 1µs/call # 5973 times (6.42ms+0s) by RBM::DefaultConfig::lsb_release at line 65, avg 1µs/call
sub RBM::DefaultConfig::CORE:match; # opcode
# spent 700ns within RBM::DefaultConfig::__ANON__ which was called: # once (700ns+0s) by RBM::DefaultConfig::BEGIN@13 at line 13
sub RBM::DefaultConfig::__ANON__; # xsub