← Index
NYTProf Performance Profile   « line view »
For rbm/rbm
  Run on Wed Feb 12 03:38:15 2020
Reported on Wed Feb 12 04:56:35 2020

Filename/root/tor-browser-build/rbm/lib/RBM.pm
StatementsExecuted 1112110763 statements in 1056s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
8924562471279s2130sRBM::::config_pRBM::config_p (recurses: max depth 13, inclusive time 10687s)
281014421195s336sRBM::::get_targetRBM::get_target (recurses: max depth 1, inclusive time 160s)
70253611175s2131sRBM::::configRBM::config (recurses: max depth 13, inclusive time 11104s)
11159.0s59.0sRBM::::CORE:waitpidRBM::CORE:waitpid (opcode)
3831612147.2s2134sRBM::::process_templateRBM::process_template (recurses: max depth 40, inclusive time 39501s)
147942352247.1s2134sRBM::::project_configRBM::project_config (recurses: max depth 55, inclusive time 52928s)
7025361122.4s362sRBM::::get_targetsRBM::get_targets
7025361121.6s38.2sRBM::::get_stepRBM::get_step
6300641114.71s5.32sRBM::::rbm_pathRBM::rbm_path
505452114.54s170sRBM::::notmplRBM::notmpl
12513.36s3.36sRBM::::CORE:systemRBM::CORE:system (opcode)
1405072112.29s2.29sRBM::::CORE:regcompRBM::CORE:regcomp (opcode)
5967322.02s2127sRBM::::input_filesRBM::input_files (recurses: max depth 11, inclusive time 9631s)
868703111.94s1.94sRBM::::confkey_strRBM::confkey_str
1808655441.39s39779sRBM::::__ANON__[rbm/lib/RBM.pm:640]RBM::__ANON__[rbm/lib/RBM.pm:640]
2039154521.31s1.31sRBM::::CORE:matchRBM::CORE:match (opcode)
702536111.11s1.11sRBM::::as_arrayRBM::as_array
51584101745ms355sRBM::::__ANON__[rbm/lib/RBM.pm:794]RBM::__ANON__[rbm/lib/RBM.pm:794]
2984341612ms2128sRBM::::project_step_configRBM::project_step_config (recurses: max depth 12, inclusive time 9875s)
1988471358ms358msRBM::::CORE:chdirRBM::CORE:chdir (opcode)
397322328ms273sRBM::::executeRBM::execute
994821279ms279msRBM::::CORE:ftdirRBM::CORE:ftdir (opcode)
397421266ms108sRBM::::git_clone_fetch_chdirRBM::git_clone_fetch_chdir
1193411241ms241msRBM::::CORE:ftisRBM::CORE:ftis (opcode)
596711230ms216sRBM::::input_file_need_dlRBM::input_file_need_dl
1990982225ms117sRBM::::__ANON__[rbm/lib/RBM.pm:645]RBM::__ANON__[rbm/lib/RBM.pm:645]
397411212ms91.3sRBM::::git_need_fetchRBM::git_need_fetch
397611212ms770sRBM::::__ANON__[rbm/lib/RBM.pm:845]RBM::__ANON__[rbm/lib/RBM.pm:845]
398881186ms153sRBM::::run_scriptRBM::run_script
1991011155ms27.6sRBM::::__ANON__[rbm/lib/RBM.pm:650]RBM::__ANON__[rbm/lib/RBM.pm:650]
596711112ms353msRBM::::file_in_dirRBM::file_in_dir
59611199.1ms16.8sRBM::::input_file_idRBM::input_file_id
40386295.2ms479msRBM::::__ANON__[rbm/lib/RBM.pm:655]RBM::__ANON__[rbm/lib/RBM.pm:655]
79442194.8ms51.5sRBM::::__ANON__[rbm/lib/RBM.pm:837]RBM::__ANON__[rbm/lib/RBM.pm:837]
99423180.8ms360msRBM::::create_dirRBM::create_dir
11130.5ms59.0sRBM::::system_logRBM::system_log
29771128.0ms203sRBM::::__ANON__[rbm/lib/RBM.pm:648]RBM::__ANON__[rbm/lib/RBM.pm:648]
59693127.8ms27.8msRBM::::gpg_idRBM::gpg_id
1119.75ms28.3msRBM::::BEGIN@5RBM::BEGIN@5
1115.61ms8.89msRBM::::BEGIN@14RBM::BEGIN@14
1114.04ms4.47msRBM::::BEGIN@15RBM::BEGIN@15
1114.03ms4.68msRBM::::BEGIN@23RBM::BEGIN@23
1113.91ms5.27msRBM::::BEGIN@21RBM::BEGIN@21
1113.25ms13.7msRBM::::BEGIN@6RBM::BEGIN@6
1113.01ms7.43msRBM::::BEGIN@8RBM::BEGIN@8
1112.92ms5.06msRBM::::BEGIN@22RBM::BEGIN@22
144212.78ms49.0msRBM::::load_config_fileRBM::load_config_file
1112.72ms2205sRBM::::build_runRBM::build_run
1112.19ms4.10msRBM::::BEGIN@11RBM::BEGIN@11
1112.15ms24.6msRBM::::BEGIN@9RBM::BEGIN@9
1112.02ms2.32msRBM::::BEGIN@20RBM::BEGIN@20
1112.02ms12.1msRBM::::BEGIN@12RBM::BEGIN@12
1111.57ms1.87msRBM::::BEGIN@19RBM::BEGIN@19
1111.38ms1.49msRBM::::BEGIN@18RBM::BEGIN@18
1111.20ms1.23msRBM::::BEGIN@24RBM::BEGIN@24
15111.11ms1.11msRBM::::CORE:unlinkRBM::CORE:unlink (opcode)
153511.00ms1.00msRBM::::CORE:ftfileRBM::CORE:ftfile (opcode)
111930µs55.4msRBM::::load_configRBM::load_config
811788µs2.41sRBM::::__ANON__[rbm/lib/RBM.pm:1082]RBM::__ANON__[rbm/lib/RBM.pm:1082]
111772µs772µsRBM::::CORE:globRBM::CORE:glob (opcode)
111600µs859µsRBM::::BEGIN@53RBM::BEGIN@53
831461µs461µsRBM::::CORE:printRBM::CORE:print (opcode)
1732376µs172msRBM::::get_tmp_dirRBM::get_tmp_dir
111336µs308msRBM::::maketarRBM::maketar
111114µs815msRBM::::__ANON__[rbm/lib/RBM.pm:1144]RBM::__ANON__[rbm/lib/RBM.pm:1144]
61195µs606msRBM::::recursive_copyRBM::recursive_copy
11187µs60.1msRBM::::__ANON__[rbm/lib/RBM.pm:1118]RBM::__ANON__[rbm/lib/RBM.pm:1118]
162183µs83µsRBM::::CORE:chmodRBM::CORE:chmod (opcode)
11157µs57µsRBM::::set_default_envRBM::set_default_env
11152µs52µsRBM::::CORE:utimeRBM::CORE:utime (opcode)
61151µs51µsRBM::::CORE:mkdirRBM::CORE:mkdir (opcode)
11139µs59.0sRBM::::__ANON__[rbm/lib/RBM.pm:1094]RBM::__ANON__[rbm/lib/RBM.pm:1094]
11123µs2205sRBM::::build_pkgRBM::build_pkg
11118µs47µsRBM::::find_config_fileRBM::find_config_file
11117µs4.81msRBM::::load_local_configRBM::load_local_config
11115µs57.1msRBM::::load_system_configRBM::load_system_config
11115µs30µsRBM::::BEGIN@3RBM::BEGIN@3
11112µs845µsRBM::::copy_filesRBM::copy_files
11110µs37µsRBM::::BEGIN@17RBM::BEGIN@17
22110µs10µsRBM::::valid_projectRBM::valid_project
1119µs44µsRBM::::BEGIN@7RBM::BEGIN@7
1118µs27µsRBM::::BEGIN@16RBM::BEGIN@16
1118µs41µsRBM::::BEGIN@10RBM::BEGIN@10
1116µs53µsRBM::::BEGIN@13RBM::BEGIN@13
1115µs6µsRBM::::BEGIN@4RBM::BEGIN@4
1111µs1µsRBM::::__ANON__RBM::__ANON__ (xsub)
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:1106]RBM::__ANON__[rbm/lib/RBM.pm:1106]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:1136]RBM::__ANON__[rbm/lib/RBM.pm:1136]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:698]RBM::__ANON__[rbm/lib/RBM.pm:698]
0000s0sRBM::::__ANON__[rbm/lib/RBM.pm:878]RBM::__ANON__[rbm/lib/RBM.pm:878]
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::::sha256fileRBM::sha256file
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
3221µs245µs
# spent 30µs (15+15) within RBM::BEGIN@3 which was called: # once (15µs+15µs) by main::BEGIN@6 at line 3
use warnings;
# spent 30µs making 1 call to RBM::BEGIN@3 # spent 15µs making 1 call to warnings::import
4220µs28µs
# spent 6µs (5+2) within RBM::BEGIN@4 which was called: # once (5µs+2µs) by main::BEGIN@6 at line 4
use strict;
# spent 6µs making 1 call to RBM::BEGIN@4 # spent 2µs making 1 call to strict::import
521.50ms228.3ms
# spent 28.3ms (9.75+18.5) within RBM::BEGIN@5 which was called: # once (9.75ms+18.5ms) by main::BEGIN@6 at line 5
use Path::Tiny;
# spent 28.3ms making 1 call to RBM::BEGIN@5 # spent 38µs making 1 call to Exporter::import
62133µs213.8ms
# spent 13.7ms (3.25+10.4) within RBM::BEGIN@6 which was called: # once (3.25ms+10.4ms) by main::BEGIN@6 at line 6
use Encode qw(encode);
# spent 13.7ms making 1 call to RBM::BEGIN@6 # spent 115µs making 1 call to Exporter::import
7228µs280µs
# spent 44µs (9+35) within RBM::BEGIN@7 which was called: # once (9µs+35µs) by main::BEGIN@6 at line 7
use Cwd qw(getcwd);
# spent 44µs making 1 call to RBM::BEGIN@7 # spent 35µs making 1 call to Exporter::import
821.48ms27.46ms
# spent 7.43ms (3.01+4.42) within RBM::BEGIN@8 which was called: # once (3.01ms+4.42ms) by main::BEGIN@6 at line 8
use YAML::XS qw(LoadFile);
# spent 7.43ms making 1 call to RBM::BEGIN@8 # spent 33µs making 1 call to Exporter::import
921.09ms224.6ms
# spent 24.6ms (2.15+22.5) within RBM::BEGIN@9 which was called: # once (2.15ms+22.5ms) by main::BEGIN@6 at line 9
use Template;
# spent 24.6ms making 1 call to RBM::BEGIN@9 # spent 1µs making 1 call to RBM::__ANON__
10223µs275µs
# spent 41µs (8+34) within RBM::BEGIN@10 which was called: # once (8µs+34µs) by main::BEGIN@6 at line 10
use File::Basename;
# spent 41µs making 1 call to RBM::BEGIN@10 # spent 34µs making 1 call to Exporter::import
112165µs24.12ms
# spent 4.10ms (2.19+1.91) within RBM::BEGIN@11 which was called: # once (2.19ms+1.91ms) by main::BEGIN@6 at line 11
use IO::Handle;
# spent 4.10ms making 1 call to RBM::BEGIN@11 # spent 18µs making 1 call to Exporter::import
122695µs212.1ms
# spent 12.1ms (2.02+10.1) within RBM::BEGIN@12 which was called: # once (2.02ms+10.1ms) by main::BEGIN@6 at line 12
use IO::CaptureOutput qw(capture_exec);
# spent 12.1ms making 1 call to RBM::BEGIN@12 # spent 30µs making 1 call to Exporter::import
13221µs299µs
# spent 53µs (6+47) within RBM::BEGIN@13 which was called: # once (6µs+47µs) by main::BEGIN@6 at line 13
use File::Temp;
# spent 53µs making 1 call to RBM::BEGIN@13 # spent 46µs making 1 call to Exporter::import
1423.65ms28.94ms
# spent 8.89ms (5.61+3.28) within RBM::BEGIN@14 which was called: # once (5.61ms+3.28ms) by main::BEGIN@6 at line 14
use File::Copy;
# spent 8.89ms making 1 call to RBM::BEGIN@14 # spent 49µs making 1 call to Exporter::import
1521.11ms24.52ms
# spent 4.47ms (4.04+427µs) within RBM::BEGIN@15 which was called: # once (4.04ms+427µs) by main::BEGIN@6 at line 15
use File::Copy::Recursive qw(fcopy);
# spent 4.47ms making 1 call to RBM::BEGIN@15 # spent 51µs making 1 call to Exporter::import
16222µs245µs
# spent 27µs (8+18) within RBM::BEGIN@16 which was called: # once (8µs+18µs) by main::BEGIN@6 at line 16
use File::Path qw(make_path);
# spent 27µs making 1 call to RBM::BEGIN@16 # spent 18µs making 1 call to Exporter::import
17222µs263µs
# spent 37µs (10+27) within RBM::BEGIN@17 which was called: # once (10µs+27µs) by main::BEGIN@6 at line 17
use File::Basename;
# spent 37µs making 1 call to RBM::BEGIN@17 # spent 27µs making 1 call to Exporter::import
182773µs21.53ms
# spent 1.49ms (1.38+111µs) within RBM::BEGIN@18 which was called: # once (1.38ms+111µs) by main::BEGIN@6 at line 18
use String::ShellQuote;
# spent 1.49ms making 1 call to RBM::BEGIN@18 # spent 39µs making 1 call to Exporter::import
1921.05ms21.99ms
# spent 1.87ms (1.57+306µs) within RBM::BEGIN@19 which was called: # once (1.57ms+306µs) by main::BEGIN@6 at line 19
use Sort::Versions;
# spent 1.87ms making 1 call to RBM::BEGIN@19 # spent 120µs making 1 call to Exporter::import
202111µs22.38ms
# spent 2.32ms (2.02+299µs) within RBM::BEGIN@20 which was called: # once (2.02ms+299µs) by main::BEGIN@6 at line 20
use RBM::DefaultConfig;
# spent 2.32ms making 1 call to RBM::BEGIN@20 # spent 68µs making 1 call to Exporter::import
2121.11ms25.36ms
# spent 5.27ms (3.91+1.36) within RBM::BEGIN@21 which was called: # once (3.91ms+1.36ms) by main::BEGIN@6 at line 21
use Digest::SHA qw(sha256_hex);
# spent 5.27ms making 1 call to RBM::BEGIN@21 # spent 94µs making 1 call to Exporter::import
222658µs25.10ms
# spent 5.06ms (2.92+2.14) within RBM::BEGIN@22 which was called: # once (2.92ms+2.14ms) by main::BEGIN@6 at line 22
use Data::UUID;
# spent 5.06ms making 1 call to RBM::BEGIN@22 # spent 41µs making 1 call to Exporter::import
232591µs24.75ms
# spent 4.68ms (4.03+648µs) within RBM::BEGIN@23 which was called: # once (4.03ms+648µs) by main::BEGIN@6 at line 23
use Data::Dump qw(dd pp);
# spent 4.68ms making 1 call to RBM::BEGIN@23 # spent 67µs making 1 call to Exporter::import
2421.39ms21.27ms
# spent 1.23ms (1.20+35µs) within RBM::BEGIN@24 which was called: # once (1.20ms+35µs) by main::BEGIN@6 at line 24
use feature "state";
# spent 1.23ms making 1 call to RBM::BEGIN@24 # spent 35µs making 1 call to feature::import
25
26our $config;
27
28
# spent 49.0ms (2.78+46.2) within RBM::load_config_file which was called 144 times, avg 340µs/call: # 143 times (1.65ms+44.3ms) by RBM::load_config at line 55, avg 321µs/call # once (1.12ms+1.87ms) by RBM::load_config at line 47
sub load_config_file {
2914444µs my $res = {};
3014420µs my @conf;
31 eval {
32144240µs14446.1ms @conf = LoadFile($_[0]);
# spent 46.1ms making 144 calls to YAML::XS::LoadFile, avg 320µs/call
3314484µs } or do {
34 exit_error("Error reading file $_[0] :\n" . $@);
35 };
3614466µs foreach my $c (@conf) {
3714563µs local $@ = '';
38145589µs $res = { %$res, %$c } if ref $c eq 'HASH';
3914597µs $res = { %$res, eval $c } if !ref $c;
# spent 2.63ms executing statements in string eval
# includes 1.23ms spent executing 32 calls to 6 subs defined therein.
4014580µs exit_error("Error executing perl config from $_[0] :\n" . $@) if $@;
41 }
42144326µs return $res;
43}
44
45
# spent 55.4ms (930µs+54.5) within RBM::load_config which was called: # once (930µs+54.5ms) by main::RUNTIME at line 202 of /root/tor-browser-build/rbm/rbm
sub load_config {
4613µs147µs my $config_file = shift // find_config_file();
# spent 47µs making 1 call to RBM::find_config_file
4714µs13.00ms $config = load_config_file($config_file);
# spent 3.00ms making 1 call to RBM::load_config_file
4812µs $config->{default} = \%default_config;
4914µs158µs $config->{basedir} = dirname($config_file);
# spent 58µs making 1 call to File::Basename::dirname
5011µs $config->{step} = 'rbm_init';
5112µs $config->{opt} = {};
5213µs my $pdir = $config->{projects_dir} || $config->{default}{projects_dir};
5339.32ms31.64ms
# spent 859µs (600+259) within RBM::BEGIN@53 which was called: # once (600µs+259µs) by main::BEGIN@6 at line 53
foreach my $p (glob rbm_path($pdir) . '/*') {
# spent 859µs making 1 call to RBM::BEGIN@53 # spent 772µs making 1 call to RBM::CORE:glob # spent 11µs making 1 call to RBM::rbm_path
541441.18ms144906µs next unless -f "$p/config";
# spent 906µs making 144 calls to RBM::CORE:ftfile, avg 6µs/call
55143643µs28649.7ms $config->{projects}{basename($p)} = load_config_file("$p/config");
# spent 46.0ms making 143 calls to RBM::load_config_file, avg 321µs/call # spent 3.75ms making 143 calls to File::Basename::basename, avg 26µs/call
56 }
57}
58
59
# spent 57.1ms (15µs+57.1) within RBM::load_system_config which was called: # once (15µs+57.1ms) by main::set_options at line 110 of /root/tor-browser-build/rbm/rbm
sub load_system_config {
6011µs my ($project) = @_;
6116µs157.1ms my $cfile = project_config($project ? $project : 'undef', 'sysconf_file');
# spent 57.1ms making 1 call to RBM::project_config
62148µs138µs $config->{system} = -f $cfile ? load_config_file($cfile) : {};
# spent 38µs making 1 call to RBM::CORE:ftfile
63}
64
65
# spent 4.81ms (17µs+4.80) within RBM::load_local_config which was called: # once (17µs+4.80ms) by main::set_options at line 111 of /root/tor-browser-build/rbm/rbm
sub load_local_config {
6611µs my ($project) = @_;
6714µs14.77ms my $cfile = project_config($project ? $project : 'undef', 'localconf_file');
# spent 4.77ms making 1 call to RBM::project_config
6812µs13µs $cfile = rbm_path($cfile);
# spent 3µs making 1 call to RBM::rbm_path
69134µs126µs $config->{local} = -f $cfile ? load_config_file($cfile) : {};
# spent 26µs making 1 call to RBM::CORE:ftfile
70}
71
72
# spent 47µs (18+29) within RBM::find_config_file which was called: # once (18µs+29µs) by RBM::load_config at line 46
sub find_config_file {
73149µs229µs for (my $dir = getcwd; $dir ne '/'; $dir = dirname($dir)) {
# spent 15µs making 1 call to Cwd::getcwd # spent 14µs making 1 call to RBM::CORE:ftfile
74 return "$dir/rbm.conf" if -f "$dir/rbm.conf";
75 }
76 exit_error("Can't find config file");
77}
78
79
# spent 57µs within RBM::set_default_env which was called: # once (57µs+0s) by main::RUNTIME at line 203 of /root/tor-browser-build/rbm/rbm
sub set_default_env {
80157µs %ENV = (%ENV, %{$config->{ENV}}) if ref $config->{ENV} eq 'HASH';
81}
82
83
# spent 5.32s (4.71+608ms) within RBM::rbm_path which was called 630064 times, avg 8µs/call: # 383161 times (2.48s+219ms) by RBM::process_template at line 631, avg 7µs/call # 227017 times (2.06s+361ms) by RBM::process_template at line 630, avg 11µs/call # 5967 times (56.1ms+6.33ms) by RBM::input_files at line 780, avg 10µs/call # 3975 times (35.8ms+3.79ms) by RBM::input_files at line 849, avg 10µs/call # 3974 times (28.4ms+3.36ms) by RBM::git_clone_fetch_chdir at line 391, avg 8µs/call # 3974 times (17.3ms+12.2ms) by RBM::git_clone_fetch_chdir at line 401, avg 7µs/call # 1992 times (32.9ms+2.19ms) by RBM::input_files at line 854, avg 18µs/call # once (10µs+900ns) by RBM::load_config at line 53 # once (8µs+800ns) by RBM::build_run at line 1064 # once (4µs+600ns) by RBM::build_run at line 989 # once (3µs+500ns) by RBM::load_local_config at line 68
sub rbm_path {
84630064320ms my ($path, $basedir) = @_;
85630064553ms $basedir //= $config->{basedir};
866300646.15s630064608ms return ( $path =~ m|^/| ) ? $path : "$basedir/$path";
# spent 608ms making 630064 calls to RBM::CORE:match, avg 965ns/call
87}
88
89
# spent 2130s (279+1852) within RBM::config_p which was called 89245624 times, avg 24µs/call: # 44962304 times (141s+-141s) by RBM::get_target at line 108, avg 6ns/call # 13092852 times (43.0s+-42.9s) by RBM::config at line 158, avg 5ns/call # 13090862 times (41.0s+-41.0s) by RBM::config at line 172, avg 5ns/call # 5620288 times (16.6s+-16.5s) by RBM::get_step at line 132, avg 5ns/call # 4364284 times (13.2s+-13.2s) by RBM::config at line 165, avg 5ns/call # 4340394 times (13.3s+2117s) by RBM::config at line 179, avg 491µs/call # 3774640 times (10.8s+-10.8s) by RBM::config at line 150, avg 4ns/call
sub config_p {
908924562453.4s my ($c, $project, $options, @q) = @_;
918924562413.5s foreach my $p (@q) {
9221215262537.5s return undef unless ref $c eq 'HASH';
93212152625294s return undef unless defined $c->{$p};
9412680577366.3s358823696s $c = ref $c->{$p} eq 'CODE' ? $c->{$p}->($project, $options, @_) : $c->{$p};
# spent 10962s making 1990 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606], avg 5.51s/call, recursion: max depth 11, sum of overlapping time 8843s # spent 770s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:845], avg 194ms/call # spent 312s making 19910 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557], avg 15.7ms/call # spent 147s making 3976 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605], avg 37.0ms/call # spent 137s making 1991 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578], avg 69.0ms/call # spent 130s making 1991 calls to RBM::DefaultConfig::lsb_release, avg 65.4ms/call # spent 77.8s making 1992 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156], avg 39.0ms/call # spent 875ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:16], avg 58.3ms/call # spent 832ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:10], avg 55.4ms/call # spent 5.70ms making 26 calls to RBM::DefaultConfig::rbm_tmp_dir, avg 219µs/call
95 }
96389877211.3s return $c;
97}
98
99
# spent 1.11s within RBM::as_array which was called 702536 times, avg 2µs/call: # 702536 times (1.11s+0s) by RBM::get_targets at line 124, avg 2µs/call
sub as_array {
1007025362.81s ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ];
101}
102
103
# spent 336s (195+141) within RBM::get_target which was called 2810144 times, avg 119µs/call: # 1405072 times (103s+232s) by RBM::get_targets at line 126, avg 239µs/call # 1405072 times (91.3s+-91.3s) by RBM::get_target at line 116, avg 0s/call
sub get_target {
10428101441.23s my ($project, $options, $paths, $target) = @_;
1052810144368ms my @res;
10628101441.19s foreach my $path (@$paths) {
1072248115233.0s foreach my $step ([ 'steps', $config->{step} ], []) {
1084496230438.5s44962304251ms my $z = config_p($config, $project, $options, @$path, @$step,
# spent 141s making 44962304 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 141s
109 'targets', $target);
110449623047.91s next unless $z;
11132363901.09s if (ref $z eq 'HASH') {
11225338541.34s push @res, $target unless grep { $_ eq $target } @res;
1132533854630ms next;
114 }
115702536789ms my @z = ref $z eq 'ARRAY' ? (@{$z}) : ($z);
11635126803.59s14050720s push @res, map { @{get_target($project, $options, $paths, $_)} } @z;
# spent 160s making 1405072 calls to RBM::get_target, avg 114µs/call, recursion: max depth 1, sum of overlapping time 160s
117 }
118 }
11928101449.29s return \@res;
120}
121
122
# spent 362s (22.4+340) within RBM::get_targets which was called 702536 times, avg 515µs/call: # 702536 times (22.4s+340s) by RBM::config at line 145, avg 515µs/call
sub get_targets {
123702536359ms my ($project, $options, $paths) = @_;
1247025361.89s7025361.11s my $tmp = $config->{run}{target} ? as_array($config->{run}{target}) : [ 'notarget' ];
# spent 1.11s making 702536 calls to RBM::as_array, avg 2µs/call
125210760813.5s28101442.98s $tmp = [ map { m/^$project:(.+)$/ ? $1 : $_ } @$tmp ];
# spent 2.29s making 1405072 calls to RBM::CORE:regcomp, avg 2µs/call # spent 693ms making 1405072 calls to RBM::CORE:match, avg 493ns/call
12635126806.27s1405072336s return [ map { @{get_target($project, $options, $paths, $_)} } @$tmp ];
# spent 336s making 1405072 calls to RBM::get_target, avg 239µs/call
127}
128
129
# spent 38.2s (21.6+16.6) within RBM::get_step which was called 702536 times, avg 54µs/call: # 702536 times (21.6s+16.6s) by RBM::config at line 146, avg 54µs/call
sub get_step {
130702536425ms my ($project, $options, $step, $paths) = @_;
1317025361.48s foreach my $path (@$paths) {
13256202884.78s562028827.9ms my $z = config_p($config, $project, $options, @$path, 'steps', $step);
# spent 16.6s making 5620288 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 16.5s
13356202881.05s next unless $z;
134 return $step if ref $z;
135 return get_step($project, $options, $z, $paths);
136 }
1377025362.12s return $step;
138}
139
140
# spent 2131s (175+1956) within RBM::config which was called 702536 times, avg 3.03ms/call: # 702536 times (175s+1956s) by RBM::project_config at line 223, avg 3.03ms/call
sub config {
141702536318ms my $project = shift;
142702536204ms my $name = shift;
143702536206ms my $options = shift;
144702536120ms my $res;
1457025361.94s702536362s my @targets = @{get_targets($project, $options, \@_)};
# spent 362s making 702536 calls to RBM::get_targets, avg 515µs/call
1467025361.69s70253638.2s my @step = ('steps', get_step($project, $options, $config->{step}, \@_));
# spent 38.2s making 702536 calls to RBM::get_step, avg 54µs/call
147702536343ms my $as_array = $options->{as_array};
148702536389ms foreach my $path (@_) {
1494364284498ms my @l;
15043642845.63s377464015.1ms push @l, config_p($config, $project, $options, @$path, "override.$name->[0]")
# spent 10.8s making 3774640 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 10.8s
151 if @$name == 1;
15243642841.26s if (!$as_array) {
15343642841.92s @l = grep { defined $_ } @l;
1544364284586ms return $l[0] if @l;
155 }
156 # 1st priority: targets + step matching
15743642841.46s foreach my $t (@targets) {
1581309285212.3s1309285271.7ms push @l, config_p($config, $project, $options, @$path, @step, 'targets', $t, @$name);
# spent 43.0s making 13092852 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 42.9s
159130928526.22s if (!$as_array) {
160130928525.03s @l = grep { defined $_ } @l;
161130928521.49s return $l[0] if @l;
162 }
163 }
164 # 2nd priority: step maching
16543642844.13s436428421.5ms push @l, config_p($config, $project, $options, @$path, @step, @$name);
# spent 13.2s making 4364284 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 13.2s
16643642841.15s if (!$as_array) {
16743642841.91s @l = grep { defined $_ } @l;
1684364284466ms return $l[0] if @l;
169 }
170 # 3rd priority: target matching
17143642841.37s foreach my $t (@targets) {
1721309086211.7s1309086268.4ms push @l, config_p($config, $project, $options, @$path, 'targets', $t, @$name);
# spent 41.0s making 13090862 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 41.0s
173130908626.04s if (!$as_array) {
174130908624.95s @l = grep { defined $_ } @l;
175130908621.50s return $l[0] if @l;
176 }
177 }
178 # last priority: no target and no step matching
17943403944.03s43403942130s push @l, config_p($config, $project, $options, @$path, @$name);
# spent 12552s making 4340394 calls to RBM::config_p, avg 2.89ms/call, recursion: max depth 13, sum of overlapping time 10422s
18043403941.07s if (!$as_array) {
18143403941.95s @l = grep { defined $_ } @l;
18243403943.36s return $l[0] if @l;
183 }
1843701902824ms @l = grep { defined $_ } @l;
18537019021.64s push @$res, @l if @l;
186 }
18740154176ms return $as_array ? $res : undef;
188}
189
190
# spent 170s (4.54+165) within RBM::notmpl which was called 505452 times, avg 336µs/call: # 505452 times (4.54s+165s) by RBM::project_config at line 226, avg 336µs/call
sub notmpl {
191505452305ms my ($name, $project) = @_;
192505452264ms return 1 if $name eq 'notmpl';
193 my @n = (@{$config->{default}{notmpl}},
1945054521.51s5054520s @{project_config($project, 'notmpl')});
# spent 165s making 505452 calls to RBM::project_config, avg 327µs/call, recursion: max depth 55, sum of overlapping time 165s
1955054522.17s return grep { $name eq $_ } @n;
196}
197
198
# spent 1.94s within RBM::confkey_str which was called 868703 times, avg 2µs/call: # 868703 times (1.94s+0s) by RBM::project_config at line 226, avg 2µs/call
sub confkey_str {
1998687033.89s ref $_[0] eq 'ARRAY' ? join '/', @{$_[0]} : $_[0];
200}
201
202
# spent 2134s (47.1+2087) within RBM::project_config which was called 1479423 times, avg 1.44ms/call: # 505452 times (10.8s+-10.8s) by RBM::notmpl at line 194, avg 0s/call # 383161 times (7.81s+-7.81s) by RBM::process_template at line 631, avg 0s/call # 227017 times (7.70s+-7.70s) by RBM::process_template at line 630, avg 0s/call # 180865 times (10.2s+-10.2s) by RBM::__ANON__[rbm/lib/RBM.pm:640] at line 640, avg 0s/call # 51584 times (3.39s+-3.18s) by RBM::__ANON__[rbm/lib/RBM.pm:794] at line 793, avg 4µs/call # 29843 times (1.79s+646s) by RBM::project_step_config at line 252, avg 21.7ms/call # 19910 times (1.29s+-1.29s) 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.32s+-1.32s) 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 (537ms+-537ms) by RBM::__ANON__[rbm/lib/RBM.pm:837] at line 836, avg 0s/call # 5967 times (231ms+-230ms) by RBM::input_files at line 780, avg 252ns/call # 5967 times (240ms+-239ms) by RBM::input_files at line 778, avg 109ns/call # 3974 times (227ms+-214ms) by RBM::git_clone_fetch_chdir at line 391, avg 3µs/call # 3974 times (207ms+-195ms) by RBM::git_need_fetch at line 378, avg 3µs/call # 3974 times (67.8ms+-62.7ms) by RBM::git_clone_fetch_chdir at line 393, avg 1µs/call # 3974 times (80.1ms+-75.1ms) by RBM::git_need_fetch at line 380, avg 1µs/call # 3974 times (154ms+-153ms) by RBM::git_clone_fetch_chdir at line 397, avg 204ns/call # 3973 times (242ms+-242ms) by RBM::execute at line 486, avg 0s/call # 3973 times (65.7ms+-65.7ms) by RBM::execute at line 479, avg 0s/call # 3973 times (32.2ms+-32.2ms) by RBM::execute at line 480, avg 0s/call # 2988 times (143ms+-143ms) 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 (145ms+-145ms) by RBM::input_files at line 854, avg 0s/call # 1991 times (199ms+-199ms) 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 # 1991 times (87.9ms+-87.9ms) by RBM::DefaultConfig::lsb_release at line 37 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call # 996 times (61.2ms+-61.2ms) 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 # 17 times (746µs+165ms) by RBM::get_tmp_dir at line 265, avg 9.75ms/call # 8 times (1.89ms+2.02s) by RBM::build_run at line 1075, avg 253ms/call # 4 times (338µs+273ms) by RBM::build_run at line 1024, avg 68.4ms/call # 3 times (325µs+1482s) by RBM::build_run at line 1044, avg 494s/call # once (192µs+240ms) by RBM::build_run at line 1142 # once (285µs+218ms) by RBM::build_run at line 1092 # once (230µs+212ms) by RBM::build_run at line 1121 # once (101µs+180ms) by RBM::build_run at line 1010 # once (58µs+169ms) by RBM::build_run at line 1011 # once (1.14ms+98.0ms) by RBM::maketar at line 596 # once (93µs+57.0ms) by RBM::load_system_config at line 61 # once (174µs+52.9ms) by RBM::build_run at line 1111 # once (94µs+46.8ms) by RBM::maketar at line 536 # once (56µs+29.5ms) by RBM::build_run at line 1143 # once (55µs+14.2ms) by RBM::build_run at line 1063 # once (31µs+13.9ms) by RBM::maketar at line 555 # once (40µs+12.2ms) by RBM::maketar at line 524 # once (34µs+11.8ms) by RBM::build_pkg at line 1155 # once (174µs+11.1ms) by RBM::build_run at line 1061 # once (32µs+5.92ms) by RBM::maketar at line 588 # once (42µs+5.18ms) by RBM::maketar at line 525 # once (33µs+4.73ms) by RBM::load_local_config at line 67 # once (29µs+3.13ms) by RBM::build_run at line 989 # once (116µs+883µs) by RBM::maketar at line 559 # once (50µs+877µs) by RBM::maketar at line 537 # once (29µs+856µs) by RBM::build_run at line 993 # once (28µs+805µs) by RBM::copy_files at line 684 # once (23µs+790µs) by RBM::maketar at line 545
sub project_config {
2031479423996ms my ($project, $name, $options) = @_;
204 CORE::state $cache;
2051479423268ms my $res;
2061479423805ms my $error_if_undef = $options->{error_if_undef};
2071479423387ms my $cache_save = $cache;
2081479423746ms if ($options) {
20914794232.35s $options = {%$options, error_if_undef => 0};
21014794233.35s my %ignore_options = map { $_ => 1 } qw(error_if_undef step);
21114794232.62s $cache = {} if grep { !$ignore_options{$_} } keys %$options;
212 }
2131479423812ms my $name_str = ref $name eq 'ARRAY' ? join '/', @$name : $name;
2141479423789ms my $step = $config->{step};
21514794231.44s if (exists $cache->{$project}{$step}{$name_str}) {
216776887477ms $res = $cache->{$project}{$step}{$name_str};
2177768871.97s goto FINISH;
218 }
2197025361.47s $name = [ split '/', $name ] unless ref $name eq 'ARRAY';
220702536160ms goto FINISH unless @$name;
221702536335ms my $opt_save = $config->{opt};
2227025365.72s $config->{opt} = { %{$config->{opt}}, %$options } if $options;
2237025363.70s7025362131s $res = config($project, $name, $options, ['opt', 'norec'], ['opt'],
# spent 13235s making 702536 calls to RBM::config, avg 18.8ms/call, recursion: max depth 13, sum of overlapping time 11104s
224 ['run'], ['projects', $project], ['local'], [],
225 ['system'], ['default']);
2267025363.86s17374062306s if (!$options->{no_tmpl} && defined($res) && !ref $res
# spent 41608s making 363251 calls to RBM::process_template, avg 115ms/call, recursion: max depth 40, sum of overlapping time 39474s # spent 170s making 505452 calls to RBM::notmpl, avg 336µs/call # spent 1.94s making 868703 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 }
2317025361.85s $cache->{$project}{$step}{$name_str} = $res;
2327025362.69s $config->{opt} = $opt_save;
2331479423718ms FINISH:
234 $cache = $cache_save;
2351479423412ms 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 }
24114794238.99s return $res;
242}
243
244
# spent 2128s (612ms+2128) within RBM::project_step_config which was called 29843 times, avg 71.3ms/call: # 19909 times (364ms+-297ms) by RBM::__ANON__[rbm/lib/RBM.pm:645] at line 644, avg 3µs/call # 3975 times (107ms+1424s) by RBM::input_files at line 865, avg 358ms/call # 3975 times (94.0ms+-16.9ms) by RBM::input_files at line 849, avg 19µs/call # 1984 times (46.8ms+704s) by RBM::__ANON__[rbm/lib/RBM.pm:845] at line 843, avg 355ms/call
sub project_step_config {
2452984338.7ms my $run_save = $config->{run};
2462984333.2ms my $step_save = $config->{step};
2472984340.0ms if ($_[2] && $_[2]->{step}) {
248 $config->{step} = $_[2]->{step};
249 }
2502984357.0ms $config->{run} = { target => $_[2]->{target} };
2512984352.3ms $config->{run}{target} //= $run_save->{target};
2522984373.6ms29843648s my $res = project_config(@_);
# spent 12003s making 29843 calls to RBM::project_config, avg 402ms/call, recursion: max depth 51, sum of overlapping time 11355s
2532984356.7ms $config->{run} = $run_save;
2542984328.4ms $config->{step} = $step_save;
25529843180ms return $res;
256}
257
258sub exit_error {
259 print STDERR "Error: ", $_[0], "\n";
260 exit (exists $_[1] ? $_[1] : 1);
261}
262
263
# spent 172ms (376µs+172) within RBM::get_tmp_dir which was called 17 times, avg 10.1ms/call: # 15 times (349µs+160ms) by RBM::run_script at line 465, avg 10.7ms/call # once (13µs+7.34ms) by RBM::build_run at line 995 # once (14µs+4.22ms) by RBM::DefaultConfig::rbm_tmp_dir at line 109 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm
sub get_tmp_dir {
2641715µs my ($project, $options) = @_;
2651751µs17166ms my $tmp_dir = project_config($project, 'tmp_dir', $options);
# spent 170ms making 17 calls to RBM::project_config, avg 9.99ms/call, recursion: max depth 4, sum of overlapping time 4.13ms
26617103µs17336µs make_path($tmp_dir);
# spent 336µs making 17 calls to File::Path::make_path, avg 20µs/call
26717166µ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 10µs within RBM::valid_project which was called 2 times, avg 5µs/call: # once (6µs+0s) by RBM::maketar at line 521 # once (4µs+0s) by RBM::build_run at line 990
sub valid_project {
36222µs my ($project) = @_;
36329µs exists $config->{projects}{$project}
364 || exit_error "Unknown project $project";
365}
366
367
# spent 360ms (80.8+279) within RBM::create_dir which was called 9942 times, avg 36µs/call: # 5967 times (50.6ms+175ms) by RBM::input_files at line 857, avg 38µs/call # 3974 times (30.2ms+104ms) by RBM::git_clone_fetch_chdir at line 391, avg 34µs/call # once (11µs+25µs) by RBM::build_run at line 989
sub create_dir {
36899428.60ms my ($directory) = @_;
3699942369ms9942279ms return $directory if -d $directory;
# spent 279ms making 9942 calls to RBM::CORE:ftdir, avg 28µs/call
370 my @res = make_path($directory);
371 exit_error "Error creating $directory" unless @res;
372 return $directory;
373}
374
375
# spent 91.3s (212ms+91.0) within RBM::git_need_fetch which was called 3974 times, avg 23.0ms/call: # 3974 times (212ms+91.0s) by RBM::git_clone_fetch_chdir at line 408, avg 23.0ms/call
sub git_need_fetch {
37639748.41ms my ($project, $options) = @_;
37739746.39ms return 0 if $config->{projects}{$project}{fetched};
378397410.6ms397412.2ms my $fetch = project_config($project, 'fetch', $options);
# spent 11.8s making 3974 calls to RBM::project_config, avg 2.98ms/call, recursion: max depth 48, sum of overlapping time 11.8s
37939745.45ms if ($fetch eq 'if_needed') {
380397421.6ms39745.00ms my $git_hash = project_config($project, 'git_hash', $options)
# spent 90.1ms making 3974 calls to RBM::project_config, avg 23µs/call, recursion: max depth 48, sum of overlapping time 85.1ms
381 || exit_error "No git_hash specified for project $project";
382397435.2ms397479.1s my (undef, undef, $success) = capture_exec('git', 'rev-parse',
# spent 79.1s making 3974 calls to IO::CaptureOutput::capture_exec, avg 19.9ms/call
383 '--verify', "$git_hash^{commit}");
384397454.1ms return !$success;
385 }
386 return $fetch;
387}
388
389
# spent 108s (266ms+108) within RBM::git_clone_fetch_chdir which was called 3974 times, avg 27.1ms/call: # 3973 times (266ms+108s) by RBM::execute at line 482, avg 27.1ms/call # once (166µs+41.5ms) by RBM::maketar at line 527
sub git_clone_fetch_chdir {
39039746.13ms my ($project, $options) = @_;
391397428.5ms11922179ms my $clonedir = create_dir(rbm_path(project_config($project,
# spent 134ms making 3974 calls to RBM::create_dir, avg 34µs/call # spent 31.7ms making 3974 calls to RBM::rbm_path, avg 8µs/call # spent 11.3s making 3974 calls to RBM::project_config, avg 2.85ms/call, recursion: max depth 48, sum of overlapping time 11.3s
392 'git_clone_dir', $options)));
393397411.4ms39745.08ms my $git_url = project_config($project, 'git_url', $options)
# spent 79.8ms making 3974 calls to RBM::project_config, avg 20µs/call, recursion: max depth 48, sum of overlapping time 74.7ms
394 || exit_error "git_url is undefined";
39539745.10ms my @clone_submod = ();
39639743.76ms my @fetch_submod = ();
39739748.08ms3974809µs if (project_config($project, 'git_submodule', $options)) {
# spent 4.74s making 3974 calls to RBM::project_config, avg 1.19ms/call, recursion: max depth 48, sum of overlapping time 4.74s
398 @clone_submod = ('--recurse-submodules');
399 @fetch_submod = ('--recurse-submodules=on-demand');
400 }
401397494.6ms794869.7ms if (!chdir rbm_path("$clonedir/$project")) {
# spent 40.2ms making 3974 calls to RBM::CORE:chdir, avg 10µs/call # spent 29.5ms making 3974 calls to RBM::rbm_path, avg 7µ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 }
408397454.7ms397491.3s if (git_need_fetch($project, $options)) {
# spent 91.3s making 3974 calls to RBM::git_need_fetch, avg 23.0ms/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 153s (186ms+152) within RBM::run_script which was called 3988 times, avg 38.3ms/call: # 3973 times (184ms+82.5s) by RBM::execute at line 502, avg 20.8ms/call # 8 times (1.17ms+2.50s) by RBM::build_run at line 1082, avg 312ms/call # 2 times (168µs+395ms) by RBM::build_run at line 1031, avg 198ms/call # once (195µs+59.0s) by RBM::build_run at line 1094 # once (95µs+6.80s) by RBM::build_run at line 1016 # once (158µs+827ms) by RBM::build_run at line 1144 # once (103µs+361ms) by RBM::build_run at line 1121 # once (129µs+73.6ms) by RBM::build_run at line 1118
sub run_script {
461398834.5ms my ($project, $cmd, $f) = @_;
46239882.37ms $f //= \&capture_exec;
46339882.56ms my @res;
464398839.9ms398812.5ms if ($cmd =~ m/^#/) {
# spent 12.5ms making 3988 calls to RBM::CORE:match, avg 3µs/call
46515369µs30167ms my (undef, $tmp) = File::Temp::tempfile(DIR => get_tmp_dir($project));
# spent 161ms making 15 calls to RBM::get_tmp_dir, avg 10.7ms/call # spent 6.23ms making 15 calls to File::Temp::tempfile, avg 415µs/call
46615166µs3011.6ms path($tmp)->spew_utf8($cmd);
# spent 11.0ms making 15 calls to Path::Tiny::spew_utf8, avg 731µs/call # spent 640µs making 15 calls to Path::Tiny::path, avg 43µs/call
46715151µs1578µs chmod 0700, $tmp;
# spent 78µs making 15 calls to RBM::CORE:chmod, avg 5µs/call
46815308µs1569.8s @res = $f->($tmp);
# spent 59.0s making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1094] # spent 7.50s making 4 calls to IO::CaptureOutput::capture_exec, avg 1.88s/call # spent 2.41s making 8 calls to RBM::__ANON__[rbm/lib/RBM.pm:1082], avg 301ms/call # spent 815ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1144] # spent 60.1ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1118]
469151.30ms151.11ms unlink $tmp;
# spent 1.11ms making 15 calls to RBM::CORE:unlink, avg 74µs/call
470 } else {
471397343.5ms397382.5s @res = $f->($cmd);
# spent 82.5s making 3973 calls to IO::CaptureOutput::capture_exec, avg 20.8ms/call
472 }
473398861.7ms return @res == 1 ? $res[0] : @res;
474}
475
476
# spent 273s (328ms+273) within RBM::execute which was called 3973 times, avg 68.8ms/call: # 2977 times (232ms+203s) by RBM::__ANON__[rbm/lib/RBM.pm:648] at line 648, avg 68.2ms/call # 996 times (95.7ms+70.0s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 144 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 70.4ms/call
sub execute {
47739738.60ms my ($project, $cmd, $options) = @_;
4783973107ms397365.7ms my $old_cwd = getcwd;
# spent 65.7ms making 3973 calls to Cwd::getcwd, avg 17µs/call
479397313.6ms39730s if (project_config($project, 'git_url', $options)) {
# spent 79.2ms making 3973 calls to RBM::project_config, avg 20µs/call, recursion: max depth 48, sum of overlapping time 79.2ms
48039738.15ms39730s my $git_hash = project_config($project, 'git_hash', $options)
# spent 37.7ms making 3973 calls to RBM::project_config, avg 9µs/call, recursion: max depth 48, sum of overlapping time 37.7ms
481 || exit_error "No git_hash specified for project $project";
482397315.8ms3973108s git_clone_fetch_chdir($project, $options);
# spent 108s making 3973 calls to RBM::git_clone_fetch_chdir, avg 27.1ms/call
483397325.5ms397381.9s my ($stdout, $stderr, $success, $exit_code)
# spent 81.9s making 3973 calls to IO::CaptureOutput::capture_exec, avg 20.6ms/call
484 = capture_exec('git', 'checkout', $git_hash);
48539732.55ms exit_error "Cannot checkout $git_hash:\n$stderr" unless $success;
486397345.8ms39730s if (project_config($project, 'git_submodule', $options)) {
# spent 243ms making 3973 calls to RBM::project_config, avg 61µs/call, recursion: max depth 48, sum of overlapping time 243ms
487 foreach my $action (qw(init sync update)) {
488 ($stdout, $stderr, $success, $exit_code)
489 = capture_exec('git', 'submodule', $action);
490 exit_error "Error running git submodule $action\n$stderr"
491 unless $success;
492 }
493 }
494 } elsif (project_config($project, 'hg_url', $options)) {
495 my $hg_hash = project_config($project, 'hg_hash', $options)
496 || exit_error "No hg_hash specified for project $project";
497 hg_clone_fetch_chdir($project, $options);
498 my ($stdout, $stderr, $success, $exit_code)
499 = capture_exec('hg', 'update', '-C', $hg_hash);
500 exit_error "Cannot checkout $hg_hash:\n$stderr" unless $success;
501 }
502397328.7ms397382.7s my ($stdout, $stderr, $success, $exit_code)
# spent 82.7s making 3973 calls to RBM::run_script, avg 20.8ms/call
503 = run_script($project, $cmd, \&capture_exec);
504397369.6ms397349.1ms chdir($old_cwd);
# spent 49.1ms making 3973 calls to RBM::CORE:chdir, avg 12µs/call
50539739.56ms chomp $stdout;
506397361.4ms return $success ? $stdout : undef;
507}
508
509
# spent 27.8ms within RBM::gpg_id which was called 5969 times, avg 5µs/call: # 5967 times (27.8ms+0s) by RBM::input_files at line 868, avg 5µs/call # once (3µs+0s) by RBM::maketar at line 537 # once (2µs+0s) by RBM::maketar at line 545
sub gpg_id {
51059695.04ms my ($id) = @_;
511596930.0ms return $id unless $id;
512 if (ref $id eq 'ARRAY' && @$id == 1 && !$id->[0]) {
513 return 0;
514 }
515 return $id;
516}
517
518
# spent 308ms (336µs+307) within RBM::maketar which was called: # once (336µs+307ms) by RBM::build_run at line 1002
sub maketar {
5191900ns my ($project, $options, $dest_dir) = @_;
5201500ns $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir')));
52113µs16µs valid_project($project);
# spent 6µs making 1 call to RBM::valid_project
52218µs16µs my $old_cwd = getcwd;
# spent 6µs making 1 call to Cwd::getcwd
5231300ns my $commit_hash;
52414µs112.3ms if (project_config($project, 'git_url', $options)) {
# spent 12.3ms making 1 call to RBM::project_config
52515µs15.22ms $commit_hash = project_config($project, 'git_hash', $options)
# spent 5.22ms making 1 call to RBM::project_config
526 || exit_error "No git_hash specified for project $project";
52714µs141.7ms git_clone_fetch_chdir($project);
# spent 41.7ms making 1 call to RBM::git_clone_fetch_chdir
528 } elsif (project_config($project, 'hg_url', $options)) {
529 $commit_hash = project_config($project, 'hg_hash', $options)
530 || exit_error "No hg_hash specified for project $project";
531 hg_clone_fetch_chdir($project);
532 } else {
533 return undef;
534 }
535
53619µs146.9ms my $version = project_config($project, 'version', $options);
# spent 46.9ms making 1 call to RBM::project_config
53718µs2930µs if (my $tag_gpg_id = gpg_id(project_config($project, 'tag_gpg_id', $options))) {
# spent 927µs making 1 call to RBM::project_config # spent 3µs making 1 call to RBM::gpg_id
538 my $id = git_tag_sign_id($project, $commit_hash) ||
539 exit_error "$commit_hash is not a signed tag";
540 if (!valid_id($id, $tag_gpg_id)) {
541 exit_error "Tag $commit_hash is not signed with a valid key";
542 }
543 print "Tag $commit_hash is signed with key $id\n";
544 }
54512µs2814µs if (my $commit_gpg_id = gpg_id(project_config($project, 'commit_gpg_id',
# spent 812µs making 1 call to RBM::project_config # spent 2µs making 1 call to RBM::gpg_id
546 $options))) {
547 my $id = git_commit_sign_id($project, $commit_hash) ||
548 exit_error "$commit_hash is not a signed commit";
549 if (!valid_id($id, $commit_gpg_id)) {
550 exit_error "Commit $commit_hash is not signed with a valid key";
551 }
552 print "Commit $commit_hash is signed with key $id\n";
553 }
5541900ns my $tar_file = "$project-$version.tar";
55514µs113.9ms if (project_config($project, 'git_url', $options)) {
# spent 13.9ms making 1 call to RBM::project_config
556115.2ms115.1ms system('git', 'archive', "--prefix=$project-$version/",
# spent 15.1ms making 1 call to RBM::CORE:system
557 "--output=$dest_dir/$tar_file", $commit_hash) == 0
558 || exit_error 'Error running git archive.';
559116µs11000µs if (project_config($project, 'git_submodule', $options)) {
# spent 1000µs making 1 call to RBM::project_config
560 my $tmpdir = File::Temp->newdir(
561 get_tmp_dir($project, $options) . '/rbm-XXXXX');
562 my ($stdout, $stderr, $success, $exit_code)
563 = capture_exec('git', 'checkout', $commit_hash);
564 exit_error "Cannot checkout $commit_hash: $stderr" unless $success;
565 foreach my $action (qw(init sync update)) {
566 ($stdout, $stderr, $success, $exit_code)
567 = capture_exec('git', 'submodule', $action);
568 exit_error "Error running git submodule $action\n$stderr"
569 unless $success;
570 }
571 ($stdout, $stderr, $success, $exit_code)
572 = capture_exec('git', 'submodule', 'foreach',
573 "git archive --prefix=$project-$version/\$path/"
574 . " --output=$tmpdir/submodule.tar \$sha1;"
575 . "tar -Af \"$dest_dir/$tar_file\" $tmpdir/submodule.tar");
576 exit_error 'Error running git archive on submodules.' unless $success;
577 }
578 } else {
579 system('hg', 'archive', '-r', $commit_hash, '-t', 'tar',
580 '--prefix', "$project-$version", "$dest_dir/$tar_file") == 0
581 || exit_error 'Error running hg archive.';
582 }
583150µs my %compress = (
584 xz => ['xz', '-f'],
585 gz => ['gzip', '--no-name', '-f'],
586 bz2 => ['bzip2', '-f'],
587 );
58815µs15.95ms if (my $c = project_config($project, 'compress_tar', $options)) {
# spent 5.95ms making 1 call to RBM::project_config
58911µs if (!defined $compress{$c}) {
590 exit_error "Unknow compression $c";
591 }
592164.4ms164.4ms system(@{$compress{$c}}, "$dest_dir/$tar_file") == 0
# spent 64.4ms making 1 call to RBM::CORE:system
593 || exit_error "Error compressing $tar_file with $compress{$c}->[0]";
59419µs $tar_file .= ".$c";
595 }
596116µs199.2ms my $timestamp = project_config($project, 'timestamp', $options);
# spent 99.2ms making 1 call to RBM::project_config
597163µs152µs utime $timestamp, $timestamp, "$dest_dir/$tar_file" if $timestamp;
# spent 52µs making 1 call to RBM::CORE:utime
598149µs141µs print "Created $dest_dir/$tar_file\n";
# spent 41µs making 1 call to RBM::CORE:print
59918µs14µs chdir($old_cwd);
# spent 4µs making 1 call to RBM::CORE:chdir
600117µs return $tar_file;
601}
602
603sub sha256file {
604 CORE::state %res;
605 my $f = rbm_path(shift);
606 return $res{$f} if exists $res{$f};
607 return $res{$f} = -f $f ? sha256_hex(path($f)->slurp_raw) : '';
608}
609
610sub process_template_opt {
611 my ($project, $tmpl, $opt, $dest_dir) = @_;
612 my $save_opt = $config->{opt};
613 $config->{opt} = {%{$config->{opt}}, %$opt} if $opt;
614 my $res = process_template($project, $tmpl, $dest_dir);
615 $config->{opt} = $save_opt;
616 return $res;
617}
618
619
# spent 2134s (47.2+2087) within RBM::process_template which was called 383161 times, avg 5.57ms/call: # 363251 times (45.4s+2089s) by RBM::project_config at line 226, avg 5.87ms/call # 19910 times (1.75s+-1.75s) by RBM::__ANON__[rbm/lib/RBM.pm:650] at line 650, avg 0s/call
sub process_template {
620383161374ms my ($project, $tmpl, $dest_dir) = @_;
621383161221ms return undef unless defined $tmpl;
622383161365ms exit_error "Can't process template on a hash" if ref $tmpl eq 'HASH';
623383161210ms if (ref $tmpl eq 'ARRAY') {
624 my $res = [];
625 foreach my $t (@$tmpl) {
626 push @$res, process_template($project, $t, $dest_dir);
627 }
628 return $res;
629 }
630383161973ms4540342.42s $dest_dir //= rbm_path(project_config($project, 'output_dir'));
# spent 2.42s making 227017 calls to RBM::rbm_path, avg 11µs/call # spent 551s making 227017 calls to RBM::project_config, avg 2.43ms/call, recursion: max depth 53, sum of overlapping time 551s
6313831611.23s7663222.70s my $projects_dir = rbm_path(project_config($project, 'projects_dir'));
# spent 2.70s making 383161 calls to RBM::rbm_path, avg 7µs/call # spent 157s making 383161 calls to RBM::project_config, avg 410µs/call, recursion: max depth 54, sum of overlapping time 157s
6323831612.38s383161165s my $template = Template->new(
# spent 165s making 383161 calls to Template::Base::new, avg 431µs/call
633 ENCODING => 'utf8',
634 INCLUDE_PATH => "$projects_dir/$project:$projects_dir/common",
635 );
636 my $vars = {
637 config => $config,
638 project => $project,
639 p => $config->{projects}{$project},
6401808651.36s1808650s
# spent 39779s (1.39+39778) within RBM::__ANON__[rbm/lib/RBM.pm:640] which was called 180865 times, avg 220ms/call: # 77850 times (689ms+25206s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 324ms/call # 31867 times (187ms+547s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 17.2ms/call # 18883 times (151ms+181s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 9.59ms/call # 8971 times (56.4ms+179s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 19.9ms/call # 6990 times (56.0ms+10970s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 1.57s/call # 5997 times (51.3ms+73.7s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/input text, avg 12.3ms/call # 3001 times (23.5ms+676s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 225ms/call # 2987 times (15.3ms+43.9s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 14.7ms/call # 2009 times (11.2ms+5.54s) by Template::Stash::XS::get at line 4 of /root/tor-browser-build/input text, avg 2.77ms/call # 2005 times (11.5ms+5.63s) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/input text, avg 2.81ms/call # 1992 times (16.3ms+96.2s) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/go/build, avg 48.3ms/call # 1991 times (13.7ms+30.2ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 22µs/call # 1986 times (30.2ms+170s) by Template::Stash::XS::get at line 26 of /root/tor-browser-build/input text, avg 85.8ms/call # 1025 times (2.08ms+1.85s) by Template::Stash::XS::get at line 12 of /root/tor-browser-build/input text, avg 1.81ms/call # 1016 times (6.47ms+2.93s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/input text, avg 2.89ms/call # 1008 times (5.38ms+1.21s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/input text, avg 1.21ms/call # 999 times (4.00ms+1.14s) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 1.14ms/call # 997 times (3.22ms+1.01s) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 1.01ms/call # 996 times (4.95ms+58.3s) by Template::Stash::XS::get at line 38 of /root/tor-browser-build/projects/go/build, avg 58.6ms/call # 996 times (5.44ms+58.2s) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/projects/go/build, avg 58.4ms/call # 996 times (6.82ms+7.81s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/go/build, avg 7.85ms/call # 996 times (13.7ms+2.82s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/projects/go/build, avg 2.84ms/call # 996 times (11.6ms+17.6ms) by Template::Stash::XS::get at line 34 of /root/tor-browser-build/projects/go/build, avg 29µs/call # 996 times (3.71ms+17.6ms) by Template::Stash::XS::get at line 74 of /root/tor-browser-build/projects/go/build, avg 21µs/call # 995 times (5.58ms+2.66s) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/input text, avg 2.68ms/call # 993 times (3.15ms+1.08s) by Template::Stash::XS::get at line 17 of /root/tor-browser-build/input text, avg 1.10ms/call # 720 times (1.77ms+9.15ms) by Template::Stash::XS::get at line 23 of /root/tor-browser-build/input text, avg 15µs/call # 303 times (702µs+3.92ms) by Template::Stash::XS::get at line 25 of /root/tor-browser-build/input text, avg 15µs/call # 60 times (243µs+927ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 15.4ms/call # 30 times (110µs+51.3ms) by Template::Stash::XS::get at line 239 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.72ms/call # 30 times (61µs+251µs) by Template::Stash::XS::get at line 21 of /root/tor-browser-build/input text, avg 10µs/call # 15 times (143µs+932ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/common/runc-config.json, avg 62.1ms/call # 15 times (43µs+20.7ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.38ms/call # 15 times (58µs+288µs) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/common/runc-config.json, avg 23µs/call # 15 times (37µs+182µs) by Template::Stash::XS::get at line 251 of /root/tor-browser-build/projects/common/runc-config.json, avg 15µs/call # 15 times (37µs+173µ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 (59µs+107µs) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/common/runc-config.json, avg 11µs/call # 15 times (32µs+125µs) by Template::Stash::XS::get at line 121 of /root/tor-browser-build/projects/common/runc-config.json, avg 10µs/call # 15 times (28µs+111µ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+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 (26µs+103µs) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/input text, avg 9µs/call # 4 times (18µs+778s) by Template::Stash::XS::get at line 28 of /root/tor-browser-build/projects/snowflake/build, avg 195s/call # 4 times (17µs+10.4ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/projects/snowflake/build, avg 2.60ms/call # 4 times (10µs+54µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 16µs/call # 4 times (8µs+31µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 10µs/call # 2 times (14µs+630s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/projects/snowflake/build, avg 315s/call # 2 times (14µs+69.3s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/projects/snowflake/build, avg 34.6s/call # 2 times (14µs+2.04s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/snowflake/build, avg 1.02s/call # 2 times (15µs+1.96s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/projects/snowflake/build, avg 980ms/call # 2 times (14µs+1.08s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 542ms/call # 2 times (13µs+272ms) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/projects/snowflake/build, avg 136ms/call # 2 times (15µs+14.0ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/snowflake/build, avg 7.00ms/call # 2 times (10µs+9.84ms) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/projects/snowflake/build, avg 4.92ms/call # 2 times (12µs+47µs) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/projects/snowflake/build, avg 29µs/call
c => sub { project_config($project, @_) },
# spent 39778s making 180865 calls to RBM::project_config, avg 220ms/call, recursion: max depth 52, sum of overlapping time 39778s
641
# spent 117s (225ms+116) within RBM::__ANON__[rbm/lib/RBM.pm:645] which was called 19909 times, avg 5.86ms/call: # 7964 times (56.3ms+22.0s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 2.77ms/call # 3982 times (50.2ms+32.0s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 8.05ms/call # 1991 times (27.7ms+15.9s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 7.99ms/call # 1991 times (32.7ms+15.7s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 7.89ms/call # 1991 times (32.2ms+2.42s) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 1.23ms/call # 995 times (10.8ms+1.20s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 1.21ms/call # 993 times (15.0ms+27.2s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 27.4ms/call # 2 times (31µs+67.6ms) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 33.8ms/call
pc => sub {
6421990916.2ms my @args = @_;
6431990929.7ms $args[2] = { $_[2] ? %{$_[2]} : (), origin_project => $project };
64419909203ms1990967.6ms project_step_config(@args);
# spent 116s making 19909 calls to RBM::project_step_config, avg 5.85ms/call, recursion: max depth 12, sum of overlapping time 116s
645 },
646 dest_dir => $dest_dir,
647 exit_error => \&exit_error,
648297740.4ms2977203s
# spent 203s (28.0ms+203) within RBM::__ANON__[rbm/lib/RBM.pm:648] which was called 2977 times, avg 68.2ms/call: # 2977 times (28.0ms+203s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 68.2ms/call
exec => sub { execute($project, @_) },
# spent 203s making 2977 calls to RBM::execute, avg 68.2ms/call
649 path => \&rbm_path,
65019910210ms199100s
# spent 27.6s (155ms+27.4) within RBM::__ANON__[rbm/lib/RBM.pm:650] which was called 19910 times, avg 1.39ms/call: # 19910 times (155ms+27.4s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 1.39ms/call
tmpl => sub { process_template($project, $_[0], $dest_dir) },
# spent 27.4s making 19910 calls to RBM::process_template, avg 1.38ms/call, recursion: max depth 39, sum of overlapping time 27.4s
651 shell_quote => \&shell_quote,
652 versioncmp => \&versioncmp,
653
# spent 479ms (95.2+384) within RBM::__ANON__[rbm/lib/RBM.pm:655] which was called 4038 times, avg 119µs/call: # 4007 times (94.8ms+382ms) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 119µs/call # 15 times (308µs+774µs) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 72µs/call # 4 times (47µs+279µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 81µs/call # 4 times (22µs+112µs) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 34µs/call # 4 times (13µs+87µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 25µs/call # 4 times (14µs+65µs) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 20µs/call
sha256 => sub {
6544038174ms8076384ms return sha256_hex(encode("utf8", $_[0]));
# spent 307ms making 4038 calls to Encode::encode, avg 76µs/call # spent 76.9ms making 4038 calls to Digest::SHA::sha256_hex, avg 19µs/call
655 },
65638316111.2s sha256file => \&sha256file,
657 fileparse => \&fileparse,
658 ENV => \%ENV,
659 };
66038316186.9ms my $output;
6613831611.55s3831612134s $template->process(\$tmpl, $vars, \$output, binmode => ':utf8')
# spent 40705s making 383161 calls to Template::process, avg 106ms/call, recursion: max depth 40, sum of overlapping time 38571s
662 || exit_error "Template Error:\n" . $template->error;
66338316121.8s7673355.60s return $output;
# spent 3.57s making 383161 calls to Template::Context::DESTROY, avg 9µs/call # spent 2.02s making 383161 calls to Template::Provider::DESTROY, avg 5µs/call # spent 11.6ms making 1013 calls to Template::Document::AUTOLOAD, avg 11µs/call
664}
665
666sub rpmspec {
667 my ($project, $dest_dir) = @_;
668 $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir')));
669 valid_project($project);
670 my $timestamp = project_config($project, 'timestamp');
671 my $rpmspec = project_config($project, 'rpmspec')
672 || exit_error "Undefined config for rpmspec";
673 path("$dest_dir/$project.spec")->spew_utf8($rpmspec);
674 utime $timestamp, $timestamp, "$dest_dir/$project.spec" if $timestamp;
675}
676
677sub projectslist {
678 keys %{$config->{projects}};
679}
680
681
# spent 845µs (12+833) within RBM::copy_files which was called: # once (12µs+833µs) by RBM::build_run at line 1004
sub copy_files {
68211µs my ($project, $dest_dir) = @_;
6831400ns my @r;
68412µs1833µs my $copy_files = project_config($project, 'copy_files');
# spent 833µs making 1 call to RBM::project_config
68516µs return unless $copy_files;
686 my $proj_dir = rbm_path(project_config($project, 'projects_dir'));
687 my $src_dir = "$proj_dir/$project";
688 foreach my $file (@$copy_files) {
689 copy("$src_dir/$file", "$dest_dir/$file");
690 push @r, $file;
691 }
692 return @r;
693}
694
695sub urlget {
696 my ($project, $input_file, $exit_on_error) = @_;
697 my $cmd = project_config($project, 'urlget', $input_file);
698 my $success = run_script($project, $cmd, sub { system(@_) }) == 0;
699 if (!$success) {
700 unlink project_config($project, 'filename', $input_file);
701 exit_error "Error downloading file" if $exit_on_error;
702 }
703 return $success;
704}
705
706sub is_url {
707 $_[0] =~ m/^https?:\/\/.*/;
708}
709
710
# spent 353ms (112+241) within RBM::file_in_dir which was called 5967 times, avg 59µs/call: # 5967 times (112ms+241ms) by RBM::input_files at line 867, avg 59µs/call
sub file_in_dir {
711596715.4ms my ($filename, @dir) = @_;
7125967357ms11934241ms return map { -e "$_/$filename" ? "$_/$filename" : () } @dir;
# spent 241ms making 11934 calls to RBM::CORE:ftis, avg 20µs/call
713}
714
715
# spent 216s (230ms+216) within RBM::input_file_need_dl which was called 5967 times, avg 36.2ms/call: # 5967 times (230ms+216s) by RBM::input_files at line 869, avg 36.2ms/call
sub input_file_need_dl {
71659679.13ms my ($input_file, $t, $fname, $action) = @_;
71759675.01ms return undef if $action eq 'getfpaths';
7185967185s7968201s if ($fname
# spent 185s making 1992 calls to Digest::SHA::sha256_hex, avg 93.0ms/call # spent 15.6s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 7.85ms/call # spent 124ms making 1992 calls to Path::Tiny::path, avg 62µs/call # spent 16.8ms making 1992 calls to Path::Tiny::slurp_raw, avg 8µs/call
719 && $input_file->{sha256sum}
720 && $t->('sha256sum') ne sha256_hex(path($fname)->slurp_raw)) {
721 $fname = undef;
722 }
72359677.77ms if ($action eq 'input_files_id') {
72459617.54ms return undef if $input_file->{input_file_id};
725596127.7ms return undef if $input_file->{sha256sum};
72639691.93ms return undef if $input_file->{exec};
727396925.6ms return undef if $fname;
728 return 1 if $input_file->{URL};
729 return 1 if $input_file->{content};
730 return undef;
731 }
732638µs64.71ms return $t->('refresh_input') if $fname;
# spent 4.71ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 785µs/call
733 return 1;
734}
735
736sub input_file_id_hash {
737 my ($fname, $filename) = @_;
738 return $filename . ':' . sha256file($fname) if -f $fname;
739 return $filename . ':' . sha256file(readlink $fname) if -l $fname;
740 my @subdirs = sort(map { $_->basename } path($fname)->children);
741 my @hashes = map { input_file_id_hash("$fname/$_", "$filename/$_") } @subdirs;
742 return join("\n", @hashes);
743}
744
745
# spent 16.8s (99.1ms+16.7) within RBM::input_file_id which was called 5961 times, avg 2.82ms/call: # 5961 times (99.1ms+16.7s) by RBM::input_files at line 899, avg 2.82ms/call
sub input_file_id {
746596114.6ms my ($input_file, $t, $fname, $filename) = @_;
74759616.32ms return $t->('input_file_id') if $input_file->{input_file_id};
748596147.3ms return $input_file->{project} . ':' . $filename if $input_file->{project};
749199225.6ms199216.7s return $filename . ':' . $t->('sha256sum') if $input_file->{sha256sum};
# spent 16.7s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 8.38ms/call
750 return $filename . ':' . sha256_hex($t->('exec', { norec => { output_dir => '/out' } }))
751 if $input_file->{exec};
752 return input_file_id_hash($fname, $filename);
753}
754
755
# spent 606ms (95µs+606) within RBM::recursive_copy which was called 6 times, avg 101ms/call: # 6 times (95µs+606ms) by RBM::input_files at line 961, avg 101ms/call
sub recursive_copy {
75667µs my ($fname, $name, $dest_dir) = @_;
757644µs620µs if (-f $fname || -l $fname) {
# spent 20µs making 6 calls to RBM::CORE:ftfile, avg 3µs/call
758654µs6606ms fcopy($fname, "$dest_dir/$name");
# spent 606ms making 6 calls to File::Copy::Recursive::fcopy, avg 101ms/call
759634µs return ($name);
760 }
761 my @copied;
762 mkdir "$dest_dir/$name";
763 foreach my $f (map { $_->basename } path($fname)->children) {
764 push @copied, recursive_copy("$fname/$f", "$name/$f", $dest_dir);
765 }
766 return @copied;
767}
768
769
# spent 2127s (2.02+2125) within RBM::input_files which was called 5967 times, avg 356ms/call: # 3976 times (898ms+1.52s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605] at line 605 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 609µs/call # 1990 times (1.12s+1474s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606] at line 606 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 741ms/call # once (1.13ms+649s) by RBM::build_run at line 1005
sub input_files {
770596714.8ms my ($action, $project, $options, $dest_dir) = @_;
77159676.53ms my @res_copy;
772 my %res_getfnames;
773 my @res_getfpaths;
77459675.57ms my $getfnames_noname = 0;
775596713.2ms my $input_files_id = '';
776596713.2ms $options = {$options ? %$options : ()};
77759679.31ms $options->{norec} = {};
778596713.8ms5967650µs my $input_files = project_config($project, 'input_files', $options);
# spent 5.44s making 5967 calls to RBM::project_config, avg 912µs/call, recursion: max depth 50, sum of overlapping time 5.44s
77959672.14ms goto RETURN_RES unless $input_files;
780596729.5ms1193464.0ms my $proj_dir = rbm_path(project_config($project, 'projects_dir', $options));
# spent 62.5ms making 5967 calls to RBM::rbm_path, avg 10µs/call # spent 13.3s making 5967 calls to RBM::project_config, avg 2.23ms/call, recursion: max depth 50, sum of overlapping time 13.3s
78159678.40ms my $src_dir = "$proj_dir/$project";
7825967149ms596792.6ms my $old_cwd = getcwd;
# spent 92.6ms making 5967 calls to Cwd::getcwd, avg 16µs/call
7835967176ms5967123ms chdir $src_dir || exit_error "cannot chdir to $src_dir";
# spent 123ms making 5967 calls to RBM::CORE:chdir, avg 21µs/call
784596737.0ms foreach my $input_file_alias (@$input_files) {
7852969718.7ms my $input_file = $input_file_alias;
7862969718.9ms if (!ref $input_file) {
787 $input_file = project_config($project,
788 process_template_opt($project, $input_file, $options), $options);
789 }
7902969711.3ms next unless $input_file;
791
# spent 355s (745ms+354) within RBM::__ANON__[rbm/lib/RBM.pm:794] which was called 51584 times, avg 6.89ms/call: # 10730 times (152ms+77.4s) by RBM::input_files at line 822, avg 7.23ms/call # 9024 times (127ms+86.0s) by RBM::input_files at line 795, avg 9.54ms/call # 7950 times (107ms+62.9s) by RBM::input_files at line 849, avg 7.92ms/call # 7950 times (99.7ms+62.1s) by RBM::input_files at line 865, avg 7.82ms/call # 5967 times (99.0ms+26.8s) by RBM::input_files at line 858, avg 4.51ms/call # 5967 times (87.4ms+7.03s) by RBM::input_files at line 868, avg 1.19ms/call # 1992 times (44.6ms+16.6s) by RBM::input_file_id at line 749, avg 8.38ms/call # 1992 times (29.5ms+15.6s) by RBM::input_file_need_dl at line 718, avg 7.85ms/call # 6 times (33µs+4.68ms) by RBM::input_files at line 923, avg 786µs/call # 6 times (36µs+4.67ms) by RBM::input_file_need_dl at line 732, avg 785µs/call
my $t = sub {
792 project_config($project, $_[0], {$options ? %$options : (),
79351584806ms51584211ms %$input_file, $_[1] ? %{$_[1]} : ()});
# spent 354s making 51584 calls to RBM::project_config, avg 6.87ms/call, recursion: max depth 50, sum of overlapping time 354s
79429697110ms };
7952969758.9ms902486.1s if ($input_file->{enable} && !$t->('enable')) {
# spent 86.1s making 9024 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 9.54ms/call
796902470.0ms next;
797 }
7982067342.5ms if ($input_file->{target} || $input_file->{target_append}
799 || $input_file->{target_prepend}) {
800 $input_file = { %$input_file };
801 if (ref $input_file->{target} eq 'ARRAY') {
802 $input_file->{target} = process_template_opt($project,
803 $input_file->{target}, $options);
804 } else {
805 $input_file->{target} = $config->{run}{target};
806 }
807 if (ref $input_file->{target_prepend} eq 'ARRAY') {
808 $input_file->{target} = [ @{ process_template_opt($project,
809 $input_file->{target_prepend},
810 $options) },
811 @{$input_file->{target}} ];
812 }
813 if (ref $input_file->{target_append} eq 'ARRAY') {
814 $input_file->{target} = [ @{$input_file->{target}},
815 @{ process_template_opt($project,
816 $input_file->{target_append},
817 $options) } ];
818 }
819 }
8202067320.2ms if ($action eq 'getfnames') {
821147064.11ms my $getfnames_name;
8221470664.1ms1073077.5s if ($input_file->{name}) {
# spent 77.5s making 10730 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 7.23ms/call
823 $getfnames_name = $t->('name');
824 } else {
825397615.9ms $getfnames_name = "noname_$getfnames_noname";
8263976993µs $getfnames_noname++;
827 }
828
# spent 770s (212ms+770) within RBM::__ANON__[rbm/lib/RBM.pm:845] which was called 3976 times, avg 194ms/call: # 3976 times (212ms+770s) by RBM::config_p at line 94, avg 194ms/call
$res_getfnames{$getfnames_name} = sub {
82939765.42ms my ($project, $options) = @_;
83039761.68ms $options //= {};
83139766.11ms if ($input_file->{project}) {
83219844.87ms $options = {%$options};
83319842.98ms $options->{origin_project} = $project;
834 }
835
# spent 51.5s (94.8ms+51.4) within RBM::__ANON__[rbm/lib/RBM.pm:837] which was called 7944 times, avg 6.48ms/call: # 3976 times (49.7ms+22.9s) by RBM::__ANON__[rbm/lib/RBM.pm:845] at line 839, avg 5.78ms/call # 3968 times (45.1ms+28.4s) by RBM::__ANON__[rbm/lib/RBM.pm:845] at line 843, avg 7.18ms/call
my $t = sub {
8367944130ms79440s RBM::project_config($project, $_[0], { %$options, %$input_file })
# spent 51.4s making 7944 calls to RBM::project_config, avg 6.47ms/call, recursion: max depth 50, sum of overlapping time 51.4s
837397614.6ms };
83839762.82ms return $t->('filename') if $input_file->{filename};
839397613.5ms397623.0s my $url = $t->('URL');
# spent 23.0s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:837], avg 5.78ms/call
840397629.8ms1992151ms return basename($url) if $url;
# spent 151ms making 1992 calls to File::Basename::basename, avg 76µs/call
841 return RBM::project_step_config($t->('project'), 'filename',
842 {%$options, step => $t->('pkg_type'), %$input_file})
843198476.6ms5952732s if $input_file->{project};
# spent 718s making 1984 calls to RBM::project_step_config, avg 362ms/call, recursion: max depth 10, sum of overlapping time 14.7s # spent 28.5s making 3968 calls to RBM::__ANON__[rbm/lib/RBM.pm:837], avg 7.18ms/call
844 return undef;
84514706113ms };
8461470683.9ms next;
847 }
84859672.67ms my $proj_out_dir;
8495967125ms1590063.1s if ($input_file->{project}) {
# spent 63.0s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 7.92ms/call # spent 22.7s making 3975 calls to RBM::project_step_config, avg 5.70ms/call, recursion: max depth 11, sum of overlapping time 22.6s # spent 39.5ms making 3975 calls to RBM::rbm_path, avg 10µs/call
850 $proj_out_dir = rbm_path(project_step_config($t->('project'), 'output_dir',
851 { %$options, step => $t->('pkg_type'),
852 origin_project => $project, %$input_file }));
853 } else {
854199221.6ms398435.1ms $proj_out_dir = rbm_path(project_config($project, 'output_dir',
# spent 35.1ms making 1992 calls to RBM::rbm_path, avg 18µs/call # spent 11.0s making 1992 calls to RBM::project_config, avg 5.53ms/call, recursion: max depth 49, sum of overlapping time 11.0s
855 { %$options, %$input_file }));
856 }
857596721.8ms5967226ms create_dir($proj_out_dir);
# spent 226ms making 5967 calls to RBM::create_dir, avg 38µs/call
858596729.7ms596726.9s my $url = $t->('URL');
# spent 26.9s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 4.51ms/call
859596725.1ms1992159ms my $name = $input_file->{filename} ? $t->('filename') :
# spent 159ms making 1992 calls to File::Basename::basename, avg 80µs/call
860 $url ? basename($url) :
861 undef;
862 $name //= project_step_config($t->('project'), 'filename',
863 {%$options, step => $t->('pkg_type'),
864 origin_project => $project, %$input_file})
8655967126ms119251487s if $input_file->{project};
# spent 11146s making 3975 calls to RBM::project_step_config, avg 2.80s/call, recursion: max depth 11, sum of overlapping time 9722s # spent 62.2s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 7.82ms/call
86659673.58ms exit_error("Missing filename:\n" . pp($input_file)) unless $name;
867596732.8ms5967353ms my ($fname) = file_in_dir($name, $src_dir, $proj_out_dir);
# spent 353ms making 5967 calls to RBM::file_in_dir, avg 59µs/call
868596750.6ms119347.15s my $file_gpg_id = gpg_id($t->('file_gpg_id'));
# spent 7.12s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 1.19ms/call # spent 27.8ms making 5967 calls to RBM::gpg_id, avg 5µs/call
869596729.1ms5967216s if (input_file_need_dl($input_file, $t, $fname, $action)) {
# spent 216s making 5967 calls to RBM::input_file_need_dl, avg 36.2ms/call
870 if ($t->('content')) {
871 path("$proj_out_dir/$name")->spew_utf8($t->('content'));
872 } elsif ($t->('URL')) {
873 urlget($project, {%$options, %$input_file, filename => $name}, 1);
874 } elsif ($t->('exec')) {
875 my $exec_script = project_config($project, 'exec',
876 { $options ? %$options : (), %$input_file });
877 if (run_script($project, $exec_script,
878 sub { system(@_) }) != 0) {
879 exit_error "Error creating $name";
880 }
881 } elsif ($input_file->{project} && $t->('project')) {
882 my $p = $t->('project');
883 print "Building project $p - $name\n";
884 my $run_save = $config->{run};
885 $config->{run} = { target => $input_file->{target} };
886 $config->{run}{target} //= $run_save->{target};
887 build_pkg($p, {%$options, origin_project => $project,
888 %$input_file});
889 $config->{run} = $run_save;
890 print "Finished build of project $p - $name\n";
891 } else {
892 dd $input_file;
893 exit_error "Missing file $name";
894 }
895 ($fname) = file_in_dir($name, $src_dir, $proj_out_dir);
896 exit_error "Error getting file $name" unless $fname;
897 }
89859676.17ms if ($action eq 'input_files_id') {
899596137.9ms596116.8s $input_files_id .= input_file_id($input_file, $t, $fname, $name);
# spent 16.8s making 5961 calls to RBM::input_file_id, avg 2.82ms/call
90059613.35ms $input_files_id .= "\n";
901596151.9ms next;
902 }
90365µs if ($action eq 'getfpaths') {
904 push @res_getfpaths, $fname if $fname;
905 if ($file_gpg_id && $fname) {
906 my $sig_ext = $t->('sig_ext');
907 $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ];
908 foreach my $s (@$sig_ext) {
909 if (-f "$fname.$s") {
910 push @res_getfpaths, "$fname.$s";
911 last;
912 }
913 }
914 }
915 if ($input_file->{project} && $t->('project')) {
916 my $r = RBM::project_step_config($t->('project'), 'input_files_paths',
917 {%$options, step => $t->('pkg_type'), %$input_file});
918 push @res_getfpaths, @$r if @$r;
919 }
920 next;
921 }
92264µs exit_error "Missing file $name" unless $fname;
923617µs64.71ms if ($t->('sha256sum')
# spent 4.71ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 786µs/call
924 && $t->('sha256sum') ne sha256_hex(path($fname)->slurp_raw)) {
925 exit_error "Can't have sha256sum on directory: $fname" if -d $fname;
926 exit_error "Wrong sha256sum for $fname.\n" .
927 "Expected sha256sum: " . $t->('sha256sum');
928 }
92962µs if ($file_gpg_id) {
930 exit_error "Can't have gpg sig on directory: $fname" if -d $fname;
931 my $sig_ext = $t->('sig_ext');
932 $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ];
933 my $sig_file;
934 foreach my $s (@$sig_ext) {
935 if (-f "$fname.$s" && !$t->('refresh_input')) {
936 $sig_file = "$fname.$s";
937 last;
938 }
939 }
940 foreach my $s ($sig_file ? () : @$sig_ext) {
941 if ($url) {
942 my $f = { %$options, %$input_file,
943 'override.URL' => "$url.$s", filename => "$name.$s" };
944 if (urlget($project, $f, 0)) {
945 $sig_file = "$fname.$s";
946 last;
947 }
948 }
949 }
950 exit_error "No signature file for $name" unless $sig_file;
951 my $id = file_sign_id($project, { %$input_file,
952 filename_data => $fname, filename_sig => $sig_file });
953 print "File $name is signed with id $id\n" if $id;
954 if (!$id || !valid_id($id, $file_gpg_id)) {
955 exit_error "File $name is not signed with a valid key";
956 }
957 }
9586116µs674µs my $file_type = -d $fname ? 'directory' : 'file';
# spent 74µs making 6 calls to RBM::CORE:ftdir, avg 12µs/call
9596412µs6376µs print "Using $file_type $fname\n";
# spent 376µs making 6 calls to RBM::CORE:print, avg 63µs/call
9606128µs12500µs mkdir dirname("$dest_dir/$name");
# spent 448µs making 6 calls to File::Basename::dirname, avg 75µs/call # spent 51µs making 6 calls to RBM::CORE:mkdir, avg 9µs/call
9616123µs6606ms push @res_copy, recursive_copy($fname, $name, $dest_dir);
# spent 606ms making 6 calls to RBM::recursive_copy, avg 101ms/call
962 }
9635967187ms5967145ms chdir $old_cwd;
# spent 145ms making 5967 calls to RBM::CORE:chdir, avg 24µs/call
964596762.4ms199017.6ms RETURN_RES:
# spent 17.6ms making 1990 calls to Digest::SHA::sha256_hex, avg 9µs/call
965 return sha256_hex($input_files_id) if $action eq 'input_files_id';
96639773.14ms return @res_copy if $action eq 'copy';
967397639.6ms return \%res_getfnames if $action eq 'getfnames';
968 return \@res_getfpaths if $action eq 'getfpaths';
969}
970
971
# spent 59.0s (30.5ms+59.0) within RBM::system_log which was called: # once (30.5ms+59.0s) by RBM::__ANON__[rbm/lib/RBM.pm:1094] at line 1094
sub system_log {
97211µs my ($log_file, @args) = @_;
9731600ns return system(@args) if $log_file eq '-';
974130.4ms if (my $pid = fork) {
975159.0s159.0s waitpid($pid, 0);
# spent 59.0s making 1 call to RBM::CORE:waitpid
976165µs return ${^CHILD_ERROR_NATIVE};
977 }
978 exit_error "Could not open $log_file" unless open(STDOUT, '>>', $log_file);
979 open(STDERR, '>&', *STDOUT);
980 exec(@args);
981}
982
983
# spent 2205s (2.72ms+2205) within RBM::build_run which was called: # once (2.72ms+2205s) by RBM::build_pkg at line 1155
sub build_run {
98411µs my ($project, $script_name, $options) = @_;
98512µs my $old_step = $config->{step};
98611µs $config->{step} = $script_name;
9871400ns $options //= {};
9881800ns my $error;
98918µs33.20ms my $dest_dir = create_dir(rbm_path(project_config($project, 'output_dir', $options)));
# spent 3.15ms making 1 call to RBM::project_config # spent 36µs making 1 call to RBM::create_dir # spent 4µs making 1 call to RBM::rbm_path
99013µs14µs valid_project($project);
# spent 4µs making 1 call to RBM::valid_project
9911650µs2313µs $options = { %$options, build_id => Data::UUID->new->create_str };
# spent 198µs making 1 call to Data::UUID::create_str # spent 115µs making 1 call to Data::UUID::new
992110µs2313µs my $old_cwd = getcwd;
# spent 307µs making 1 call to Data::UUID::DESTROY # spent 6µs making 1 call to Cwd::getcwd
99312µs1885µs my $srcdir = project_config($project, 'build_srcdir', $options);
# spent 885µs making 1 call to RBM::project_config
9941400ns my $use_srcdir = $srcdir;
995115µs27.82ms my $tmpdir = File::Temp->newdir(get_tmp_dir($project, $options)
# spent 7.35ms making 1 call to RBM::get_tmp_dir # spent 468µs making 1 call to File::Temp::newdir
996 . '/rbm-XXXXX');
9971400ns my @cfiles;
9981900ns if ($use_srcdir) {
999 @cfiles = ($srcdir);
1000 } else {
100115µs126µs $srcdir = $tmpdir->dirname;
# spent 26µs making 1 call to File::Temp::Dir::dirname
100215µs1308ms my $tarfile = maketar($project, $options, $srcdir);
# spent 308ms making 1 call to RBM::maketar
10031900ns push @cfiles, $tarfile if $tarfile;
100417µs1845µs push @cfiles, copy_files($project, $srcdir);
# spent 845µs making 1 call to RBM::copy_files
100518µs1649s push @cfiles, input_files('copy', $project, $options, $srcdir);
# spent 649s making 1 call to RBM::input_files
1006 }
10071300ns my ($remote_tmp_src, $remote_tmp_dst, %build_script);
100812µs my @scripts = ('pre', $script_name, 'post');
100914µs my %scripts_root = ( pre => 1, post => 1);
101016µs1180ms if (project_config($project, "remote_exec", $options)) {
# spent 180ms making 1 call to RBM::project_config
101119µs1169ms my $cmd = project_config($project, "remote_start", {
# spent 169ms making 1 call to RBM::project_config
1012 %$options,
1013 remote_srcdir => $srcdir,
1014 });
10151600ns if ($cmd) {
101614µs16.80s my ($stdout, $stderr, $success, $exit_code)
# spent 6.80s making 1 call to RBM::run_script
1017 = run_script($project, $cmd, \&capture_exec);
10181600ns if (!$success) {
1019 $error = "Error starting remote:\n$stdout\n$stderr";
1020 goto EXIT;
1021 }
1022 }
102311µs foreach my $remote_tmp ($remote_tmp_src, $remote_tmp_dst) {
1024255µs4273ms $cmd = project_config($project, "remote_exec", {
# spent 273ms making 4 calls to RBM::project_config, avg 68.4ms/call
1025 %$options,
1026 exec_cmd => project_config($project,
1027 "remote_mktemp", $options) || 'mktemp -d -p /var/tmp',
1028 exec_name => 'mktemp',
1029 exec_as_root => 0,
1030 });
1031219µs2395ms my ($stdout, $stderr, $success, $exit_code)
# spent 395ms making 2 calls to RBM::run_script, avg 198ms/call
1032 = run_script($project, $cmd, \&capture_exec);
10332900ns if (!$success) {
1034 $error = "Error connecting to remote:\n$stdout\n$stderr";
1035 goto EXIT;
1036 }
1037270µs $remote_tmp = (split(/\r?\n/, $stdout))[0];
1038 }
103919µs my $o = {
1040 %$options,
1041 norec => { output_dir => $remote_tmp_dst },
1042 };
1043112µs foreach my $s (@scripts) {
1044314µs31482s $build_script{$s} = project_config($project, $s, $o);
# spent 1482s making 3 calls to RBM::project_config, avg 494s/call
1045 }
1046 } else {
1047 foreach my $s (@scripts) {
1048 $build_script{$s} = project_config($project, $s, $options);
1049 }
1050 }
10511800ns if (!$build_script{$script_name}) {
1052 $error = "Missing $script_name config";
1053 goto EXIT;
1054 }
105513µs @scripts = grep { $build_script{$_} } @scripts;
105611µs push @cfiles, @scripts unless $use_srcdir;
105711µs foreach my $s (@scripts) {
1058112µs2816µs path("$srcdir/$s")->spew_utf8($build_script{$s});
# spent 766µs making 1 call to Path::Tiny::spew_utf8 # spent 50µs making 1 call to Path::Tiny::path
1059113µs16µs chmod 0700, "$srcdir/$s";
# spent 6µs making 1 call to RBM::CORE:chmod
1060 }
106113µs111.3ms my $build_log = project_config($project, "build_log", $options);
# spent 11.3ms making 1 call to RBM::project_config
106211µs if ($build_log ne '-') {
106312µs114.3ms my $append = project_config($project, "build_log_append", $options);
# spent 14.3ms making 1 call to RBM::project_config
106413µs19µs $build_log = rbm_path($build_log);
# spent 9µs making 1 call to RBM::rbm_path
10651500ns unlink $build_log unless $append;
106619µs293µs make_path(dirname($build_log));
# spent 78µs making 1 call to File::Basename::dirname # spent 15µs making 1 call to File::Path::make_path
1067149µs my $now = localtime;
1068137µs2324µs path($build_log)->append_utf8("Starting build: $now\n");
# spent 278µs making 1 call to Path::Tiny::append_utf8 # spent 46µs making 1 call to Path::Tiny::path
1069149µs144µs print "Build log: $build_log\n";
# spent 44µs making 1 call to RBM::CORE:print
1070 }
1071112µs17µs chdir $srcdir;
# spent 7µs making 1 call to RBM::CORE:chdir
10721400ns my $res;
1073154µs if ($remote_tmp_src && $remote_tmp_dst) {
107412µs foreach my $file (@cfiles) {
10758967µs162.02s my $cmd = project_config($project, "remote_put", {
# spent 2.02s making 8 calls to RBM::project_config, avg 253ms/call # spent 709µs making 8 calls to File::Basename::dirname, avg 89µs/call
1076 %$options,
1077 put_src => "$srcdir/$file",
1078 put_dst => $remote_tmp_src . '/' . dirname($file),
1079 exec_name => 'put',
1080 exec_as_root => 0,
1081 });
1082162.41s164.90s
# spent 2.41s (788µs+2.41) within RBM::__ANON__[rbm/lib/RBM.pm:1082] which was called 8 times, avg 301ms/call: # 8 times (788µs+2.41s) by RBM::run_script at line 468, avg 301ms/call
if (run_script($project, $cmd, sub { system(@_) }) != 0) {
# spent 2.50s making 8 calls to RBM::run_script, avg 312ms/call # spent 2.41s making 8 calls to RBM::CORE:system, avg 301ms/call
1083 $error = "Error uploading $file";
1084 goto EXIT;
1085 }
1086 }
108711µs foreach my $s (@scripts) {
1088 my $cmd = project_config($project, "remote_exec", {
1089 %$options,
1090 exec_cmd => "cd $remote_tmp_src; ./$s",
1091 exec_name => $s,
1092196µs1218ms exec_as_root => $scripts_root{$s},
# spent 218ms making 1 call to RBM::project_config
1093 });
1094265µs2118s
# spent 59.0s (39µs+59.0) within RBM::__ANON__[rbm/lib/RBM.pm:1094] which was called: # once (39µs+59.0s) by RBM::run_script at line 468
if (run_script($project, $cmd, sub { system_log($build_log, @_) }) != 0) {
# spent 59.0s making 1 call to RBM::run_script # spent 59.0s making 1 call to RBM::system_log
1095 $error = "Error running $script_name";
1096 if (project_config($project, 'debug', $options)) {
1097 print STDERR $error, "\nOpening debug shell\n";
1098 print STDERR "Warning: build files will be removed when you exit this shell.\n";
1099 my $cmd = project_config($project, "remote_exec", {
1100 %$options,
1101 exec_cmd => "cd $remote_tmp_src; PS1='debug-$project\$ ' \${SHELL-/bin/bash}",
1102 exec_name => "debug-$s",
1103 exec_as_root => $scripts_root{$s},
1104 interactive => 1,
1105 });
1106 run_script($project, $cmd, sub { system(@_) });
1107 }
1108 goto EXIT;
1109 }
1110 }
1111186µs153.1ms my $cmd = project_config($project, "remote_get", {
# spent 53.1ms making 1 call to RBM::project_config
1112 %$options,
1113 get_src => $remote_tmp_dst,
1114 get_dst => $dest_dir,
1115 exec_name => 'get',
1116 exec_as_root => 0,
1117 });
1118260.2ms2134ms
# spent 60.1ms (87µs+60.0) within RBM::__ANON__[rbm/lib/RBM.pm:1118] which was called: # once (87µs+60.0ms) by RBM::run_script at line 468
if (run_script($project, $cmd, sub { system(@_) }) != 0) {
# spent 73.7ms making 1 call to RBM::run_script # spent 60.0ms making 1 call to RBM::CORE:system
1119 $error = "Error downloading build result";
1120 }
1121174µs2574ms run_script($project, project_config($project, "remote_exec", {
# spent 361ms making 1 call to RBM::run_script # spent 212ms making 1 call to RBM::project_config
1122 %$options,
1123 exec_cmd => "rm -Rf $remote_tmp_src $remote_tmp_dst",
1124 exec_name => 'clean',
1125 exec_as_root => 0,
1126 }), \&capture_exec);
1127 } else {
1128 foreach my $s (@scripts) {
1129 my $cmd = $scripts_root{$s} ? project_config($project, 'suexec',
1130 { suexec_cmd => "$srcdir/$s" }) : "$srcdir/$s";
1131 if (system_log($build_log, $cmd) != 0) {
1132 $error = "Error running $script_name";
1133 if (project_config($project, 'debug', $options)) {
1134 print STDERR $error, "\nOpening debug shell\n";
1135 print STDERR "Warning: build files will be removed when you exit this shell.\n";
1136 run_script($project, "PS1='debug-$project\$ ' \$SHELL", sub { system(@_) });
1137 }
1138 }
1139 }
1140 }
1141 EXIT:
1142136µs1240ms if (project_config($project, "remote_exec", $options)) {
# spent 240ms making 1 call to RBM::project_config
114316µs129.6ms my $cmd = project_config($project, "remote_finish", $options);
# spent 29.6ms making 1 call to RBM::project_config
11442815ms21.64s
# spent 815ms (114µs+815) within RBM::__ANON__[rbm/lib/RBM.pm:1144] which was called: # once (114µs+815ms) by RBM::run_script at line 468
if ($cmd && (run_script($project, $cmd, sub { system(@_) }) != 0)) {
# spent 827ms making 1 call to RBM::run_script # spent 815ms making 1 call to RBM::CORE:system
1145 $error ||= "Error finishing remote";
1146 }
1147 }
114816µs $config->{step} = $old_step;
1149112µs14µs chdir $old_cwd;
# spent 4µs making 1 call to RBM::CORE:chdir
11501110µs192.0ms exit_error $error if $error;
# spent 92.0ms making 1 call to File::Temp::Dir::DESTROY
1151}
1152
1153
# spent 2205s (23µs+2205) within RBM::build_pkg which was called: # once (23µs+2205s) by main::build_script at line 178 of /root/tor-browser-build/rbm/rbm
sub build_pkg {
11541900ns my ($project, $options) = @_;
1155118µs22205s build_run($project, project_config($project, 'pkg_type', $options), $options);
# spent 2205s making 1 call to RBM::build_run # spent 11.8ms making 1 call to RBM::project_config
1156}
1157
1158sub publish {
1159 my ($project) = @_;
1160 project_config($project, 'publish', { error_if_undef => 1 });
1161 my $publish_src_dir = project_config($project, 'publish_src_dir');
1162 if (!$publish_src_dir) {
1163 $publish_src_dir = File::Temp->newdir(get_tmp_dir($project)
1164 . '/rbm-XXXXXX');
1165 build_pkg($project, { norec => { output_dir => $publish_src_dir } });
1166 }
1167 build_run($project, 'publish', { build_srcdir => $publish_src_dir });
1168}
1169
117013µs1;
1171# vim: expandtab sw=4
 
# spent 358ms within RBM::CORE:chdir which was called 19884 times, avg 18µs/call: # 5967 times (145ms+0s) by RBM::input_files at line 963, avg 24µs/call # 5967 times (123ms+0s) by RBM::input_files at line 783, avg 21µs/call # 3974 times (40.2ms+0s) by RBM::git_clone_fetch_chdir at line 401, avg 10µs/call # 3973 times (49.1ms+0s) by RBM::execute at line 504, avg 12µs/call # once (7µs+0s) by RBM::build_run at line 1071 # once (4µs+0s) by RBM::build_run at line 1149 # once (4µs+0s) by RBM::maketar at line 599
sub RBM::CORE:chdir; # opcode
# spent 83µs within RBM::CORE:chmod which was called 16 times, avg 5µs/call: # 15 times (78µs+0s) by RBM::run_script at line 467, avg 5µs/call # once (6µs+0s) by RBM::build_run at line 1059
sub RBM::CORE:chmod; # opcode
# spent 279ms within RBM::CORE:ftdir which was called 9948 times, avg 28µs/call: # 9942 times (279ms+0s) by RBM::create_dir at line 369, avg 28µs/call # 6 times (74µs+0s) by RBM::input_files at line 958, avg 12µs/call
sub RBM::CORE:ftdir; # opcode
# spent 1.00ms within RBM::CORE:ftfile which was called 153 times, avg 7µs/call: # 144 times (906µs+0s) by RBM::load_config at line 54, avg 6µs/call # 6 times (20µs+0s) by RBM::recursive_copy at line 757, avg 3µs/call # once (38µs+0s) by RBM::load_system_config at line 62 # once (26µs+0s) by RBM::load_local_config at line 69 # once (14µs+0s) by RBM::find_config_file at line 73
sub RBM::CORE:ftfile; # opcode
# spent 241ms within RBM::CORE:ftis which was called 11934 times, avg 20µs/call: # 11934 times (241ms+0s) by RBM::file_in_dir at line 712, avg 20µs/call
sub RBM::CORE:ftis; # opcode
# spent 772µs within RBM::CORE:glob which was called: # once (772µs+0s) by RBM::load_config at line 53
sub RBM::CORE:glob; # opcode
# spent 1.31s within RBM::CORE:match which was called 2039154 times, avg 644ns/call: # 1405072 times (693ms+0s) by RBM::get_targets at line 125, avg 493ns/call # 630064 times (608ms+0s) by RBM::rbm_path at line 86, avg 965ns/call # 3988 times (12.5ms+0s) by RBM::run_script at line 464, avg 3µs/call # 15 times (333µ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 22µs/call # 15 times (42µ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 3µs/call
sub RBM::CORE:match; # opcode
# spent 51µs within RBM::CORE:mkdir which was called 6 times, avg 9µs/call: # 6 times (51µs+0s) by RBM::input_files at line 960, avg 9µs/call
sub RBM::CORE:mkdir; # opcode
# spent 461µs within RBM::CORE:print which was called 8 times, avg 58µs/call: # 6 times (376µs+0s) by RBM::input_files at line 959, avg 63µs/call # once (44µs+0s) by RBM::build_run at line 1069 # once (41µs+0s) by RBM::maketar at line 598
sub RBM::CORE:print; # opcode
# spent 2.29s within RBM::CORE:regcomp which was called 1405072 times, avg 2µs/call: # 1405072 times (2.29s+0s) by RBM::get_targets at line 125, avg 2µs/call
sub RBM::CORE:regcomp; # opcode
# spent 3.36s within RBM::CORE:system which was called 12 times, avg 280ms/call: # 8 times (2.41s+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1082] at line 1082, avg 301ms/call # once (815ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1144] at line 1144 # once (64.4ms+0s) by RBM::maketar at line 592 # once (60.0ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1118] at line 1118 # once (15.1ms+0s) by RBM::maketar at line 556
sub RBM::CORE:system; # opcode
# spent 1.11ms within RBM::CORE:unlink which was called 15 times, avg 74µs/call: # 15 times (1.11ms+0s) by RBM::run_script at line 469, avg 74µ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 597
sub RBM::CORE:utime; # opcode
# spent 59.0s within RBM::CORE:waitpid which was called: # once (59.0s+0s) by RBM::system_log at line 975
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