← 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.pm
StatementsExecuted 1091025645 statements in 833s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
8756644071272s1620sRBM::::config_pRBM::config_p (recurses: max depth 13, inclusive time 8373s)
276350021188s326sRBM::::get_targetRBM::get_target (recurses: max depth 1, inclusive time 157s)
69087511167s1621sRBM::::configRBM::config (recurses: max depth 13, inclusive time 8773s)
11156.5s56.5sRBM::::CORE:waitpidRBM::CORE:waitpid (opcode)
143277952243.6s1623sRBM::::project_configRBM::project_config (recurses: max depth 55, inclusive time 40869s)
3753872141.5s1623sRBM::::process_templateRBM::process_template (recurses: max depth 40, inclusive time 30288s)
6908751121.5s351sRBM::::get_targetsRBM::get_targets
6908751120.1s36.1sRBM::::get_stepRBM::get_step
497678114.50s168sRBM::::notmplRBM::notmpl
6087341214.43s5.07sRBM::::rbm_pathRBM::rbm_path
12513.62s3.62sRBM::::CORE:systemRBM::CORE:system (opcode)
1381750112.20s2.20sRBM::::CORE:regcompRBM::CORE:regcomp (opcode)
5967322.08s1617sRBM::::input_filesRBM::input_files (recurses: max depth 11, inclusive time 7426s)
853155111.84s1.84sRBM::::confkey_strRBM::confkey_str
1808655441.32s30338sRBM::::__ANON__[rbm/lib/RBM.pm:652]RBM::__ANON__[rbm/lib/RBM.pm:652]
1990615521.30s1.30sRBM::::CORE:matchRBM::CORE:match (opcode)
69087511963ms963msRBM::::as_arrayRBM::as_array
51584101686ms342sRBM::::__ANON__[rbm/lib/RBM.pm:807]RBM::__ANON__[rbm/lib/RBM.pm:807]
2984341554ms1618sRBM::::project_step_configRBM::project_step_config (recurses: max depth 12, inclusive time 7710s)
1211071246ms246msRBM::::CORE:chdirRBM::CORE:chdir (opcode)
1193411220ms220msRBM::::CORE:ftisRBM::CORE:ftis (opcode)
1990982215ms112sRBM::::__ANON__[rbm/lib/RBM.pm:657]RBM::__ANON__[rbm/lib/RBM.pm:657]
397611180ms597sRBM::::__ANON__[rbm/lib/RBM.pm:858]RBM::__ANON__[rbm/lib/RBM.pm:858]
606121170ms170msRBM::::CORE:ftdirRBM::CORE:ftdir (opcode)
1991011128ms25.6sRBM::::__ANON__[rbm/lib/RBM.pm:662]RBM::__ANON__[rbm/lib/RBM.pm:662]
397322126ms3.76sRBM::::executeRBM::execute
596711124ms344msRBM::::file_in_dirRBM::file_in_dir
59671193.3ms15.2sRBM::::input_file_need_dlRBM::input_file_need_dl
79442185.5ms49.4sRBM::::__ANON__[rbm/lib/RBM.pm:850]RBM::__ANON__[rbm/lib/RBM.pm:850]
59611177.1ms15.3sRBM::::input_file_idRBM::input_file_id
60553161.7ms232msRBM::::create_dirRBM::create_dir
40386249.5ms382msRBM::::__ANON__[rbm/lib/RBM.pm:667]RBM::__ANON__[rbm/lib/RBM.pm:667]
11136.8ms56.5sRBM::::system_logRBM::system_log
29771136.5ms1.84sRBM::::__ANON__[rbm/lib/RBM.pm:660]RBM::__ANON__[rbm/lib/RBM.pm:660]
19921128.6ms242msRBM::::sha256fileRBM::sha256file
59693126.2ms26.2msRBM::::gpg_idRBM::gpg_id
1118.73ms25.9msRBM::::BEGIN@5RBM::BEGIN@5
101815.55ms68.7sRBM::::run_scriptRBM::run_script
87214.82ms1.53sRBM::::git_clone_fetch_chdirRBM::git_clone_fetch_chdir
8314.76ms4.76msRBM::::CORE:printRBM::CORE:print (opcode)
1113.68ms4.08msRBM::::BEGIN@23RBM::BEGIN@23
87113.42ms1.17sRBM::::git_need_fetchRBM::git_need_fetch
1113.29ms3.68msRBM::::BEGIN@15RBM::BEGIN@15
1113.27ms13.6msRBM::::BEGIN@6RBM::BEGIN@6
1112.68ms1692sRBM::::build_runRBM::build_run
144212.51ms15.3msRBM::::load_config_fileRBM::load_config_file
1112.20ms2.81msRBM::::BEGIN@22RBM::BEGIN@22
1112.17ms2.84msRBM::::BEGIN@21RBM::BEGIN@21
1112.16ms4.05msRBM::::BEGIN@11RBM::BEGIN@11
1112.05ms3.50msRBM::::BEGIN@14RBM::BEGIN@14
1111.97ms2.27msRBM::::BEGIN@20RBM::BEGIN@20
1111.45ms4.81msRBM::::BEGIN@8RBM::BEGIN@8
1111.36ms11.3msRBM::::BEGIN@12RBM::BEGIN@12
15111.31ms1.31msRBM::::CORE:unlinkRBM::CORE:unlink (opcode)
1111.18ms17.8msRBM::::BEGIN@9RBM::BEGIN@9
111890µs922µsRBM::::BEGIN@24RBM::BEGIN@24
111843µs20.9msRBM::::load_configRBM::load_config
111830µs944µsRBM::::BEGIN@18RBM::BEGIN@18
15561760µs760µsRBM::::CORE:ftfileRBM::CORE:ftfile (opcode)
111702µs951µsRBM::::BEGIN@53RBM::BEGIN@53
111656µs863µsRBM::::BEGIN@19RBM::BEGIN@19
111643µs643µsRBM::::CORE:globRBM::CORE:glob (opcode)
811588µs2.54sRBM::::__ANON__[rbm/lib/RBM.pm:1095]RBM::__ANON__[rbm/lib/RBM.pm:1095]
1732337µs182msRBM::::get_tmp_dirRBM::get_tmp_dir
111297µs295msRBM::::maketarRBM::maketar
111192µs56.5sRBM::::__ANON__[rbm/lib/RBM.pm:1107]RBM::__ANON__[rbm/lib/RBM.pm:1107]
111143µs929msRBM::::__ANON__[rbm/lib/RBM.pm:1157]RBM::__ANON__[rbm/lib/RBM.pm:1157]
611109µs639msRBM::::recursive_copyRBM::recursive_copy
11199µs73.8msRBM::::__ANON__[rbm/lib/RBM.pm:1131]RBM::__ANON__[rbm/lib/RBM.pm:1131]
162165µs65µsRBM::::CORE:chmodRBM::CORE:chmod (opcode)
11152µs52µsRBM::::CORE:utimeRBM::CORE:utime (opcode)
11151µs51µsRBM::::set_default_envRBM::set_default_env
61151µs51µsRBM::::CORE:mkdirRBM::CORE:mkdir (opcode)
11118µs48µsRBM::::find_config_fileRBM::find_config_file
11116µs5.36msRBM::::load_local_configRBM::load_local_config
11116µs52.0msRBM::::load_system_configRBM::load_system_config
11116µs29µsRBM::::BEGIN@3RBM::BEGIN@3
11116µs1692sRBM::::build_pkgRBM::build_pkg
11115µs43µsRBM::::BEGIN@17RBM::BEGIN@17
11112µs49µsRBM::::BEGIN@7RBM::BEGIN@7
11111µs867µsRBM::::copy_filesRBM::copy_files
11110µs29µsRBM::::BEGIN@16RBM::BEGIN@16
2219µs9µsRBM::::valid_projectRBM::valid_project
1118µs54µsRBM::::BEGIN@13RBM::BEGIN@13
1118µs40µsRBM::::BEGIN@10RBM::BEGIN@10
1116µs7µsRBM::::BEGIN@4RBM::BEGIN@4
1111µs1µsRBM::::__ANON__RBM::__ANON__ (xsub)
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:1119]RBM::__ANON__[rbm/lib/RBM.pm:1119]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:1149]RBM::__ANON__[rbm/lib/RBM.pm:1149]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:710]RBM::__ANON__[rbm/lib/RBM.pm:710]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:891]RBM::__ANON__[rbm/lib/RBM.pm:891]
0000s0sRBM::::exit_errorRBM::exit_error
0000s0sRBM::::file_sign_idRBM::file_sign_id
0000s0sRBM::::git_commit_sign_idRBM::git_commit_sign_id
0000s0sRBM::::git_get_signed_tagnameRBM::git_get_signed_tagname
0000s0sRBM::::git_tag_sign_idRBM::git_tag_sign_id
0000s0sRBM::::gpg_get_fingerprintRBM::gpg_get_fingerprint
0000s0sRBM::::hg_clone_fetch_chdirRBM::hg_clone_fetch_chdir
0000s0sRBM::::hg_need_fetchRBM::hg_need_fetch
0000s0sRBM::::input_file_id_hashRBM::input_file_id_hash
0000s0sRBM::::is_urlRBM::is_url
0000s0sRBM::::process_template_optRBM::process_template_opt
0000s0sRBM::::projectslistRBM::projectslist
0000s0sRBM::::publishRBM::publish
0000s0sRBM::::rpmspecRBM::rpmspec
0000s0sRBM::::set_git_gpg_wrapperRBM::set_git_gpg_wrapper
0000s0sRBM::::unset_git_gpg_wrapperRBM::unset_git_gpg_wrapper
0000s0sRBM::::urlgetRBM::urlget
0000s0sRBM::::valid_idRBM::valid_id
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package RBM;
2
3228µs243µs
# spent 29µs (16+14) within RBM::BEGIN@3 which was called: # once (16µs+14µs) by main::BEGIN@6 at line 3
use warnings;
# spent 29µs making 1 call to RBM::BEGIN@3 # spent 14µs making 1 call to warnings::import
4220µs29µs
# spent 7µs (6+2) within RBM::BEGIN@4 which was called: # once (6µs+2µs) by main::BEGIN@6 at line 4
use strict;
# spent 7µs making 1 call to RBM::BEGIN@4 # spent 2µs making 1 call to strict::import
52110µs226.0ms
# spent 25.9ms (8.73+17.2) within RBM::BEGIN@5 which was called: # once (8.73ms+17.2ms) by main::BEGIN@6 at line 5
use Path::Tiny;
# spent 25.9ms making 1 call to RBM::BEGIN@5 # spent 43µs making 1 call to Exporter::import
62113µs213.7ms
# spent 13.6ms (3.27+10.3) within RBM::BEGIN@6 which was called: # once (3.27ms+10.3ms) by main::BEGIN@6 at line 6
use Encode qw(encode);
# spent 13.6ms making 1 call to RBM::BEGIN@6 # spent 92µs making 1 call to Exporter::import
7228µs286µs
# spent 49µs (12+37) within RBM::BEGIN@7 which was called: # once (12µs+37µs) by main::BEGIN@6 at line 7
use Cwd qw(getcwd);
# spent 49µs making 1 call to RBM::BEGIN@7 # spent 37µs making 1 call to Exporter::import
8281µs24.84ms
# spent 4.81ms (1.45+3.36) within RBM::BEGIN@8 which was called: # once (1.45ms+3.36ms) by main::BEGIN@6 at line 8
use YAML::XS qw(LoadFile);
# spent 4.81ms making 1 call to RBM::BEGIN@8 # spent 29µs making 1 call to Exporter::import
92130µs217.8ms
# spent 17.8ms (1.18+16.7) within RBM::BEGIN@9 which was called: # once (1.18ms+16.7ms) by main::BEGIN@6 at line 9
use Template;
# spent 17.8ms making 1 call to RBM::BEGIN@9 # spent 1µs making 1 call to RBM::__ANON__
10223µs273µs
# spent 40µs (8+33) within RBM::BEGIN@10 which was called: # once (8µs+33µs) by main::BEGIN@6 at line 10
use File::Basename;
# spent 40µs making 1 call to RBM::BEGIN@10 # spent 32µs making 1 call to Exporter::import
112118µs24.07ms
# spent 4.05ms (2.16+1.88) within RBM::BEGIN@11 which was called: # once (2.16ms+1.88ms) by main::BEGIN@6 at line 11
use IO::Handle;
# spent 4.05ms making 1 call to RBM::BEGIN@11 # spent 22µs making 1 call to Exporter::import
122111µs211.3ms
# spent 11.3ms (1.36+9.89) within RBM::BEGIN@12 which was called: # once (1.36ms+9.89ms) by main::BEGIN@6 at line 12
use IO::CaptureOutput qw(capture_exec);
# spent 11.3ms making 1 call to RBM::BEGIN@12 # spent 33µs making 1 call to Exporter::import
13222µs2100µs
# spent 54µs (8+46) within RBM::BEGIN@13 which was called: # once (8µs+46µs) by main::BEGIN@6 at line 13
use File::Temp;
# spent 54µs making 1 call to RBM::BEGIN@13 # spent 46µs making 1 call to Exporter::import
142133µs23.55ms
# spent 3.50ms (2.05+1.45) within RBM::BEGIN@14 which was called: # once (2.05ms+1.45ms) by main::BEGIN@6 at line 14
use File::Copy;
# spent 3.50ms making 1 call to RBM::BEGIN@14 # spent 46µs making 1 call to Exporter::import
152130µs23.75ms
# spent 3.68ms (3.29+397µs) within RBM::BEGIN@15 which was called: # once (3.29ms+397µs) by main::BEGIN@6 at line 15
use File::Copy::Recursive qw(fcopy);
# spent 3.68ms making 1 call to RBM::BEGIN@15 # spent 63µs making 1 call to Exporter::import
16224µs248µs
# spent 29µs (10+19) within RBM::BEGIN@16 which was called: # once (10µs+19µs) by main::BEGIN@6 at line 16
use File::Path qw(make_path);
# spent 29µs making 1 call to RBM::BEGIN@16 # spent 19µs making 1 call to Exporter::import
17224µs271µs
# spent 43µs (15+28) within RBM::BEGIN@17 which was called: # once (15µs+28µs) by main::BEGIN@6 at line 17
use File::Basename;
# spent 43µs making 1 call to RBM::BEGIN@17 # spent 28µs making 1 call to Exporter::import
182132µs2986µs
# spent 944µs (830+113) within RBM::BEGIN@18 which was called: # once (830µs+113µs) by main::BEGIN@6 at line 18
use String::ShellQuote;
# spent 944µs making 1 call to RBM::BEGIN@18 # spent 42µs making 1 call to Exporter::import
192122µs2964µs
# spent 863µs (656+206) within RBM::BEGIN@19 which was called: # once (656µs+206µs) by main::BEGIN@6 at line 19
use Sort::Versions;
# spent 863µs making 1 call to RBM::BEGIN@19 # spent 101µs making 1 call to Exporter::import
202102µs22.34ms
# spent 2.27ms (1.97+298µs) within RBM::BEGIN@20 which was called: # once (1.97ms+298µs) by main::BEGIN@6 at line 20
use RBM::DefaultConfig;
# spent 2.27ms making 1 call to RBM::BEGIN@20 # spent 76µs making 1 call to Exporter::import
212117µs22.93ms
# spent 2.84ms (2.17+661µs) within RBM::BEGIN@21 which was called: # once (2.17ms+661µs) by main::BEGIN@6 at line 21
use Digest::SHA qw(sha256_hex);
# spent 2.84ms making 1 call to RBM::BEGIN@21 # spent 94µs making 1 call to Exporter::import
222108µs22.86ms
# spent 2.81ms (2.20+611µs) within RBM::BEGIN@22 which was called: # once (2.20ms+611µs) by main::BEGIN@6 at line 22
use Data::UUID;
# spent 2.81ms making 1 call to RBM::BEGIN@22 # spent 52µs making 1 call to Exporter::import
232104µs24.13ms
# spent 4.08ms (3.68+403µs) within RBM::BEGIN@23 which was called: # once (3.68ms+403µs) by main::BEGIN@6 at line 23
use Data::Dump qw(dd pp);
# spent 4.08ms making 1 call to RBM::BEGIN@23 # spent 52µs making 1 call to Exporter::import
2421.09ms2954µs
# spent 922µs (890+32) within RBM::BEGIN@24 which was called: # once (890µs+32µs) by main::BEGIN@6 at line 24
use feature "state";
# spent 922µs making 1 call to RBM::BEGIN@24 # spent 32µs making 1 call to feature::import
25
26our $config;
27
28
# spent 15.3ms (2.51+12.8) within RBM::load_config_file which was called 144 times, avg 106µs/call: # 143 times (1.44ms+11.8ms) by RBM::load_config at line 55, avg 93µs/call # once (1.06ms+976µs) by RBM::load_config at line 47
sub load_config_file {
2914444µs my $res = {};
3014414µs my @conf;
31 eval {
32144226µs14412.7ms @conf = LoadFile($_[0]);
# spent 12.7ms making 144 calls to YAML::XS::LoadFile, avg 88µs/call
3314470µs } or do {
34 exit_error("Error reading file $_[0] :\n" . $@);
35 };
3614456µs foreach my $c (@conf) {
3714585µs local $@ = '';
38145589µs $res = { %$res, %$c } if ref $c eq 'HASH';
3914582µs $res = { %$res, eval $c } if !ref $c;
# spent 2.58ms executing statements in string eval
# includes 1.11ms spent executing 32 calls to 6 subs defined therein.
4014563µs exit_error("Error executing perl config from $_[0] :\n" . $@) if $@;
41 }
42144285µs return $res;
43}
44
45
# spent 20.9ms (843µs+20.1) within RBM::load_config which was called: # once (843µs+20.1ms) by main::RUNTIME at line 202 of /root/tor-browser-build/rbm/rbm
sub load_config {
4613µs148µs my $config_file = shift // find_config_file();
# spent 48µs making 1 call to RBM::find_config_file
4713µs12.04ms $config = load_config_file($config_file);
# spent 2.04ms making 1 call to RBM::load_config_file
4812µs $config->{default} = \%default_config;
4914µs1153µs $config->{basedir} = dirname($config_file);
# spent 153µs making 1 call to File::Basename::dirname
5012µs $config->{step} = 'rbm_init';
5111µs $config->{opt} = {};
5213µs my $pdir = $config->{projects_dir} || $config->{default}{projects_dir};
53310.2ms31.60ms
# spent 951µs (702+249) within RBM::BEGIN@53 which was called: # once (702µs+249µs) by main::BEGIN@6 at line 53
foreach my $p (glob rbm_path($pdir) . '/*') {
# spent 951µs making 1 call to RBM::BEGIN@53 # spent 643µs making 1 call to RBM::CORE:glob # spent 10µs making 1 call to RBM::rbm_path
54144851µs144632µs next unless -f "$p/config";
# spent 632µs making 144 calls to RBM::CORE:ftfile, avg 4µs/call
55143450µs28616.6ms $config->{projects}{basename($p)} = load_config_file("$p/config");
# spent 13.2ms making 143 calls to RBM::load_config_file, avg 93µs/call # spent 3.32ms making 143 calls to File::Basename::basename, avg 23µs/call
56 }
57}
58
59
# spent 52.0ms (16µs+52.0) within RBM::load_system_config which was called: # once (16µs+52.0ms) by main::set_options at line 110 of /root/tor-browser-build/rbm/rbm
sub load_system_config {
601800ns my ($project) = @_;
6116µs151.9ms my $cfile = project_config($project ? $project : 'undef', 'sysconf_file');
# spent 51.9ms making 1 call to RBM::project_config
62126µs116µs $config->{system} = -f $cfile ? load_config_file($cfile) : {};
# spent 16µs making 1 call to RBM::CORE:ftfile
63}
64
65
# spent 5.36ms (16µs+5.35) within RBM::load_local_config which was called: # once (16µs+5.35ms) by main::set_options at line 111 of /root/tor-browser-build/rbm/rbm
sub load_local_config {
661900ns my ($project) = @_;
6713µs15.33ms my $cfile = project_config($project ? $project : 'undef', 'localconf_file');
# spent 5.33ms making 1 call to RBM::project_config
6811µs14µs $cfile = rbm_path($cfile);
# spent 4µs making 1 call to RBM::rbm_path
69126µs117µs $config->{local} = -f $cfile ? load_config_file($cfile) : {};
# spent 17µs making 1 call to RBM::CORE:ftfile
70}
71
72
# spent 48µs (18+31) within RBM::find_config_file which was called: # once (18µs+31µs) by RBM::load_config at line 46
sub find_config_file {
73150µs231µs for (my $dir = getcwd; $dir ne '/'; $dir = dirname($dir)) {
# spent 17µs making 1 call to RBM::CORE:ftfile # spent 14µs making 1 call to Cwd::getcwd
74 return "$dir/rbm.conf" if -f "$dir/rbm.conf";
75 }
76 exit_error("Can't find config file");
77}
78
79
# spent 51µs within RBM::set_default_env which was called: # once (51µs+0s) by main::RUNTIME at line 203 of /root/tor-browser-build/rbm/rbm
sub set_default_env {
80152µs %ENV = (%ENV, %{$config->{ENV}}) if ref $config->{ENV} eq 'HASH';
81}
82
83
# spent 5.07s (4.43+637ms) within RBM::rbm_path which was called 608734 times, avg 8µs/call: # 375387 times (2.43s+263ms) by RBM::process_template at line 643, avg 7µs/call # 219243 times (1.88s+355ms) by RBM::process_template at line 642, avg 10µs/call # 5967 times (61.9ms+7.92ms) by RBM::input_files at line 793, avg 12µs/call # 3975 times (30.3ms+4.09ms) by RBM::input_files at line 862, avg 9µs/call # 1992 times (15.0ms+2.06ms) by RBM::input_files at line 867, avg 9µs/call # 1992 times (10.8ms+4.47ms) by RBM::sha256file at line 612, avg 8µs/call # 87 times (429µs+235µs) by RBM::git_clone_fetch_chdir at line 401, avg 8µs/call # 87 times (465µs+73µs) by RBM::git_clone_fetch_chdir at line 391, avg 6µs/call # once (9µs+1µs) by RBM::load_config at line 53 # once (7µs+1µs) by RBM::build_run at line 1077 # once (4µs+800ns) by RBM::build_run at line 1002 # once (3µs+1µs) by RBM::load_local_config at line 68
sub rbm_path {
84608734324ms my ($path, $basedir) = @_;
85608734555ms $basedir //= $config->{basedir};
866087345.56s608734637ms return ( $path =~ m|^/| ) ? $path : "$basedir/$path";
# spent 637ms making 608734 calls to RBM::CORE:match, avg 1µs/call
87}
88
89
# spent 1620s (272+1348) within RBM::config_p which was called 87566440 times, avg 19µs/call: # 44216000 times (137s+-137s) by RBM::get_target at line 108, avg 5ns/call # 12812988 times (42.0s+-41.9s) by RBM::config at line 158, avg 6ns/call # 12810998 times (39.7s+-39.7s) by RBM::config at line 172, avg 5ns/call # 5527000 times (15.9s+-15.9s) by RBM::get_step at line 132, avg 5ns/call # 4270996 times (13.0s+-13.0s) by RBM::config at line 165, avg 5ns/call # 4247106 times (13.1s+1606s) by RBM::config at line 179, avg 381µs/call # 3681352 times (10.5s+-10.5s) by RBM::config at line 150, avg 4ns/call
sub config_p {
908756644053.7s my ($c, $project, $options, @q) = @_;
918756644013.7s foreach my $p (@q) {
9220825629737.0s return undef unless ref $c eq 'HASH';
93208256297281s return undef unless defined $c->{$p};
9412453421163.5s358822960s $c = ref $c->{$p} eq 'CODE' ? $c->{$p}->($project, $options, @_) : $c->{$p};
# spent 8372s making 1990 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606], avg 4.21s/call, recursion: max depth 11, sum of overlapping time 6762s # spent 597s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:858], avg 150ms/call # spent 304s making 19910 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557], avg 15.2ms/call # spent 152s making 1991 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578], avg 76.2ms/call # spent 145s making 1991 calls to RBM::DefaultConfig::lsb_release, avg 72.7ms/call # spent 141s making 3976 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605], avg 35.5ms/call # spent 9.53s making 1992 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156], avg 4.78ms/call # spent 903ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:16], avg 60.2ms/call # spent 891ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:10], avg 59.4ms/call # spent 6.33ms making 26 calls to RBM::DefaultConfig::rbm_tmp_dir, avg 244µs/call
95 }
96384435411.3s return $c;
97}
98
99
# spent 963ms within RBM::as_array which was called 690875 times, avg 1µs/call: # 690875 times (963ms+0s) by RBM::get_targets at line 124, avg 1µs/call
sub as_array {
1006908753.00s ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ];
101}
102
103
# spent 326s (188+137) within RBM::get_target which was called 2763500 times, avg 118µs/call: # 1381750 times (98.8s+227s) by RBM::get_targets at line 126, avg 236µs/call # 1381750 times (89.5s+-89.5s) by RBM::get_target at line 116, avg 0s/call
sub get_target {
10427635001.25s my ($project, $options, $paths, $target) = @_;
1052763500387ms my @res;
10627635001.18s foreach my $path (@$paths) {
1072210800032.2s foreach my $step ([ 'steps', $config->{step} ], []) {
1084421600037.6s44216000239ms my $z = config_p($config, $project, $options, @$path, @$step,
# spent 137s making 44216000 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 137s
109 'targets', $target);
110442160007.69s next unless $z;
1113189746915ms if (ref $z eq 'HASH') {
11224988711.21s push @res, $target unless grep { $_ eq $target } @res;
1132498871687ms next;
114 }
115690875770ms my @z = ref $z eq 'ARRAY' ? (@{$z}) : ($z);
11634543753.39s13817500s push @res, map { @{get_target($project, $options, $paths, $_)} } @z;
# spent 157s making 1381750 calls to RBM::get_target, avg 113µs/call, recursion: max depth 1, sum of overlapping time 157s
117 }
118 }
11927635008.67s return \@res;
120}
121
122
# spent 351s (21.5+329) within RBM::get_targets which was called 690875 times, avg 508µs/call: # 690875 times (21.5s+329s) by RBM::config at line 145, avg 508µs/call
sub get_targets {
123690875328ms my ($project, $options, $paths) = @_;
1246908751.71s690875963ms my $tmp = $config->{run}{target} ? as_array($config->{run}{target}) : [ 'notarget' ];
# spent 963ms making 690875 calls to RBM::as_array, avg 1µs/call
125207262512.8s27635002.86s $tmp = [ map { m/^$project:(.+)$/ ? $1 : $_ } @$tmp ];
# spent 2.20s making 1381750 calls to RBM::CORE:regcomp, avg 2µs/call # spent 660ms making 1381750 calls to RBM::CORE:match, avg 478ns/call
12634543755.85s1381750326s return [ map { @{get_target($project, $options, $paths, $_)} } @$tmp ];
# spent 326s making 1381750 calls to RBM::get_target, avg 236µs/call
127}
128
129
# spent 36.1s (20.1+15.9) within RBM::get_step which was called 690875 times, avg 52µs/call: # 690875 times (20.1s+15.9s) by RBM::config at line 146, avg 52µs/call
sub get_step {
130690875368ms my ($project, $options, $step, $paths) = @_;
1316908751.33s foreach my $path (@$paths) {
13255270004.47s552700027.2ms my $z = config_p($config, $project, $options, @$path, 'steps', $step);
# spent 15.9s making 5527000 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 15.9s
13355270001.09s next unless $z;
134 return $step if ref $z;
135 return get_step($project, $options, $z, $paths);
136 }
1376908752.14s return $step;
138}
139
140
# spent 1621s (167+1454) within RBM::config which was called 690875 times, avg 2.35ms/call: # 690875 times (167s+1454s) by RBM::project_config at line 223, avg 2.35ms/call
sub config {
141690875300ms my $project = shift;
142690875188ms my $name = shift;
143690875155ms my $options = shift;
144690875109ms my $res;
1456908751.80s690875351s my @targets = @{get_targets($project, $options, \@_)};
# spent 351s making 690875 calls to RBM::get_targets, avg 508µs/call
1466908751.58s69087536.1s my @step = ('steps', get_step($project, $options, $config->{step}, \@_));
# spent 36.1s making 690875 calls to RBM::get_step, avg 52µs/call
147690875301ms my $as_array = $options->{as_array};
148690875321ms foreach my $path (@_) {
1494270996473ms my @l;
15042709965.34s368135214.6ms push @l, config_p($config, $project, $options, @$path, "override.$name->[0]")
# spent 10.5s making 3681352 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 10.5s
151 if @$name == 1;
15242709961.22s if (!$as_array) {
15342709961.86s @l = grep { defined $_ } @l;
1544270996562ms return $l[0] if @l;
155 }
156 # 1st priority: targets + step matching
15742709961.42s foreach my $t (@targets) {
1581281298811.7s1281298871.1ms push @l, config_p($config, $project, $options, @$path, @step, 'targets', $t, @$name);
# spent 42.0s making 12812988 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 41.9s
159128129886.33s if (!$as_array) {
160128129884.83s @l = grep { defined $_ } @l;
161128129881.37s return $l[0] if @l;
162 }
163 }
164 # 2nd priority: step maching
16542709963.88s427099622.9ms push @l, config_p($config, $project, $options, @$path, @step, @$name);
# spent 13.0s making 4270996 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 13.0s
16642709961.15s if (!$as_array) {
16742709961.81s @l = grep { defined $_ } @l;
1684270996450ms return $l[0] if @l;
169 }
170 # 3rd priority: target matching
17142709961.36s foreach my $t (@targets) {
1721281099811.2s1281099865.9ms push @l, config_p($config, $project, $options, @$path, 'targets', $t, @$name);
# spent 39.7s making 12810998 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 39.7s
173128109986.00s if (!$as_array) {
174128109984.82s @l = grep { defined $_ } @l;
175128109981.41s return $l[0] if @l;
176 }
177 }
178 # last priority: no target and no step matching
17942471063.83s42471061620s push @l, config_p($config, $project, $options, @$path, @$name);
# spent 9735s making 4247106 calls to RBM::config_p, avg 2.29ms/call, recursion: max depth 13, sum of overlapping time 8115s
18042471061.08s if (!$as_array) {
18142471061.94s @l = grep { defined $_ } @l;
18242471063.42s return $l[0] if @l;
183 }
1843616388859ms @l = grep { defined $_ } @l;
18536163881.66s push @$res, @l if @l;
186 }
18736267148ms return $as_array ? $res : undef;
188}
189
190
# spent 168s (4.50+163) within RBM::notmpl which was called 497678 times, avg 337µs/call: # 497678 times (4.50s+163s) by RBM::project_config at line 226, avg 337µs/call
sub notmpl {
191497678332ms my ($name, $project) = @_;
192497678228ms return 1 if $name eq 'notmpl';
193 my @n = (@{$config->{default}{notmpl}},
1944976781.52s4976780s @{project_config($project, 'notmpl')});
# spent 163s making 497678 calls to RBM::project_config, avg 328µs/call, recursion: max depth 55, sum of overlapping time 163s
1954976782.13s return grep { $name eq $_ } @n;
196}
197
198
# spent 1.84s within RBM::confkey_str which was called 853155 times, avg 2µs/call: # 853155 times (1.84s+0s) by RBM::project_config at line 226, avg 2µs/call
sub confkey_str {
1998531553.63s ref $_[0] eq 'ARRAY' ? join '/', @{$_[0]} : $_[0];
200}
201
202
# spent 1623s (43.6+1580) within RBM::project_config which was called 1432779 times, avg 1.13ms/call: # 497678 times (10.1s+-10.1s) by RBM::notmpl at line 194, avg 0s/call # 375387 times (7.57s+-7.57s) by RBM::process_template at line 643, avg 0s/call # 219243 times (7.01s+-7.01s) by RBM::process_template at line 642, avg 0s/call # 180865 times (9.83s+-9.83s) by RBM::__ANON__[rbm/lib/RBM.pm:652] at line 652, avg 0s/call # 51584 times (3.20s+-2.99s) by RBM::__ANON__[rbm/lib/RBM.pm:807] at line 806, avg 4µs/call # 29843 times (1.73s+528s) by RBM::project_step_config at line 252, avg 17.7ms/call # 19910 times (1.23s+-1.23s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] at line 537 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 19910 times (1.34s+-1.34s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] at line 538 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 7944 times (481ms+-481ms) by RBM::__ANON__[rbm/lib/RBM.pm:850] at line 849, avg 0s/call # 5967 times (194ms+-192ms) by RBM::input_files at line 793, avg 248ns/call # 5967 times (237ms+-237ms) by RBM::input_files at line 791, avg 104ns/call # 3973 times (67.9ms+-67.9ms) by RBM::execute at line 481, avg 0s/call # 3973 times (33.9ms+-33.9ms) by RBM::execute at line 482, avg 0s/call # 2988 times (122ms+-122ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 142 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 1992 times (130ms+-130ms) by RBM::input_files at line 867, avg 0s/call # 1991 times (73.5ms+-73.5ms) by RBM::DefaultConfig::lsb_release at line 37 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 1991 times (209ms+-209ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578] at line 569 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 996 times (61.9ms+-61.9ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 143 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 87 times (4.25ms+8.71ms) by RBM::git_clone_fetch_chdir at line 391, avg 149µs/call # 87 times (3.92ms+1.54ms) by RBM::git_need_fetch at line 378, avg 63µs/call # 87 times (1.71ms+3.31ms) by RBM::git_clone_fetch_chdir at line 393, avg 58µs/call # 87 times (1.26ms+3.52ms) by RBM::git_need_fetch at line 380, avg 55µs/call # 87 times (2.64ms+-1.87ms) by RBM::git_clone_fetch_chdir at line 397, avg 9µs/call # 86 times (4.88ms+-4.88ms) by RBM::execute at line 490, avg 0s/call # 17 times (887µs+173ms) by RBM::get_tmp_dir at line 265, avg 10.3ms/call # 8 times (1.68ms+2.01s) by RBM::build_run at line 1088, avg 251ms/call # 4 times (519µs+300ms) by RBM::build_run at line 1037, avg 75.2ms/call # 3 times (367µs+1089s) by RBM::build_run at line 1057, avg 363s/call # once (242µs+225ms) by RBM::build_run at line 1105 # once (225µs+225ms) by RBM::build_run at line 1134 # once (132µs+215ms) by RBM::build_run at line 1155 # once (229µs+161ms) by RBM::build_run at line 1024 # once (125µs+144ms) by RBM::build_run at line 1023 # once (167µs+89.3ms) by RBM::maketar at line 603 # once (222µs+53.6ms) by RBM::maketar at line 543 # once (58µs+51.9ms) by RBM::load_system_config at line 61 # once (248µs+40.1ms) by RBM::build_run at line 1124 # once (59µs+23.0ms) by RBM::build_run at line 1156 # once (51µs+20.5ms) by RBM::build_run at line 1074 # once (52µs+13.6ms) by RBM::build_run at line 1076 # once (33µs+13.6ms) by RBM::maketar at line 562 # once (37µs+6.07ms) by RBM::maketar at line 595 # once (48µs+5.60ms) by RBM::maketar at line 531 # once (53µs+5.52ms) by RBM::maketar at line 532 # once (41µs+5.29ms) by RBM::load_local_config at line 67 # once (42µs+5.08ms) by RBM::build_pkg at line 1168 # once (49µs+3.10ms) by RBM::build_run at line 1002 # once (125µs+943µs) by RBM::maketar at line 566 # once (53µs+943µs) by RBM::maketar at line 544 # once (33µs+823µs) by RBM::copy_files at line 696 # once (40µs+799µs) by RBM::build_run at line 1006 # once (22µs+747µs) by RBM::maketar at line 552
sub project_config {
2031432779969ms my ($project, $name, $options) = @_;
204 CORE::state $cache;
2051432779239ms my $res;
2061432779790ms my $error_if_undef = $options->{error_if_undef};
2071432779325ms my $cache_save = $cache;
2081432779663ms if ($options) {
20914327792.28s $options = {%$options, error_if_undef => 0};
21014327792.93s my %ignore_options = map { $_ => 1 } qw(error_if_undef step);
21114327792.45s $cache = {} if grep { !$ignore_options{$_} } keys %$options;
212 }
2131432779782ms my $name_str = ref $name eq 'ARRAY' ? join '/', @$name : $name;
2141432779715ms my $step = $config->{step};
21514327791.31s if (exists $cache->{$project}{$step}{$name_str}) {
216741904481ms $res = $cache->{$project}{$step}{$name_str};
2177419041.63s goto FINISH;
218 }
2196908751.41s $name = [ split '/', $name ] unless ref $name eq 'ARRAY';
220690875182ms goto FINISH unless @$name;
221690875279ms my $opt_save = $config->{opt};
2226908755.40s $config->{opt} = { %{$config->{opt}}, %$options } if $options;
2236908753.55s6908751621s $res = config($project, $name, $options, ['opt', 'norec'], ['opt'],
# spent 10394s making 690875 calls to RBM::config, avg 15.0ms/call, recursion: max depth 13, sum of overlapping time 8773s
224 ['run'], ['projects', $project], ['local'], [],
225 ['system'], ['default']);
2266908753.55s17063101792s if (!$options->{no_tmpl} && defined($res) && !ref $res
# spent 31886s making 355477 calls to RBM::process_template, avg 89.7ms/call, recursion: max depth 40, sum of overlapping time 30263s # spent 168s making 497678 calls to RBM::notmpl, avg 337µs/call # spent 1.84s making 853155 calls to RBM::confkey_str, avg 2µs/call
227 && !notmpl(confkey_str($name), $project)) {
228 $res = process_template($project, $res,
229 confkey_str($name) eq 'output_dir' ? '.' : undef);
230 }
2316908751.63s $cache->{$project}{$step}{$name_str} = $res;
2326908752.32s $config->{opt} = $opt_save;
2331432779688ms FINISH:
234 $cache = $cache_save;
2351432779313ms if (!defined($res) && $error_if_undef) {
236 my $msg = $error_if_undef eq '1' ?
237 "Option " . confkey_str($name) . " is undefined"
238 : $error_if_undef;
239 exit_error($msg);
240 }
24114327798.06s return $res;
242}
243
244
# spent 1618s (554ms+1617) within RBM::project_step_config which was called 29843 times, avg 54.2ms/call: # 19909 times (317ms+-254ms) by RBM::__ANON__[rbm/lib/RBM.pm:657] at line 656, avg 3µs/call # 3975 times (88.8ms+1084s) by RBM::input_files at line 878, avg 273ms/call # 3975 times (92.4ms+-39.3ms) by RBM::input_files at line 862, avg 13µs/call # 1984 times (55.8ms+534s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 856, avg 269ms/call
sub project_step_config {
2452984338.1ms my $run_save = $config->{run};
2462984328.5ms my $step_save = $config->{step};
2472984345.3ms if ($_[2] && $_[2]->{step}) {
248 $config->{step} = $_[2]->{step};
249 }
2502984356.7ms $config->{run} = { target => $_[2]->{target} };
2512984342.2ms $config->{run}{target} //= $run_save->{target};
2522984371.2ms29843530s my $res = project_config(@_);
# spent 9327s making 29843 calls to RBM::project_config, avg 313ms/call, recursion: max depth 51, sum of overlapping time 8798s
2532984356.1ms $config->{run} = $run_save;
2542984333.7ms $config->{step} = $step_save;
25529843177ms return $res;
256}
257
258sub exit_error {
259 print STDERR "Error: ", $_[0], "\n";
260 exit (exists $_[1] ? $_[1] : 1);
261}
262
263
# spent 182ms (337µs+181) within RBM::get_tmp_dir which was called 17 times, avg 10.7ms/call: # 15 times (299µs+169ms) by RBM::run_script at line 465, avg 11.3ms/call # once (17µs+7.47ms) by RBM::build_run at line 1008 # once (22µs+4.83ms) by RBM::DefaultConfig::rbm_tmp_dir at line 109 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
sub get_tmp_dir {
2641735µs my ($project, $options) = @_;
2651758µs17174ms my $tmp_dir = project_config($project, 'tmp_dir', $options);
# spent 179ms making 17 calls to RBM::project_config, avg 10.5ms/call, recursion: max depth 4, sum of overlapping time 4.73ms
2661792µs17264µs make_path($tmp_dir);
# spent 264µs making 17 calls to File::Path::make_path, avg 16µs/call
26717247µs return $tmp_dir;
268}
269
270sub set_git_gpg_wrapper {
271 my ($project) = @_;
272 my $w = project_config($project, 'gpg_wrapper');
273 my (undef, $tmp) = File::Temp::tempfile(DIR => get_tmp_dir($project));
274 path($tmp)->spew_utf8($w);
275 chmod 0700, $tmp;
276 system('git', 'config', 'gpg.program', $tmp) == 0
277 || exit_error 'Error setting gpg.program';
278 return $tmp;
279}
280
281sub unset_git_gpg_wrapper {
282 unlink $_[0];
283 system('git', 'config', '--unset', 'gpg.program') == 0
284 || exit_error 'Error unsetting gpg.program';
285}
286
287sub gpg_get_fingerprint {
288 foreach my $l (@_) {
289 if ($l =~ m/^Primary key fingerprint:(.+)$/) {
290 my $fp = $1;
291 $fp =~ s/\s//g;
292 return $fp;
293 }
294 }
295 return undef;
296}
297
298sub git_commit_sign_id {
299 my ($project, $chash) = @_;
300 my $w = set_git_gpg_wrapper($project);
301 my ($stdout, $stderr, $success, $exit_code) =
302 capture_exec('git', 'log', "--format=format:%G?\n%GG", -1, $chash);
303 unset_git_gpg_wrapper($w);
304 return undef unless $success;
305 my @l = split /\n/, $stdout;
306 return undef unless @l >= 2;
307 return undef unless $l[0] =~ m/^[GU]$/;
308 return gpg_get_fingerprint(@l);
309}
310
311sub git_get_signed_tagname {
312 foreach my $l (split(/\n/, $_[0])) {
313 # the tag message is separated from headers by an empty line, so we
314 # ignore anything after the first empty line
315 return '' unless $l;
316 return $1 if $l =~ m/^tag (.*)$/;
317 }
318 return '';
319}
320
321sub git_tag_sign_id {
322 my ($project, $tag) = @_;
323 my $w = set_git_gpg_wrapper($project);
324 my ($stdout, $stderr, $success, $exit_code)
325 = capture_exec('git', 'tag', '-v', $tag);
326 unset_git_gpg_wrapper($w);
327 return undef unless $success;
328 return undef unless git_get_signed_tagname($stdout) eq $tag;
329 return gpg_get_fingerprint(split /\n/, $stderr);
330}
331
332sub file_sign_id {
333 my ($project, $options) = @_;
334 my (undef, $gpg_wrapper) = File::Temp::tempfile(DIR =>
335 get_tmp_dir($project, $options));
336 path($gpg_wrapper)->spew_utf8(project_config($project, 'gpg_wrapper', $options));
337 chmod 0700, $gpg_wrapper;
338 my ($stdout, $stderr, $success, $exit_code) =
339 capture_exec($gpg_wrapper, '--verify',
340 project_config($project, 'filename_sig', $options),
341 project_config($project, 'filename_data', $options));
342 return undef unless $success;
343 return gpg_get_fingerprint(split /\n/, $stderr);
344}
345
346sub valid_id {
347 my ($fp, $valid_id) = @_;
348 if ($valid_id eq '1' || (ref $valid_id eq 'ARRAY' && @$valid_id == 1
349 && $valid_id->[0] eq '1')) {
350 return 1;
351 }
352 if (ref $valid_id eq 'ARRAY') {
353 foreach my $v (@$valid_id) {
354 return 1 if $fp =~ m/$v$/;
355 }
356 return undef;
357 }
358 return $fp =~ m/$valid_id$/;
359}
360
361
# spent 9µs within RBM::valid_project which was called 2 times, avg 4µs/call: # once (5µs+0s) by RBM::maketar at line 528 # once (4µs+0s) by RBM::build_run at line 1003
sub valid_project {
36221µs my ($project) = @_;
36328µs exists $config->{projects}{$project}
364 || exit_error "Unknown project $project";
365}
366
367
# spent 232ms (61.7+171) within RBM::create_dir which was called 6055 times, avg 38µs/call: # 5967 times (61.0ms+168ms) by RBM::input_files at line 870, avg 38µs/call # 87 times (650µs+2.36ms) by RBM::git_clone_fetch_chdir at line 391, avg 35µs/call # once (17µs+286µs) by RBM::build_run at line 1002
sub create_dir {
36860555.51ms my ($directory) = @_;
3696055235ms6055170ms return $directory if -d $directory;
# spent 170ms making 6055 calls to RBM::CORE:ftdir, avg 28µs/call
37015µs114µs my @res = make_path($directory);
# spent 14µs making 1 call to File::Path::make_path
3711400ns exit_error "Error creating $directory" unless @res;
37213µs return $directory;
373}
374
375
# spent 1.17s (3.42ms+1.17) within RBM::git_need_fetch which was called 87 times, avg 13.5ms/call: # 87 times (3.42ms+1.17s) by RBM::git_clone_fetch_chdir at line 408, avg 13.5ms/call
sub git_need_fetch {
37687306µs my ($project, $options) = @_;
37787128µs return 0 if $config->{projects}{$project}{fetched};
37887222µs875.46ms my $fetch = project_config($project, 'fetch', $options);
# spent 235ms making 87 calls to RBM::project_config, avg 2.70ms/call, recursion: max depth 31, sum of overlapping time 230ms
3798781µs if ($fetch eq 'if_needed') {
38087234µs874.78ms my $git_hash = project_config($project, 'git_hash', $options)
# spent 11.7ms making 87 calls to RBM::project_config, avg 134µs/call, recursion: max depth 31, sum of overlapping time 6.88ms
381 || exit_error "No git_hash specified for project $project";
38287720µs87920ms my (undef, undef, $success) = capture_exec('git', 'rev-parse',
# spent 920ms making 87 calls to IO::CaptureOutput::capture_exec, avg 10.6ms/call
383 '--verify', "$git_hash^{commit}");
384871.06ms return !$success;
385 }
386 return $fetch;
387}
388
389
# spent 1.53s (4.82ms+1.52) within RBM::git_clone_fetch_chdir which was called 87 times, avg 17.5ms/call: # 86 times (4.77ms+1.49s) by RBM::execute at line 486, avg 17.3ms/call # once (43µs+35.5ms) by RBM::maketar at line 534
sub git_clone_fetch_chdir {
39087167µs my ($project, $options) = @_;
39187592µs26116.5ms my $clonedir = create_dir(rbm_path(project_config($project,
# spent 259ms making 87 calls to RBM::project_config, avg 2.98ms/call, recursion: max depth 31, sum of overlapping time 246ms # spent 3.01ms making 87 calls to RBM::create_dir, avg 35µs/call # spent 538µs making 87 calls to RBM::rbm_path, avg 6µs/call
392 'git_clone_dir', $options)));
39387207µs875.02ms my $git_url = project_config($project, 'git_url', $options)
# spent 11.9ms making 87 calls to RBM::project_config, avg 137µs/call, recursion: max depth 31, sum of overlapping time 6.87ms
394 || exit_error "git_url is undefined";
3958750µs my @clone_submod = ();
3968767µs my @fetch_submod = ();
39787135µs87770µs if (project_config($project, 'git_submodule', $options)) {
# spent 75.8ms making 87 calls to RBM::project_config, avg 871µs/call, recursion: max depth 31, sum of overlapping time 75.0ms
398 @clone_submod = ('--recurse-submodules');
399 @fetch_submod = ('--recurse-submodules=on-demand');
400 }
401871.74ms1741.39ms if (!chdir rbm_path("$clonedir/$project")) {
# spent 722µs making 87 calls to RBM::CORE:chdir, avg 8µs/call # spent 664µs making 87 calls to RBM::rbm_path, avg 8µs/call
402 chdir $clonedir || exit_error "Can't enter directory $clonedir: $!";
403 if (system('git', 'clone', @clone_submod, $git_url, $project) != 0) {
404 exit_error "Error cloning $git_url";
405 }
406 chdir($project) || exit_error "Error entering $project directory";
407 }
408878.89ms871.17s if (git_need_fetch($project, $options)) {
# spent 1.17s making 87 calls to RBM::git_need_fetch, avg 13.5ms/call
409 system('git', 'remote', 'set-url', 'origin', $git_url) == 0
410 || exit_error "Error setting git remote";
411 my (undef, undef, $success) = capture_exec('git', 'rev-parse', '--verify', 'HEAD');
412 if ($success) {
413 system('git', 'checkout', '-q', '--detach') == 0
414 || exit_error "Error running git checkout --detach";
415 }
416 system('git', 'fetch', @fetch_submod, 'origin',
417 '+refs/heads/*:refs/heads/*') == 0
418 || exit_error "Error fetching git repository";
419 system('git', 'fetch', @fetch_submod, 'origin',
420 '+refs/tags/*:refs/tags/*') == 0
421 || exit_error "Error fetching git repository";
422 $config->{projects}{$project}{fetched} = 1;
423 }
424}
425
426sub hg_need_fetch {
427 my ($project, $options) = @_;
428 return 0 if $config->{projects}{$project}{fetched};
429 my $fetch = project_config($project, 'fetch', $options);
430 if ($fetch eq 'if_needed') {
431 my $hg_hash = project_config($project, 'hg_hash', $options)
432 || exit_error "No hg_hash specified for project $project";
433 my (undef, undef, $success) = capture_exec('hg', 'export', $hg_hash);
434 return !$success;
435 }
436 return $fetch;
437}
438
439sub hg_clone_fetch_chdir {
440 my ($project, $options) = @_;
441 my $hg = project_config($project, 'hg', $options);
442 my $clonedir = create_dir(rbm_path(project_config($project,
443 'hg_clone_dir', $options)));
444 my $hg_url = shell_quote(project_config($project, 'hg_url', $options))
445 || exit_error "hg_url is undefined";
446 my $sq_project = shell_quote($project);
447 if (!chdir rbm_path("$clonedir/$project")) {
448 chdir $clonedir || exit_error "Can't enter directory $clonedir: $!";
449 if (system("$hg clone -q $hg_url $sq_project") != 0) {
450 exit_error "Error cloning $hg_url";
451 }
452 chdir($project) || exit_error "Error entering $project directory";
453 }
454 if (hg_need_fetch($project, $options)) {
455 system("$hg pull -q $hg_url") == 0
456 || exit_error "Error pulling changes from $hg_url";
457 }
458}
459
460
# spent 68.7s (5.55ms+68.7) within RBM::run_script which was called 101 times, avg 680ms/call: # 86 times (3.31ms+968ms) by RBM::execute at line 508, avg 11.3ms/call # 8 times (1.17ms+2.64s) by RBM::build_run at line 1095, avg 331ms/call # 2 times (197µs+410ms) by RBM::build_run at line 1044, avg 205ms/call # once (217µs+56.5s) by RBM::build_run at line 1107 # once (140µs+6.78s) by RBM::build_run at line 1029 # once (146µs+939ms) by RBM::build_run at line 1157 # once (96µs+337ms) by RBM::build_run at line 1134 # once (275µs+86.2ms) by RBM::build_run at line 1131
sub run_script {
461101436µs my ($project, $cmd, $f) = @_;
46210161µs $f //= \&capture_exec;
46310150µs my @res;
4641011.10ms101425µs if ($cmd =~ m/^#/) {
# spent 425µs making 101 calls to RBM::CORE:match, avg 4µs/call
46515331µs30184ms my (undef, $tmp) = File::Temp::tempfile(DIR => get_tmp_dir($project));
# spent 169ms making 15 calls to RBM::get_tmp_dir, avg 11.3ms/call # spent 15.3ms making 15 calls to File::Temp::tempfile, avg 1.02ms/call
46615150µs3018.0ms path($tmp)->spew_utf8($cmd);
# spent 17.3ms making 15 calls to Path::Tiny::spew_utf8, avg 1.16ms/call # spent 648µs making 15 calls to Path::Tiny::path, avg 43µs/call
46715160µs1560µs chmod 0700, $tmp;
# spent 60µs making 15 calls to RBM::CORE:chmod, avg 4µs/call
46815344µs1567.5s @res = $f->($tmp);
# spent 56.5s making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1107] # spent 7.47s making 4 calls to IO::CaptureOutput::capture_exec, avg 1.87s/call # spent 2.54s making 8 calls to RBM::__ANON__[rbm/lib/RBM.pm:1095], avg 317ms/call # spent 929ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1157] # spent 73.8ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1131]
469151.59ms151.31ms unlink $tmp;
# spent 1.31ms making 15 calls to RBM::CORE:unlink, avg 88µs/call
470 } else {
47186902µs86967ms @res = $f->($cmd);
# spent 967ms making 86 calls to IO::CaptureOutput::capture_exec, avg 11.2ms/call
472 }
4731011.71ms return @res == 1 ? $res[0] : @res;
474}
475
476
# spent 3.76s (126ms+3.63) within RBM::execute which was called 3973 times, avg 946µs/call: # 2977 times (86.3ms+1.72s) by RBM::__ANON__[rbm/lib/RBM.pm:660] at line 660, avg 605µs/call # 996 times (39.6ms+1.92s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 144 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 1.96ms/call
sub execute {
47739737.78ms my ($project, $cmd, $options) = @_;
478 CORE::state %cache;
47939731.29ms my $res_name;
480397379.4ms397356.5ms my $old_cwd = getcwd;
# spent 56.5ms making 3973 calls to Cwd::getcwd, avg 14µs/call
481397310.7ms39730s if (project_config($project, 'git_url', $options)) {
# spent 73.2ms making 3973 calls to RBM::project_config, avg 18µs/call, recursion: max depth 48, sum of overlapping time 73.2ms
48239738.40ms39730s my $git_hash = project_config($project, 'git_hash', $options)
# spent 38.5ms making 3973 calls to RBM::project_config, avg 10µs/call, recursion: max depth 48, sum of overlapping time 38.5ms
483 || exit_error "No git_hash specified for project $project";
48439735.24ms $res_name = "git-$git_hash-$cmd";
485397354.0ms return $cache{$res_name} if exists $cache{$res_name};
48686411µs861.49s git_clone_fetch_chdir($project, $options);
# spent 1.49s making 86 calls to RBM::git_clone_fetch_chdir, avg 17.3ms/call
48786641µs86996ms my ($stdout, $stderr, $success, $exit_code)
# spent 996ms making 86 calls to IO::CaptureOutput::capture_exec, avg 11.6ms/call
488 = capture_exec('git', 'checkout', $git_hash);
4898650µs exit_error "Cannot checkout $git_hash:\n$stderr" unless $success;
49086878µs860s if (project_config($project, 'git_submodule', $options)) {
# spent 5.81ms making 86 calls to RBM::project_config, avg 68µs/call, recursion: max depth 31, sum of overlapping time 5.81ms
491 foreach my $action (qw(init sync update)) {
492 ($stdout, $stderr, $success, $exit_code)
493 = capture_exec('git', 'submodule', $action);
494 exit_error "Error running git submodule $action\n$stderr"
495 unless $success;
496 }
497 }
498 } elsif (project_config($project, 'hg_url', $options)) {
499 my $hg_hash = project_config($project, 'hg_hash', $options)
500 || exit_error "No hg_hash specified for project $project";
501 $res_name = "hg-$hg_hash-$cmd";
502 return $cache{$res_name} if exists $cache{$res_name};
503 hg_clone_fetch_chdir($project, $options);
504 my ($stdout, $stderr, $success, $exit_code)
505 = capture_exec('hg', 'update', '-C', $hg_hash);
506 exit_error "Cannot checkout $hg_hash:\n$stderr" unless $success;
507 }
50886758µs86971ms my ($stdout, $stderr, $success, $exit_code)
# spent 971ms making 86 calls to RBM::run_script, avg 11.3ms/call
509 = run_script($project, $cmd, \&capture_exec);
510861.43ms86991µs chdir($old_cwd);
# spent 991µs making 86 calls to RBM::CORE:chdir, avg 12µs/call
51186170µs chomp $stdout;
512861.11ms $cache{$res_name} = $success ? $stdout : undef;
51386997µs return $cache{$res_name};
514}
515
516
# spent 26.2ms within RBM::gpg_id which was called 5969 times, avg 4µs/call: # 5967 times (26.2ms+0s) by RBM::input_files at line 881, avg 4µs/call # once (3µs+0s) by RBM::maketar at line 544 # once (1µs+0s) by RBM::maketar at line 552
sub gpg_id {
51759695.89ms my ($id) = @_;
518596935.7ms return $id unless $id;
519 if (ref $id eq 'ARRAY' && @$id == 1 && !$id->[0]) {
520 return 0;
521 }
522 return $id;
523}
524
525
# spent 295ms (297µs+295) within RBM::maketar which was called: # once (297µs+295ms) by RBM::build_run at line 1015
sub maketar {
52612µs my ($project, $options, $dest_dir) = @_;
5271800ns $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir')));
52813µs15µs valid_project($project);
# spent 5µs making 1 call to RBM::valid_project
52918µs15µs my $old_cwd = getcwd;
# spent 5µs making 1 call to Cwd::getcwd
5301400ns my $commit_hash;
53114µs15.64ms if (project_config($project, 'git_url', $options)) {
# spent 5.64ms making 1 call to RBM::project_config
53214µs15.57ms $commit_hash = project_config($project, 'git_hash', $options)
# spent 5.57ms making 1 call to RBM::project_config
533 || exit_error "No git_hash specified for project $project";
53415µs135.5ms git_clone_fetch_chdir($project);
# spent 35.5ms making 1 call to RBM::git_clone_fetch_chdir
535 } elsif (project_config($project, 'hg_url', $options)) {
536 $commit_hash = project_config($project, 'hg_hash', $options)
537 || exit_error "No hg_hash specified for project $project";
538 hg_clone_fetch_chdir($project);
539 } else {
540 return undef;
541 }
542
54319µs153.8ms my $version = project_config($project, 'version', $options);
# spent 53.8ms making 1 call to RBM::project_config
54417µs21000µs if (my $tag_gpg_id = gpg_id(project_config($project, 'tag_gpg_id', $options))) {
# spent 997µs making 1 call to RBM::project_config # spent 3µs making 1 call to RBM::gpg_id
545 my $id = git_tag_sign_id($project, $commit_hash) ||
546 exit_error "$commit_hash is not a signed tag";
547 if (!valid_id($id, $tag_gpg_id)) {
548 exit_error "Tag $commit_hash is not signed with a valid key";
549 }
550 print "Tag $commit_hash is signed with key $id\n";
551 }
55213µs2770µs if (my $commit_gpg_id = gpg_id(project_config($project, 'commit_gpg_id',
# spent 769µs making 1 call to RBM::project_config # spent 1µs making 1 call to RBM::gpg_id
553 $options))) {
554 my $id = git_commit_sign_id($project, $commit_hash) ||
555 exit_error "$commit_hash is not a signed commit";
556 if (!valid_id($id, $commit_gpg_id)) {
557 exit_error "Commit $commit_hash is not signed with a valid key";
558 }
559 print "Commit $commit_hash is signed with key $id\n";
560 }
56111µs my $tar_file = "$project-$version.tar";
56214µs113.6ms if (project_config($project, 'git_url', $options)) {
# spent 13.6ms making 1 call to RBM::project_config
563116.5ms116.4ms system('git', 'archive', "--prefix=$project-$version/",
# spent 16.4ms making 1 call to RBM::CORE:system
564 "--output=$dest_dir/$tar_file", $commit_hash) == 0
565 || exit_error 'Error running git archive.';
566118µs11.07ms if (project_config($project, 'git_submodule', $options)) {
# spent 1.07ms making 1 call to RBM::project_config
567 my $tmpdir = File::Temp->newdir(
568 get_tmp_dir($project, $options) . '/rbm-XXXXX');
569 my ($stdout, $stderr, $success, $exit_code)
570 = capture_exec('git', 'checkout', $commit_hash);
571 exit_error "Cannot checkout $commit_hash: $stderr" unless $success;
572 foreach my $action (qw(init sync update)) {
573 ($stdout, $stderr, $success, $exit_code)
574 = capture_exec('git', 'submodule', $action);
575 exit_error "Error running git submodule $action\n$stderr"
576 unless $success;
577 }
578 ($stdout, $stderr, $success, $exit_code)
579 = capture_exec('git', 'submodule', 'foreach',
580 "git archive --prefix=$project-$version/\$path/"
581 . " --output=$tmpdir/submodule.tar \$sha1;"
582 . "tar -Af \"$dest_dir/$tar_file\" $tmpdir/submodule.tar");
583 exit_error 'Error running git archive on submodules.' unless $success;
584 }
585 } else {
586 system('hg', 'archive', '-r', $commit_hash, '-t', 'tar',
587 '--prefix', "$project-$version", "$dest_dir/$tar_file") == 0
588 || exit_error 'Error running hg archive.';
589 }
590116µs my %compress = (
591 xz => ['xz', '-f'],
592 gz => ['gzip', '--no-name', '-f'],
593 bz2 => ['bzip2', '-f'],
594 );
59515µs16.11ms if (my $c = project_config($project, 'compress_tar', $options)) {
# spent 6.11ms making 1 call to RBM::project_config
59611µs if (!defined $compress{$c}) {
597 exit_error "Unknow compression $c";
598 }
599165.9ms165.8ms system(@{$compress{$c}}, "$dest_dir/$tar_file") == 0
# spent 65.8ms making 1 call to RBM::CORE:system
600 || exit_error "Error compressing $tar_file with $compress{$c}->[0]";
601113µs $tar_file .= ".$c";
602 }
603117µs189.5ms my $timestamp = project_config($project, 'timestamp', $options);
# spent 89.5ms making 1 call to RBM::project_config
604163µs152µs utime $timestamp, $timestamp, "$dest_dir/$tar_file" if $timestamp;
# spent 52µs making 1 call to RBM::CORE:utime
605170µs162µs print "Created $dest_dir/$tar_file\n";
# spent 62µs making 1 call to RBM::CORE:print
60618µs14µs chdir($old_cwd);
# spent 4µs making 1 call to RBM::CORE:chdir
607119µs return $tar_file;
608}
609
610
# spent 242ms (28.6+214) within RBM::sha256file which was called 1992 times, avg 122µs/call: # 1992 times (28.6ms+214ms) by RBM::input_file_need_dl at line 730, avg 122µs/call
sub sha256file {
611 CORE::state %res;
61219925.19ms199215.2ms my $f = rbm_path(shift);
# spent 15.2ms making 1992 calls to RBM::rbm_path, avg 8µs/call
6131992997µs my $opt = shift;
61419921.84ms if (ref $opt eq 'HASH' && $opt->{remove_cache}) {
615 delete $res{$f};
616 return;
617 }
618199219.8ms return $res{$f} if exists $res{$f};
6192184ms8183ms return $res{$f} = -f $f ? sha256_hex(path($f)->slurp_raw) : '';
# spent 183ms making 2 calls to Digest::SHA::sha256_hex, avg 91.6ms/call # spent 126µs making 2 calls to Path::Tiny::path, avg 63µs/call # spent 52µs making 2 calls to RBM::CORE:ftfile, avg 26µs/call # spent 16µs making 2 calls to Path::Tiny::slurp_raw, avg 8µs/call
620}
621
622sub process_template_opt {
623 my ($project, $tmpl, $opt, $dest_dir) = @_;
624 my $save_opt = $config->{opt};
625 $config->{opt} = {%{$config->{opt}}, %$opt} if $opt;
626 my $res = process_template($project, $tmpl, $dest_dir);
627 $config->{opt} = $save_opt;
628 return $res;
629}
630
631
# spent 1623s (41.5+1581) within RBM::process_template which was called 375387 times, avg 4.32ms/call: # 355477 times (39.9s+1583s) by RBM::project_config at line 226, avg 4.57ms/call # 19910 times (1.55s+-1.55s) by RBM::__ANON__[rbm/lib/RBM.pm:662] at line 662, avg 0s/call
sub process_template {
632375387376ms my ($project, $tmpl, $dest_dir) = @_;
633375387137ms return undef unless defined $tmpl;
634375387273ms exit_error "Can't process template on a hash" if ref $tmpl eq 'HASH';
635375387163ms if (ref $tmpl eq 'ARRAY') {
636 my $res = [];
637 foreach my $t (@$tmpl) {
638 push @$res, process_template($project, $t, $dest_dir);
639 }
640 return $res;
641 }
6423753871.01s4384862.24s $dest_dir //= rbm_path(project_config($project, 'output_dir'));
# spent 2.24s making 219243 calls to RBM::rbm_path, avg 10µs/call # spent 534s making 219243 calls to RBM::project_config, avg 2.43ms/call, recursion: max depth 53, sum of overlapping time 534s
6433753871.16s7507742.69s my $projects_dir = rbm_path(project_config($project, 'projects_dir'));
# spent 2.69s making 375387 calls to RBM::rbm_path, avg 7µs/call # spent 155s making 375387 calls to RBM::project_config, avg 413µs/call, recursion: max depth 54, sum of overlapping time 155s
6443753872.08s375387147s my $template = Template->new(
# spent 147s making 375387 calls to Template::Base::new, avg 391µs/call
645 ENCODING => 'utf8',
646 INCLUDE_PATH => "$projects_dir/$project:$projects_dir/common",
647 );
648 my $vars = {
649 config => $config,
650 project => $project,
651 p => $config->{projects}{$project},
6521808651.35s1808650s
# spent 30338s (1.32+30336) within RBM::__ANON__[rbm/lib/RBM.pm:652] which was called 180865 times, avg 168ms/call: # 77850 times (622ms+19098s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 245ms/call # 31867 times (184ms+532s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 16.7ms/call # 18883 times (180ms+193s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 10.3ms/call # 8971 times (59.3ms+39.6s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 4.42ms/call # 6990 times (34.6ms+8380s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 1.20s/call # 5997 times (46.6ms+68.8s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/input text, avg 11.5ms/call # 3001 times (30.2ms+537s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 179ms/call # 2987 times (28.6ms+41.7s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 14.0ms/call # 2009 times (8.56ms+5.25s) by Template::Stash::XS::get at line 4 of /root/tor-browser-build/input text, avg 2.62ms/call # 2005 times (16.2ms+4.87s) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/input text, avg 2.44ms/call # 1992 times (16.8ms+103s) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/go/build, avg 51.5ms/call # 1991 times (6.66ms+30.7ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 19µs/call # 1986 times (8.40ms+107s) by Template::Stash::XS::get at line 26 of /root/tor-browser-build/input text, avg 53.9ms/call # 1025 times (9.88ms+1.84s) by Template::Stash::XS::get at line 12 of /root/tor-browser-build/input text, avg 1.80ms/call # 1016 times (4.89ms+2.59s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/input text, avg 2.56ms/call # 1008 times (3.66ms+1.05s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/input text, avg 1.04ms/call # 999 times (3.68ms+1.09s) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 1.10ms/call # 997 times (2.75ms+948ms) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 953µs/call # 996 times (4.34ms+56.6s) by Template::Stash::XS::get at line 38 of /root/tor-browser-build/projects/go/build, avg 56.9ms/call # 996 times (4.90ms+56.5s) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/projects/go/build, avg 56.7ms/call # 996 times (13.8ms+7.64s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/go/build, avg 7.68ms/call # 996 times (4.74ms+2.66s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/projects/go/build, avg 2.67ms/call # 996 times (11.0ms+17.2ms) by Template::Stash::XS::get at line 74 of /root/tor-browser-build/projects/go/build, avg 28µs/call # 996 times (3.18ms+16.6ms) by Template::Stash::XS::get at line 34 of /root/tor-browser-build/projects/go/build, avg 20µs/call # 995 times (4.57ms+2.52s) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/input text, avg 2.54ms/call # 993 times (2.95ms+1.06s) by Template::Stash::XS::get at line 17 of /root/tor-browser-build/input text, avg 1.07ms/call # 720 times (1.68ms+8.25ms) by Template::Stash::XS::get at line 23 of /root/tor-browser-build/input text, avg 14µs/call # 303 times (686µs+3.34ms) by Template::Stash::XS::get at line 25 of /root/tor-browser-build/input text, avg 13µs/call # 60 times (232µs+963ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 16.1ms/call # 30 times (98µs+55.2ms) by Template::Stash::XS::get at line 239 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.84ms/call # 30 times (65µs+319µs) by Template::Stash::XS::get at line 21 of /root/tor-browser-build/input text, avg 13µs/call # 15 times (230µs+949ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/common/runc-config.json, avg 63.3ms/call # 15 times (36µs+20.9ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.40ms/call # 15 times (61µs+308µs) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/common/runc-config.json, avg 25µs/call # 15 times (35µs+173µs) by Template::Stash::XS::get at line 251 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call # 15 times (36µs+169µs) by Template::Stash::XS::get at line 49 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call # 15 times (32µs+172µs) by Template::Stash::XS::get at line 121 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call # 15 times (29µs+113µs) by Template::Stash::XS::get at line 65 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call # 15 times (27µs+107µs) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call # 15 times (28µs+105µs) by Template::Stash::XS::get at line 97 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call # 15 times (25µs+99µs) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/input text, avg 8µs/call # 4 times (16µs+555s) by Template::Stash::XS::get at line 28 of /root/tor-browser-build/projects/snowflake/build, avg 139s/call # 4 times (12µs+8.77ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/projects/snowflake/build, avg 2.19ms/call # 4 times (10µs+57µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 17µs/call # 4 times (7µs+30µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 9µs/call # 2 times (12µs+479s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/projects/snowflake/build, avg 240s/call # 2 times (14µs+50.8s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/projects/snowflake/build, avg 25.4s/call # 2 times (10µs+1.63s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/snowflake/build, avg 814ms/call # 2 times (11µs+1.60s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/projects/snowflake/build, avg 798ms/call # 2 times (14µs+956ms) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 478ms/call # 2 times (7µs+35.0ms) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/projects/snowflake/build, avg 17.5ms/call # 2 times (18µs+16.7ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/snowflake/build, avg 8.36ms/call # 2 times (10µs+11.9ms) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/projects/snowflake/build, avg 5.95ms/call # 2 times (6µs+20µs) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/projects/snowflake/build, avg 13µs/call
c => sub { project_config($project, @_) },
# spent 30336s making 180865 calls to RBM::project_config, avg 168ms/call, recursion: max depth 52, sum of overlapping time 30336s
653
# spent 112s (215ms+112) within RBM::__ANON__[rbm/lib/RBM.pm:657] which was called 19909 times, avg 5.65ms/call: # 7964 times (51.4ms+21.3s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 2.68ms/call # 3982 times (58.9ms+31.0s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 7.79ms/call # 1991 times (25.3ms+15.3s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 7.70ms/call # 1991 times (26.1ms+15.1s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 7.60ms/call # 1991 times (20.4ms+2.47s) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 1.25ms/call # 995 times (17.1ms+1.15s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 1.18ms/call # 993 times (15.2ms+25.9s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 26.1ms/call # 2 times (39µs+62.7ms) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 31.4ms/call
pc => sub {
6541990916.0ms my @args = @_;
6551990929.3ms $args[2] = { $_[2] ? %{$_[2]} : (), origin_project => $project };
65619909211ms1990962.7ms project_step_config(@args);
# spent 112s making 19909 calls to RBM::project_step_config, avg 5.64ms/call, recursion: max depth 12, sum of overlapping time 112s
657 },
658 dest_dir => $dest_dir,
659 exit_error => \&exit_error,
660297720.4ms29771.80s
# spent 1.84s (36.5ms+1.80) within RBM::__ANON__[rbm/lib/RBM.pm:660] which was called 2977 times, avg 618µs/call: # 2977 times (36.5ms+1.80s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 618µs/call
exec => sub { execute($project, @_) },
# spent 1.80s making 2977 calls to RBM::execute, avg 605µs/call
661 path => \&rbm_path,
66219910233ms199100s
# spent 25.6s (128ms+25.4) within RBM::__ANON__[rbm/lib/RBM.pm:662] which was called 19910 times, avg 1.28ms/call: # 19910 times (128ms+25.4s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 1.28ms/call
tmpl => sub { process_template($project, $_[0], $dest_dir) },
# spent 25.4s making 19910 calls to RBM::process_template, avg 1.28ms/call, recursion: max depth 39, sum of overlapping time 25.4s
663 shell_quote => \&shell_quote,
664 versioncmp => \&versioncmp,
665
# spent 382ms (49.5+332) within RBM::__ANON__[rbm/lib/RBM.pm:667] which was called 4038 times, avg 95µs/call: # 4007 times (49.1ms+331ms) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 95µs/call # 15 times (292µs+937µs) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 82µs/call # 4 times (51µs+371µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 105µs/call # 4 times (20µs+103µs) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 31µs/call # 4 times (12µs+57µs) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 17µs/call # 4 times (12µs+49µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 15µs/call
sha256 => sub {
6664038155ms8076332ms return sha256_hex(encode("utf8", $_[0]));
# spent 252ms making 4038 calls to Encode::encode, avg 62µs/call # spent 80.3ms making 4038 calls to Digest::SHA::sha256_hex, avg 20µs/call
667 },
6683753879.78s sha256file => \&sha256file,
669 fileparse => \&fileparse,
670 ENV => \%ENV,
671 };
67237538780.9ms my $output;
6733753871.36s3753871623s $template->process(\$tmpl, $vars, \$output, binmode => ':utf8')
# spent 31024s making 375387 calls to Template::process, avg 82.6ms/call, recursion: max depth 40, sum of overlapping time 29402s
674 || exit_error "Template Error:\n" . $template->error;
67537538719.0s7517874.99s return $output;
# spent 3.25s making 375387 calls to Template::Context::DESTROY, avg 9µs/call # spent 1.73s making 375387 calls to Template::Provider::DESTROY, avg 5µs/call # spent 3.95ms making 1013 calls to Template::Document::AUTOLOAD, avg 4µs/call
676}
677
678sub rpmspec {
679 my ($project, $dest_dir) = @_;
680 $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir')));
681 valid_project($project);
682 my $timestamp = project_config($project, 'timestamp');
683 my $rpmspec = project_config($project, 'rpmspec')
684 || exit_error "Undefined config for rpmspec";
685 path("$dest_dir/$project.spec")->spew_utf8($rpmspec);
686 utime $timestamp, $timestamp, "$dest_dir/$project.spec" if $timestamp;
687}
688
689sub projectslist {
690 keys %{$config->{projects}};
691}
692
693
# spent 867µs (11+856) within RBM::copy_files which was called: # once (11µs+856µs) by RBM::build_run at line 1017
sub copy_files {
69411µs my ($project, $dest_dir) = @_;
6951300ns my @r;
69612µs1856µs my $copy_files = project_config($project, 'copy_files');
# spent 856µs making 1 call to RBM::project_config
697112µs return unless $copy_files;
698 my $proj_dir = rbm_path(project_config($project, 'projects_dir'));
699 my $src_dir = "$proj_dir/$project";
700 foreach my $file (@$copy_files) {
701 copy("$src_dir/$file", "$dest_dir/$file");
702 push @r, $file;
703 }
704 return @r;
705}
706
707sub urlget {
708 my ($project, $input_file, $exit_on_error) = @_;
709 my $cmd = project_config($project, 'urlget', $input_file);
710 my $success = run_script($project, $cmd, sub { system(@_) }) == 0;
711 if (!$success) {
712 unlink project_config($project, 'filename', $input_file);
713 exit_error "Error downloading file" if $exit_on_error;
714 }
715 return $success;
716}
717
718sub is_url {
719 $_[0] =~ m/^https?:\/\/.*/;
720}
721
722
# spent 344ms (124+220) within RBM::file_in_dir which was called 5967 times, avg 58µs/call: # 5967 times (124ms+220ms) by RBM::input_files at line 880, avg 58µs/call
sub file_in_dir {
723596714.1ms my ($filename, @dir) = @_;
7245967343ms11934220ms return map { -e "$_/$filename" ? "$_/$filename" : () } @dir;
# spent 220ms making 11934 calls to RBM::CORE:ftis, avg 18µs/call
725}
726
727
# spent 15.2s (93.3ms+15.1) within RBM::input_file_need_dl which was called 5967 times, avg 2.54ms/call: # 5967 times (93.3ms+15.1s) by RBM::input_files at line 882, avg 2.54ms/call
sub input_file_need_dl {
72859677.69ms my ($input_file, $t, $fname, $action) = @_;
72959675.43ms return undef if $action eq 'getfpaths';
730596721.7ms398415.1s if ($fname
# spent 14.8s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.45ms/call # spent 242ms making 1992 calls to RBM::sha256file, avg 122µs/call
731 && $input_file->{sha256sum}
732 && $t->('sha256sum') ne sha256file($fname)) {
733 sha256file($fname, { remove_cache => 1 });
734 $fname = undef;
735 }
73659676.13ms if ($action eq 'input_files_id') {
73759615.67ms return undef if $input_file->{input_file_id};
738596132.5ms return undef if $input_file->{sha256sum};
73939693.86ms return undef if $input_file->{exec};
740396922.5ms return undef if $fname;
741 return 1 if $input_file->{URL};
742 return 1 if $input_file->{content};
743 return undef;
744 }
745650µs64.77ms return $t->('refresh_input') if $fname;
# spent 4.77ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 795µs/call
746 return 1;
747}
748
749sub input_file_id_hash {
750 my ($fname, $filename) = @_;
751 return $filename . ':' . sha256file($fname) if -f $fname;
752 return $filename . ':' . sha256file(readlink $fname) if -l $fname;
753 my @subdirs = sort(map { $_->basename } path($fname)->children);
754 my @hashes = map { input_file_id_hash("$fname/$_", "$filename/$_") } @subdirs;
755 return join("\n", @hashes);
756}
757
758
# spent 15.3s (77.1ms+15.2) within RBM::input_file_id which was called 5961 times, avg 2.57ms/call: # 5961 times (77.1ms+15.2s) by RBM::input_files at line 912, avg 2.57ms/call
sub input_file_id {
75959619.03ms my ($input_file, $t, $fname, $filename) = @_;
76059614.90ms return $t->('input_file_id') if $input_file->{input_file_id};
761596145.3ms return $input_file->{project} . ':' . $filename if $input_file->{project};
762199221.7ms199215.2s return $filename . ':' . $t->('sha256sum') if $input_file->{sha256sum};
# spent 15.2s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.64ms/call
763 return $filename . ':' . sha256_hex($t->('exec', { norec => { output_dir => '/out' } }))
764 if $input_file->{exec};
765 return input_file_id_hash($fname, $filename);
766}
767
768
# spent 639ms (109µs+639) within RBM::recursive_copy which was called 6 times, avg 106ms/call: # 6 times (109µs+639ms) by RBM::input_files at line 974, avg 106ms/call
sub recursive_copy {
76969µs my ($fname, $name, $dest_dir) = @_;
770657µs626µs if (-f $fname || -l $fname) {
# spent 26µs making 6 calls to RBM::CORE:ftfile, avg 4µs/call
7716252µs6638ms fcopy($fname, "$dest_dir/$name");
# spent 638ms making 6 calls to File::Copy::Recursive::fcopy, avg 106ms/call
772639µs return ($name);
773 }
774 my @copied;
775 mkdir "$dest_dir/$name";
776 foreach my $f (map { $_->basename } path($fname)->children) {
777 push @copied, recursive_copy("$fname/$f", "$name/$f", $dest_dir);
778 }
779 return @copied;
780}
781
782
# spent 1617s (2.08+1615) within RBM::input_files which was called 5967 times, avg 271ms/call: # 3976 times (931ms+1.53s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605] at line 605 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 619µs/call # 1990 times (1.15s+1083s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606] at line 606 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 545ms/call # once (1.26ms+531s) by RBM::build_run at line 1018
sub input_files {
783596716.1ms my ($action, $project, $options, $dest_dir) = @_;
78459676.25ms my @res_copy;
785 my %res_getfnames;
786 my @res_getfpaths;
78759675.63ms my $getfnames_noname = 0;
788596713.7ms my $input_files_id = '';
789596714.8ms $options = {$options ? %$options : ()};
790596710.4ms $options->{norec} = {};
791596712.8ms5967619µs my $input_files = project_config($project, 'input_files', $options);
# spent 5.10s making 5967 calls to RBM::project_config, avg 854µs/call, recursion: max depth 50, sum of overlapping time 5.10s
79259672.68ms goto RETURN_RES unless $input_files;
793596730.6ms1193471.3ms my $proj_dir = rbm_path(project_config($project, 'projects_dir', $options));
# spent 69.8ms making 5967 calls to RBM::rbm_path, avg 12µs/call # spent 13.0s making 5967 calls to RBM::project_config, avg 2.18ms/call, recursion: max depth 50, sum of overlapping time 13.0s
79459678.45ms my $src_dir = "$proj_dir/$project";
7955967147ms596797.9ms my $old_cwd = getcwd;
# spent 97.9ms making 5967 calls to Cwd::getcwd, avg 16µs/call
7965967147ms5967113ms chdir $src_dir || exit_error "cannot chdir to $src_dir";
# spent 113ms making 5967 calls to RBM::CORE:chdir, avg 19µs/call
797596737.4ms foreach my $input_file_alias (@$input_files) {
7982969717.5ms my $input_file = $input_file_alias;
7992969720.2ms if (!ref $input_file) {
800 $input_file = project_config($project,
801 process_template_opt($project, $input_file, $options), $options);
802 }
8032969713.5ms next unless $input_file;
804
# spent 342s (686ms+341) within RBM::__ANON__[rbm/lib/RBM.pm:807] which was called 51584 times, avg 6.62ms/call: # 10730 times (130ms+73.5s) by RBM::input_files at line 835, avg 6.87ms/call # 9024 times (97.2ms+83.4s) by RBM::input_files at line 808, avg 9.25ms/call # 7950 times (118ms+60.5s) by RBM::input_files at line 862, avg 7.63ms/call # 7950 times (94.4ms+59.7s) by RBM::input_files at line 878, avg 7.52ms/call # 5967 times (102ms+26.5s) by RBM::input_files at line 871, avg 4.46ms/call # 5967 times (103ms+7.32s) by RBM::input_files at line 881, avg 1.24ms/call # 1992 times (23.6ms+15.2s) by RBM::input_file_id at line 762, avg 7.64ms/call # 1992 times (18.2ms+14.8s) by RBM::input_file_need_dl at line 730, avg 7.45ms/call # 6 times (39µs+4.73ms) by RBM::input_file_need_dl at line 745, avg 795µs/call # 6 times (39µs+4.66ms) by RBM::input_files at line 936, avg 783µs/call
my $t = sub {
805 project_config($project, $_[0], {$options ? %$options : (),
80651584744ms51584215ms %$input_file, $_[1] ? %{$_[1]} : ()});
# spent 341s making 51584 calls to RBM::project_config, avg 6.61ms/call, recursion: max depth 50, sum of overlapping time 341s
80729697115ms };
8082969768.2ms902483.5s if ($input_file->{enable} && !$t->('enable')) {
# spent 83.5s making 9024 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 9.25ms/call
809902474.3ms next;
810 }
8112067347.6ms if ($input_file->{target} || $input_file->{target_append}
812 || $input_file->{target_prepend}) {
813 $input_file = { %$input_file };
814 if (ref $input_file->{target} eq 'ARRAY') {
815 $input_file->{target} = process_template_opt($project,
816 $input_file->{target}, $options);
817 } else {
818 $input_file->{target} = $config->{run}{target};
819 }
820 if (ref $input_file->{target_prepend} eq 'ARRAY') {
821 $input_file->{target} = [ @{ process_template_opt($project,
822 $input_file->{target_prepend},
823 $options) },
824 @{$input_file->{target}} ];
825 }
826 if (ref $input_file->{target_append} eq 'ARRAY') {
827 $input_file->{target} = [ @{$input_file->{target}},
828 @{ process_template_opt($project,
829 $input_file->{target_append},
830 $options) } ];
831 }
832 }
8332067318.3ms if ($action eq 'getfnames') {
834147064.24ms my $getfnames_name;
8351470663.7ms1073073.7s if ($input_file->{name}) {
# spent 73.7s making 10730 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 6.87ms/call
836 $getfnames_name = $t->('name');
837 } else {
838397612.6ms $getfnames_name = "noname_$getfnames_noname";
8393976967µs $getfnames_noname++;
840 }
841
# spent 597s (180ms+597) within RBM::__ANON__[rbm/lib/RBM.pm:858] which was called 3976 times, avg 150ms/call: # 3976 times (180ms+597s) by RBM::config_p at line 94, avg 150ms/call
$res_getfnames{$getfnames_name} = sub {
84239765.57ms my ($project, $options) = @_;
84339762.84ms $options //= {};
84439766.83ms if ($input_file->{project}) {
84519844.76ms $options = {%$options};
84619841.92ms $options->{origin_project} = $project;
847 }
848
# spent 49.4s (85.5ms+49.3) within RBM::__ANON__[rbm/lib/RBM.pm:850] which was called 7944 times, avg 6.22ms/call: # 3976 times (36.4ms+22.2s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 852, avg 5.60ms/call # 3968 times (49.1ms+27.1s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 856, avg 6.84ms/call
my $t = sub {
849794491.3ms79440s RBM::project_config($project, $_[0], { %$options, %$input_file })
# spent 49.3s making 7944 calls to RBM::project_config, avg 6.21ms/call, recursion: max depth 50, sum of overlapping time 49.3s
850397614.3ms };
85139763.68ms return $t->('filename') if $input_file->{filename};
852397613.7ms397622.3s my $url = $t->('URL');
# spent 22.3s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:850], avg 5.60ms/call
853397659.4ms1992175ms return basename($url) if $url;
# spent 175ms making 1992 calls to File::Basename::basename, avg 88µs/call
854 return RBM::project_step_config($t->('project'), 'filename',
855 {%$options, step => $t->('pkg_type'), %$input_file})
856198468.5ms5952561s if $input_file->{project};
# spent 547s making 1984 calls to RBM::project_step_config, avg 276ms/call, recursion: max depth 10, sum of overlapping time 13.7s # spent 27.1s making 3968 calls to RBM::__ANON__[rbm/lib/RBM.pm:850], avg 6.84ms/call
857 return undef;
85814706159ms };
8591470679.7ms next;
860 }
86159672.67ms my $proj_out_dir;
8625967122ms1590060.7s if ($input_file->{project}) {
# spent 60.6s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.63ms/call # spent 21.9s making 3975 calls to RBM::project_step_config, avg 5.51ms/call, recursion: max depth 11, sum of overlapping time 21.9s # spent 34.4ms making 3975 calls to RBM::rbm_path, avg 9µs/call
863 $proj_out_dir = rbm_path(project_step_config($t->('project'), 'output_dir',
864 { %$options, step => $t->('pkg_type'),
865 origin_project => $project, %$input_file }));
866 } else {
867199219.8ms398417.1ms $proj_out_dir = rbm_path(project_config($project, 'output_dir',
# spent 17.1ms making 1992 calls to RBM::rbm_path, avg 9µs/call # spent 11.0s making 1992 calls to RBM::project_config, avg 5.52ms/call, recursion: max depth 49, sum of overlapping time 11.0s
868 { %$options, %$input_file }));
869 }
870596719.4ms5967229ms create_dir($proj_out_dir);
# spent 229ms making 5967 calls to RBM::create_dir, avg 38µs/call
871596728.5ms596726.6s my $url = $t->('URL');
# spent 26.6s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 4.46ms/call
872596731.8ms1992204ms my $name = $input_file->{filename} ? $t->('filename') :
# spent 204ms making 1992 calls to File::Basename::basename, avg 103µs/call
873 $url ? basename($url) :
874 undef;
875 $name //= project_step_config($t->('project'), 'filename',
876 {%$options, step => $t->('pkg_type'),
877 origin_project => $project, %$input_file})
8785967126ms119251144s if $input_file->{project};
# spent 8646s making 3975 calls to RBM::project_step_config, avg 2.18s/call, recursion: max depth 11, sum of overlapping time 7562s # spent 59.8s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.52ms/call
87959673.93ms exit_error("Missing filename:\n" . pp($input_file)) unless $name;
880596729.9ms5967344ms my ($fname) = file_in_dir($name, $src_dir, $proj_out_dir);
# spent 344ms making 5967 calls to RBM::file_in_dir, avg 58µs/call
881596746.7ms119347.45s my $file_gpg_id = gpg_id($t->('file_gpg_id'));
# spent 7.42s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 1.24ms/call # spent 26.2ms making 5967 calls to RBM::gpg_id, avg 4µs/call
882596719.7ms596715.2s if (input_file_need_dl($input_file, $t, $fname, $action)) {
# spent 15.2s making 5967 calls to RBM::input_file_need_dl, avg 2.54ms/call
883 if ($t->('content')) {
884 path("$proj_out_dir/$name")->spew_utf8($t->('content'));
885 } elsif ($t->('URL')) {
886 urlget($project, {%$options, %$input_file, filename => $name}, 1);
887 } elsif ($t->('exec')) {
888 my $exec_script = project_config($project, 'exec',
889 { $options ? %$options : (), %$input_file });
890 if (run_script($project, $exec_script,
891 sub { system(@_) }) != 0) {
892 exit_error "Error creating $name";
893 }
894 } elsif ($input_file->{project} && $t->('project')) {
895 my $p = $t->('project');
896 print "Building project $p - $name\n";
897 my $run_save = $config->{run};
898 $config->{run} = { target => $input_file->{target} };
899 $config->{run}{target} //= $run_save->{target};
900 build_pkg($p, {%$options, origin_project => $project,
901 %$input_file});
902 $config->{run} = $run_save;
903 print "Finished build of project $p - $name\n";
904 } else {
905 dd $input_file;
906 exit_error "Missing file $name";
907 }
908 ($fname) = file_in_dir($name, $src_dir, $proj_out_dir);
909 exit_error "Error getting file $name" unless $fname;
910 }
91159676.23ms if ($action eq 'input_files_id') {
912596130.6ms596115.3s $input_files_id .= input_file_id($input_file, $t, $fname, $name);
# spent 15.3s making 5961 calls to RBM::input_file_id, avg 2.57ms/call
91359613.55ms $input_files_id .= "\n";
914596151.2ms next;
915 }
91664µs if ($action eq 'getfpaths') {
917 push @res_getfpaths, $fname if $fname;
918 if ($file_gpg_id && $fname) {
919 my $sig_ext = $t->('sig_ext');
920 $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ];
921 foreach my $s (@$sig_ext) {
922 if (-f "$fname.$s") {
923 push @res_getfpaths, "$fname.$s";
924 last;
925 }
926 }
927 }
928 if ($input_file->{project} && $t->('project')) {
929 my $r = RBM::project_step_config($t->('project'), 'input_files_paths',
930 {%$options, step => $t->('pkg_type'), %$input_file});
931 push @res_getfpaths, @$r if @$r;
932 }
933 next;
934 }
93563µs exit_error "Missing file $name" unless $fname;
936617µs64.70ms if ($t->('sha256sum')
# spent 4.70ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 783µs/call
937 && $t->('sha256sum') ne sha256file($fname)) {
938 exit_error "Can't have sha256sum on directory: $fname" if -d $fname;
939 exit_error "Wrong sha256sum for $fname.\n" .
940 "Expected sha256sum: " . $t->('sha256sum');
941 }
94263µs if ($file_gpg_id) {
943 exit_error "Can't have gpg sig on directory: $fname" if -d $fname;
944 my $sig_ext = $t->('sig_ext');
945 $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ];
946 my $sig_file;
947 foreach my $s (@$sig_ext) {
948 if (-f "$fname.$s" && !$t->('refresh_input')) {
949 $sig_file = "$fname.$s";
950 last;
951 }
952 }
953 foreach my $s ($sig_file ? () : @$sig_ext) {
954 if ($url) {
955 my $f = { %$options, %$input_file,
956 'override.URL' => "$url.$s", filename => "$name.$s" };
957 if (urlget($project, $f, 0)) {
958 $sig_file = "$fname.$s";
959 last;
960 }
961 }
962 }
963 exit_error "No signature file for $name" unless $sig_file;
964 my $id = file_sign_id($project, { %$input_file,
965 filename_data => $fname, filename_sig => $sig_file });
966 print "File $name is signed with id $id\n" if $id;
967 if (!$id || !valid_id($id, $file_gpg_id)) {
968 exit_error "File $name is not signed with a valid key";
969 }
970 }
9716120µs681µs my $file_type = -d $fname ? 'directory' : 'file';
# spent 81µs making 6 calls to RBM::CORE:ftdir, avg 13µs/call
97264.72ms64.66ms print "Using $file_type $fname\n";
# spent 4.66ms making 6 calls to RBM::CORE:print, avg 777µs/call
9736140µs12629µs mkdir dirname("$dest_dir/$name");
# spent 578µs making 6 calls to File::Basename::dirname, avg 96µs/call # spent 51µs making 6 calls to RBM::CORE:mkdir, avg 8µs/call
9746147µs6639ms push @res_copy, recursive_copy($fname, $name, $dest_dir);
# spent 639ms making 6 calls to RBM::recursive_copy, avg 106ms/call
975 }
9765967181ms5967131ms chdir $old_cwd;
# spent 131ms making 5967 calls to RBM::CORE:chdir, avg 22µs/call
977596763.6ms199018.8ms RETURN_RES:
# spent 18.8ms making 1990 calls to Digest::SHA::sha256_hex, avg 9µs/call
978 return sha256_hex($input_files_id) if $action eq 'input_files_id';
97939771.90ms return @res_copy if $action eq 'copy';
980397640.4ms return \%res_getfnames if $action eq 'getfnames';
981 return \@res_getfpaths if $action eq 'getfpaths';
982}
983
984
# spent 56.5s (36.8ms+56.5) within RBM::system_log which was called: # once (36.8ms+56.5s) by RBM::__ANON__[rbm/lib/RBM.pm:1107] at line 1107
sub system_log {
98512µs my ($log_file, @args) = @_;
9861800ns return system(@args) if $log_file eq '-';
987136.6ms if (my $pid = fork) {
988156.5s156.5s waitpid($pid, 0);
# spent 56.5s making 1 call to RBM::CORE:waitpid
9891224µs return ${^CHILD_ERROR_NATIVE};
990 }
991 exit_error "Could not open $log_file" unless open(STDOUT, '>>', $log_file);
992 open(STDERR, '>&', *STDOUT);
993 exec(@args);
994}
995
996
# spent 1692s (2.68ms+1691) within RBM::build_run which was called: # once (2.68ms+1691s) by RBM::build_pkg at line 1168
sub build_run {
9971900ns my ($project, $script_name, $options) = @_;
99811µs my $old_step = $config->{step};
99911µs $config->{step} = $script_name;
10001700ns $options //= {};
10011400ns my $error;
100217µs33.45ms my $dest_dir = create_dir(rbm_path(project_config($project, 'output_dir', $options)));
# spent 3.15ms making 1 call to RBM::project_config # spent 304µs making 1 call to RBM::create_dir # spent 5µs making 1 call to RBM::rbm_path
100313µs14µs valid_project($project);
# spent 4µs making 1 call to RBM::valid_project
10041728µs2278µs $options = { %$options, build_id => Data::UUID->new->create_str };
# spent 191µs making 1 call to Data::UUID::create_str # spent 86µs making 1 call to Data::UUID::new
1005112µs2426µs my $old_cwd = getcwd;
# spent 420µs making 1 call to Data::UUID::DESTROY # spent 7µs making 1 call to Cwd::getcwd
100613µs1840µs my $srcdir = project_config($project, 'build_srcdir', $options);
# spent 840µs making 1 call to RBM::project_config
10071800ns my $use_srcdir = $srcdir;
1008115µs28.09ms my $tmpdir = File::Temp->newdir(get_tmp_dir($project, $options)
# spent 7.49ms making 1 call to RBM::get_tmp_dir # spent 602µs making 1 call to File::Temp::newdir
1009 . '/rbm-XXXXX');
10101300ns my @cfiles;
101111µs if ($use_srcdir) {
1012 @cfiles = ($srcdir);
1013 } else {
101414µs123µs $srcdir = $tmpdir->dirname;
# spent 23µs making 1 call to File::Temp::Dir::dirname
101515µs1295ms my $tarfile = maketar($project, $options, $srcdir);
# spent 295ms making 1 call to RBM::maketar
101613µs push @cfiles, $tarfile if $tarfile;
101716µs1867µs push @cfiles, copy_files($project, $srcdir);
# spent 867µs making 1 call to RBM::copy_files
1018120µs1531s push @cfiles, input_files('copy', $project, $options, $srcdir);
# spent 531s making 1 call to RBM::input_files
1019 }
10201500ns my ($remote_tmp_src, $remote_tmp_dst, %build_script);
102113µs my @scripts = ('pre', $script_name, 'post');
102214µs my %scripts_root = ( pre => 1, post => 1);
102317µs1145ms if (project_config($project, "remote_exec", $options)) {
# spent 145ms making 1 call to RBM::project_config
1024117µs1161ms my $cmd = project_config($project, "remote_start", {
# spent 161ms making 1 call to RBM::project_config
1025 %$options,
1026 remote_srcdir => $srcdir,
1027 });
10281500ns if ($cmd) {
102917µs16.78s my ($stdout, $stderr, $success, $exit_code)
# spent 6.78s making 1 call to RBM::run_script
1030 = run_script($project, $cmd, \&capture_exec);
10311500ns if (!$success) {
1032 $error = "Error starting remote:\n$stdout\n$stderr";
1033 goto EXIT;
1034 }
1035 }
10361800ns foreach my $remote_tmp ($remote_tmp_src, $remote_tmp_dst) {
1037255µs4301ms $cmd = project_config($project, "remote_exec", {
# spent 301ms making 4 calls to RBM::project_config, avg 75.2ms/call
1038 %$options,
1039 exec_cmd => project_config($project,
1040 "remote_mktemp", $options) || 'mktemp -d -p /var/tmp',
1041 exec_name => 'mktemp',
1042 exec_as_root => 0,
1043 });
1044214µs2411ms my ($stdout, $stderr, $success, $exit_code)
# spent 411ms making 2 calls to RBM::run_script, avg 205ms/call
1045 = run_script($project, $cmd, \&capture_exec);
10462800ns if (!$success) {
1047 $error = "Error connecting to remote:\n$stdout\n$stderr";
1048 goto EXIT;
1049 }
1050221µs $remote_tmp = (split(/\r?\n/, $stdout))[0];
1051 }
1052110µs my $o = {
1053 %$options,
1054 norec => { output_dir => $remote_tmp_dst },
1055 };
105613µs foreach my $s (@scripts) {
10573142µs31089s $build_script{$s} = project_config($project, $s, $o);
# spent 1089s making 3 calls to RBM::project_config, avg 363s/call
1058 }
1059 } else {
1060 foreach my $s (@scripts) {
1061 $build_script{$s} = project_config($project, $s, $options);
1062 }
1063 }
106411µs if (!$build_script{$script_name}) {
1065 $error = "Missing $script_name config";
1066 goto EXIT;
1067 }
106813µs @scripts = grep { $build_script{$_} } @scripts;
106911µs push @cfiles, @scripts unless $use_srcdir;
107012µs foreach my $s (@scripts) {
1071112µs2832µs path("$srcdir/$s")->spew_utf8($build_script{$s});
# spent 767µs making 1 call to Path::Tiny::spew_utf8 # spent 65µs making 1 call to Path::Tiny::path
1072113µs16µs chmod 0700, "$srcdir/$s";
# spent 6µs making 1 call to RBM::CORE:chmod
1073 }
107413µs120.6ms my $build_log = project_config($project, "build_log", $options);
# spent 20.6ms making 1 call to RBM::project_config
107512µs if ($build_log ne '-') {
107612µs113.6ms my $append = project_config($project, "build_log_append", $options);
# spent 13.6ms making 1 call to RBM::project_config
107713µs18µs $build_log = rbm_path($build_log);
# spent 8µs making 1 call to RBM::rbm_path
10781700ns unlink $build_log unless $append;
1079112µs2111µs make_path(dirname($build_log));
# spent 98µs making 1 call to File::Basename::dirname # spent 13µs making 1 call to File::Path::make_path
1080144µs my $now = localtime;
1081112µs2802µs path($build_log)->append_utf8("Starting build: $now\n");
# spent 750µs making 1 call to Path::Tiny::append_utf8 # spent 53µs making 1 call to Path::Tiny::path
1082138µs133µs print "Build log: $build_log\n";
# spent 33µs making 1 call to RBM::CORE:print
1083 }
1084113µs16µs chdir $srcdir;
# spent 6µs making 1 call to RBM::CORE:chdir
10851300ns my $res;
1086155µs if ($remote_tmp_src && $remote_tmp_dst) {
108712µs foreach my $file (@cfiles) {
10888775µs162.01s my $cmd = project_config($project, "remote_put", {
# spent 2.01s making 8 calls to RBM::project_config, avg 251ms/call # spent 1.07ms making 8 calls to File::Basename::dirname, avg 133µs/call
1089 %$options,
1090 put_src => "$srcdir/$file",
1091 put_dst => $remote_tmp_src . '/' . dirname($file),
1092 exec_name => 'put',
1093 exec_as_root => 0,
1094 });
1095162.54s165.18s
# spent 2.54s (588µs+2.54) within RBM::__ANON__[rbm/lib/RBM.pm:1095] which was called 8 times, avg 317ms/call: # 8 times (588µs+2.54s) by RBM::run_script at line 468, avg 317ms/call
if (run_script($project, $cmd, sub { system(@_) }) != 0) {
# spent 2.65s making 8 calls to RBM::run_script, avg 331ms/call # spent 2.54s making 8 calls to RBM::CORE:system, avg 317ms/call
1096 $error = "Error uploading $file";
1097 goto EXIT;
1098 }
1099 }
110012µs foreach my $s (@scripts) {
1101 my $cmd = project_config($project, "remote_exec", {
1102 %$options,
1103 exec_cmd => "cd $remote_tmp_src; ./$s",
1104 exec_name => $s,
11051278µs1226ms exec_as_root => $scripts_root{$s},
# spent 226ms making 1 call to RBM::project_config
1106 });
1107283µs2113s
# spent 56.5s (192µs+56.5) within RBM::__ANON__[rbm/lib/RBM.pm:1107] which was called: # once (192µs+56.5s) by RBM::run_script at line 468
if (run_script($project, $cmd, sub { system_log($build_log, @_) }) != 0) {
# spent 56.5s making 1 call to RBM::run_script # spent 56.5s making 1 call to RBM::system_log
1108 $error = "Error running $script_name";
1109 if (project_config($project, 'debug', $options)) {
1110 print STDERR $error, "\nOpening debug shell\n";
1111 print STDERR "Warning: build files will be removed when you exit this shell.\n";
1112 my $cmd = project_config($project, "remote_exec", {
1113 %$options,
1114 exec_cmd => "cd $remote_tmp_src; PS1='debug-$project\$ ' \${SHELL-/bin/bash}",
1115 exec_name => "debug-$s",
1116 exec_as_root => $scripts_root{$s},
1117 interactive => 1,
1118 });
1119 run_script($project, $cmd, sub { system(@_) });
1120 }
1121 goto EXIT;
1122 }
1123 }
1124199µs140.3ms my $cmd = project_config($project, "remote_get", {
# spent 40.3ms making 1 call to RBM::project_config
1125 %$options,
1126 get_src => $remote_tmp_dst,
1127 get_dst => $dest_dir,
1128 exec_name => 'get',
1129 exec_as_root => 0,
1130 });
1131273.9ms2160ms
# spent 73.8ms (99µs+73.7) within RBM::__ANON__[rbm/lib/RBM.pm:1131] which was called: # once (99µs+73.7ms) by RBM::run_script at line 468
if (run_script($project, $cmd, sub { system(@_) }) != 0) {
# spent 86.5ms making 1 call to RBM::run_script # spent 73.7ms making 1 call to RBM::CORE:system
1132 $error = "Error downloading build result";
1133 }
1134162µs2563ms run_script($project, project_config($project, "remote_exec", {
# spent 338ms making 1 call to RBM::run_script # spent 225ms making 1 call to RBM::project_config
1135 %$options,
1136 exec_cmd => "rm -Rf $remote_tmp_src $remote_tmp_dst",
1137 exec_name => 'clean',
1138 exec_as_root => 0,
1139 }), \&capture_exec);
1140 } else {
1141 foreach my $s (@scripts) {
1142 my $cmd = $scripts_root{$s} ? project_config($project, 'suexec',
1143 { suexec_cmd => "$srcdir/$s" }) : "$srcdir/$s";
1144 if (system_log($build_log, $cmd) != 0) {
1145 $error = "Error running $script_name";
1146 if (project_config($project, 'debug', $options)) {
1147 print STDERR $error, "\nOpening debug shell\n";
1148 print STDERR "Warning: build files will be removed when you exit this shell.\n";
1149 run_script($project, "PS1='debug-$project\$ ' \$SHELL", sub { system(@_) });
1150 }
1151 }
1152 }
1153 }
1154 EXIT:
1155136µs1215ms if (project_config($project, "remote_exec", $options)) {
# spent 215ms making 1 call to RBM::project_config
115613µs123.0ms my $cmd = project_config($project, "remote_finish", $options);
# spent 23.0ms making 1 call to RBM::project_config
11572929ms21.87s
# spent 929ms (143µs+928) within RBM::__ANON__[rbm/lib/RBM.pm:1157] which was called: # once (143µs+928ms) by RBM::run_script at line 468
if ($cmd && (run_script($project, $cmd, sub { system(@_) }) != 0)) {
# spent 939ms making 1 call to RBM::run_script # spent 928ms making 1 call to RBM::CORE:system
1158 $error ||= "Error finishing remote";
1159 }
1160 }
116115µs $config->{step} = $old_step;
11621149µs13µs chdir $old_cwd;
# spent 3µs making 1 call to RBM::CORE:chdir
1163176µs1105ms exit_error $error if $error;
# spent 105ms making 1 call to File::Temp::Dir::DESTROY
1164}
1165
1166
# spent 1692s (16µs+1692) within RBM::build_pkg which was called: # once (16µs+1692s) by main::build_script at line 178 of /root/tor-browser-build/rbm/rbm
sub build_pkg {
11671900ns my ($project, $options) = @_;
1168114µs21692s build_run($project, project_config($project, 'pkg_type', $options), $options);
# spent 1692s making 1 call to RBM::build_run # spent 5.12ms making 1 call to RBM::project_config
1169}
1170
1171sub publish {
1172 my ($project) = @_;
1173 project_config($project, 'publish', { error_if_undef => 1 });
1174 my $publish_src_dir = project_config($project, 'publish_src_dir');
1175 if (!$publish_src_dir) {
1176 $publish_src_dir = File::Temp->newdir(get_tmp_dir($project)
1177 . '/rbm-XXXXXX');
1178 build_pkg($project, { norec => { output_dir => $publish_src_dir } });
1179 }
1180 build_run($project, 'publish', { build_srcdir => $publish_src_dir });
1181}
1182
118314µs1;
1184# vim: expandtab sw=4
 
# spent 246ms within RBM::CORE:chdir which was called 12110 times, avg 20µs/call: # 5967 times (131ms+0s) by RBM::input_files at line 976, avg 22µs/call # 5967 times (113ms+0s) by RBM::input_files at line 796, avg 19µs/call # 87 times (722µs+0s) by RBM::git_clone_fetch_chdir at line 401, avg 8µs/call # 86 times (991µs+0s) by RBM::execute at line 510, avg 12µs/call # once (6µs+0s) by RBM::build_run at line 1084 # once (4µs+0s) by RBM::maketar at line 606 # once (3µs+0s) by RBM::build_run at line 1162
sub RBM::CORE:chdir; # opcode
# spent 65µs within RBM::CORE:chmod which was called 16 times, avg 4µs/call: # 15 times (60µs+0s) by RBM::run_script at line 467, avg 4µs/call # once (6µs+0s) by RBM::build_run at line 1072
sub RBM::CORE:chmod; # opcode
# spent 170ms within RBM::CORE:ftdir which was called 6061 times, avg 28µs/call: # 6055 times (170ms+0s) by RBM::create_dir at line 369, avg 28µs/call # 6 times (81µs+0s) by RBM::input_files at line 971, avg 13µs/call
sub RBM::CORE:ftdir; # opcode
# spent 760µs within RBM::CORE:ftfile which was called 155 times, avg 5µs/call: # 144 times (632µs+0s) by RBM::load_config at line 54, avg 4µs/call # 6 times (26µs+0s) by RBM::recursive_copy at line 770, avg 4µs/call # 2 times (52µs+0s) by RBM::sha256file at line 619, avg 26µs/call # once (17µs+0s) by RBM::load_local_config at line 69 # once (17µs+0s) by RBM::find_config_file at line 73 # once (16µs+0s) by RBM::load_system_config at line 62
sub RBM::CORE:ftfile; # opcode
# spent 220ms within RBM::CORE:ftis which was called 11934 times, avg 18µs/call: # 11934 times (220ms+0s) by RBM::file_in_dir at line 724, avg 18µs/call
sub RBM::CORE:ftis; # opcode
# spent 643µs within RBM::CORE:glob which was called: # once (643µs+0s) by RBM::load_config at line 53
sub RBM::CORE:glob; # opcode
# spent 1.30s within RBM::CORE:match which was called 1990615 times, avg 652ns/call: # 1381750 times (660ms+0s) by RBM::get_targets at line 125, avg 478ns/call # 608734 times (637ms+0s) by RBM::rbm_path at line 86, avg 1µs/call # 101 times (425µs+0s) by RBM::run_script at line 464, avg 4µs/call # 15 times (390µs+0s) by RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:16] at line 15 of (eval 14)[rbm/lib/RBM.pm:39], avg 26µs/call # 15 times (86µs+0s) by RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:10] at line 9 of (eval 14)[rbm/lib/RBM.pm:39], avg 6µs/call
sub RBM::CORE:match; # opcode
# spent 51µs within RBM::CORE:mkdir which was called 6 times, avg 8µs/call: # 6 times (51µs+0s) by RBM::input_files at line 973, avg 8µs/call
sub RBM::CORE:mkdir; # opcode
# spent 4.76ms within RBM::CORE:print which was called 8 times, avg 594µs/call: # 6 times (4.66ms+0s) by RBM::input_files at line 972, avg 777µs/call # once (62µs+0s) by RBM::maketar at line 605 # once (33µs+0s) by RBM::build_run at line 1082
sub RBM::CORE:print; # opcode
# spent 2.20s within RBM::CORE:regcomp which was called 1381750 times, avg 2µs/call: # 1381750 times (2.20s+0s) by RBM::get_targets at line 125, avg 2µs/call
sub RBM::CORE:regcomp; # opcode
# spent 3.62s within RBM::CORE:system which was called 12 times, avg 302ms/call: # 8 times (2.54s+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1095] at line 1095, avg 317ms/call # once (928ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1157] at line 1157 # once (73.7ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1131] at line 1131 # once (65.8ms+0s) by RBM::maketar at line 599 # once (16.4ms+0s) by RBM::maketar at line 563
sub RBM::CORE:system; # opcode
# spent 1.31ms within RBM::CORE:unlink which was called 15 times, avg 88µs/call: # 15 times (1.31ms+0s) by RBM::run_script at line 469, avg 88µs/call
sub RBM::CORE:unlink; # opcode
# spent 52µs within RBM::CORE:utime which was called: # once (52µs+0s) by RBM::maketar at line 604
sub RBM::CORE:utime; # opcode
# spent 56.5s within RBM::CORE:waitpid which was called: # once (56.5s+0s) by RBM::system_log at line 988
sub RBM::CORE:waitpid; # opcode
# spent 1µs within RBM::__ANON__ which was called: # once (1µs+0s) by RBM::BEGIN@9 at line 9
sub RBM::__ANON__; # xsub