Filename | /root/tor-browser-build/rbm/lib/RBM.pm |
Statements | Executed 1112110763 statements in 1056s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
89245624 | 7 | 1 | 279s | 2130s | config_p (recurses: max depth 13, inclusive time 10687s) | RBM::
2810144 | 2 | 1 | 195s | 336s | get_target (recurses: max depth 1, inclusive time 160s) | RBM::
702536 | 1 | 1 | 175s | 2131s | config (recurses: max depth 13, inclusive time 11104s) | RBM::
1 | 1 | 1 | 59.0s | 59.0s | CORE:waitpid (opcode) | RBM::
383161 | 2 | 1 | 47.2s | 2134s | process_template (recurses: max depth 40, inclusive time 39501s) | RBM::
1479423 | 52 | 2 | 47.1s | 2134s | project_config (recurses: max depth 55, inclusive time 52928s) | RBM::
702536 | 1 | 1 | 22.4s | 362s | get_targets | RBM::
702536 | 1 | 1 | 21.6s | 38.2s | get_step | RBM::
630064 | 11 | 1 | 4.71s | 5.32s | rbm_path | RBM::
505452 | 1 | 1 | 4.54s | 170s | notmpl | RBM::
12 | 5 | 1 | 3.36s | 3.36s | CORE:system (opcode) | RBM::
1405072 | 1 | 1 | 2.29s | 2.29s | CORE:regcomp (opcode) | RBM::
5967 | 3 | 2 | 2.02s | 2127s | input_files (recurses: max depth 11, inclusive time 9631s) | RBM::
868703 | 1 | 1 | 1.94s | 1.94s | confkey_str | RBM::
180865 | 54 | 4 | 1.39s | 39779s | __ANON__[rbm/lib/RBM.pm:640] | RBM::
2039154 | 5 | 2 | 1.31s | 1.31s | CORE:match (opcode) | RBM::
702536 | 1 | 1 | 1.11s | 1.11s | as_array | RBM::
51584 | 10 | 1 | 745ms | 355s | __ANON__[rbm/lib/RBM.pm:794] | RBM::
29843 | 4 | 1 | 612ms | 2128s | project_step_config (recurses: max depth 12, inclusive time 9875s) | RBM::
19884 | 7 | 1 | 358ms | 358ms | CORE:chdir (opcode) | RBM::
3973 | 2 | 2 | 328ms | 273s | execute | RBM::
9948 | 2 | 1 | 279ms | 279ms | CORE:ftdir (opcode) | RBM::
3974 | 2 | 1 | 266ms | 108s | git_clone_fetch_chdir | RBM::
11934 | 1 | 1 | 241ms | 241ms | CORE:ftis (opcode) | RBM::
5967 | 1 | 1 | 230ms | 216s | input_file_need_dl | RBM::
19909 | 8 | 2 | 225ms | 117s | __ANON__[rbm/lib/RBM.pm:645] | RBM::
3974 | 1 | 1 | 212ms | 91.3s | git_need_fetch | RBM::
3976 | 1 | 1 | 212ms | 770s | __ANON__[rbm/lib/RBM.pm:845] | RBM::
3988 | 8 | 1 | 186ms | 153s | run_script | RBM::
19910 | 1 | 1 | 155ms | 27.6s | __ANON__[rbm/lib/RBM.pm:650] | RBM::
5967 | 1 | 1 | 112ms | 353ms | file_in_dir | RBM::
5961 | 1 | 1 | 99.1ms | 16.8s | input_file_id | RBM::
4038 | 6 | 2 | 95.2ms | 479ms | __ANON__[rbm/lib/RBM.pm:655] | RBM::
7944 | 2 | 1 | 94.8ms | 51.5s | __ANON__[rbm/lib/RBM.pm:837] | RBM::
9942 | 3 | 1 | 80.8ms | 360ms | create_dir | RBM::
1 | 1 | 1 | 30.5ms | 59.0s | system_log | RBM::
2977 | 1 | 1 | 28.0ms | 203s | __ANON__[rbm/lib/RBM.pm:648] | RBM::
5969 | 3 | 1 | 27.8ms | 27.8ms | gpg_id | RBM::
1 | 1 | 1 | 9.75ms | 28.3ms | BEGIN@5 | RBM::
1 | 1 | 1 | 5.61ms | 8.89ms | BEGIN@14 | RBM::
1 | 1 | 1 | 4.04ms | 4.47ms | BEGIN@15 | RBM::
1 | 1 | 1 | 4.03ms | 4.68ms | BEGIN@23 | RBM::
1 | 1 | 1 | 3.91ms | 5.27ms | BEGIN@21 | RBM::
1 | 1 | 1 | 3.25ms | 13.7ms | BEGIN@6 | RBM::
1 | 1 | 1 | 3.01ms | 7.43ms | BEGIN@8 | RBM::
1 | 1 | 1 | 2.92ms | 5.06ms | BEGIN@22 | RBM::
144 | 2 | 1 | 2.78ms | 49.0ms | load_config_file | RBM::
1 | 1 | 1 | 2.72ms | 2205s | build_run | RBM::
1 | 1 | 1 | 2.19ms | 4.10ms | BEGIN@11 | RBM::
1 | 1 | 1 | 2.15ms | 24.6ms | BEGIN@9 | RBM::
1 | 1 | 1 | 2.02ms | 2.32ms | BEGIN@20 | RBM::
1 | 1 | 1 | 2.02ms | 12.1ms | BEGIN@12 | RBM::
1 | 1 | 1 | 1.57ms | 1.87ms | BEGIN@19 | RBM::
1 | 1 | 1 | 1.38ms | 1.49ms | BEGIN@18 | RBM::
1 | 1 | 1 | 1.20ms | 1.23ms | BEGIN@24 | RBM::
15 | 1 | 1 | 1.11ms | 1.11ms | CORE:unlink (opcode) | RBM::
153 | 5 | 1 | 1.00ms | 1.00ms | CORE:ftfile (opcode) | RBM::
1 | 1 | 1 | 930µs | 55.4ms | load_config | RBM::
8 | 1 | 1 | 788µs | 2.41s | __ANON__[rbm/lib/RBM.pm:1082] | RBM::
1 | 1 | 1 | 772µs | 772µs | CORE:glob (opcode) | RBM::
1 | 1 | 1 | 600µs | 859µs | BEGIN@53 | RBM::
8 | 3 | 1 | 461µs | 461µs | CORE:print (opcode) | RBM::
17 | 3 | 2 | 376µs | 172ms | get_tmp_dir | RBM::
1 | 1 | 1 | 336µs | 308ms | maketar | RBM::
1 | 1 | 1 | 114µs | 815ms | __ANON__[rbm/lib/RBM.pm:1144] | RBM::
6 | 1 | 1 | 95µs | 606ms | recursive_copy | RBM::
1 | 1 | 1 | 87µs | 60.1ms | __ANON__[rbm/lib/RBM.pm:1118] | RBM::
16 | 2 | 1 | 83µs | 83µs | CORE:chmod (opcode) | RBM::
1 | 1 | 1 | 57µs | 57µs | set_default_env | RBM::
1 | 1 | 1 | 52µs | 52µs | CORE:utime (opcode) | RBM::
6 | 1 | 1 | 51µs | 51µs | CORE:mkdir (opcode) | RBM::
1 | 1 | 1 | 39µs | 59.0s | __ANON__[rbm/lib/RBM.pm:1094] | RBM::
1 | 1 | 1 | 23µs | 2205s | build_pkg | RBM::
1 | 1 | 1 | 18µs | 47µs | find_config_file | RBM::
1 | 1 | 1 | 17µs | 4.81ms | load_local_config | RBM::
1 | 1 | 1 | 15µs | 57.1ms | load_system_config | RBM::
1 | 1 | 1 | 15µs | 30µs | BEGIN@3 | RBM::
1 | 1 | 1 | 12µs | 845µs | copy_files | RBM::
1 | 1 | 1 | 10µs | 37µs | BEGIN@17 | RBM::
2 | 2 | 1 | 10µs | 10µs | valid_project | RBM::
1 | 1 | 1 | 9µs | 44µs | BEGIN@7 | RBM::
1 | 1 | 1 | 8µs | 27µs | BEGIN@16 | RBM::
1 | 1 | 1 | 8µs | 41µs | BEGIN@10 | RBM::
1 | 1 | 1 | 6µs | 53µs | BEGIN@13 | RBM::
1 | 1 | 1 | 5µs | 6µs | BEGIN@4 | RBM::
1 | 1 | 1 | 1µs | 1µs | __ANON__ (xsub) | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:1106] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:1136] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:698] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:878] | RBM::
0 | 0 | 0 | 0s | 0s | exit_error | RBM::
0 | 0 | 0 | 0s | 0s | file_sign_id | RBM::
0 | 0 | 0 | 0s | 0s | git_commit_sign_id | RBM::
0 | 0 | 0 | 0s | 0s | git_get_signed_tagname | RBM::
0 | 0 | 0 | 0s | 0s | git_tag_sign_id | RBM::
0 | 0 | 0 | 0s | 0s | gpg_get_fingerprint | RBM::
0 | 0 | 0 | 0s | 0s | hg_clone_fetch_chdir | RBM::
0 | 0 | 0 | 0s | 0s | hg_need_fetch | RBM::
0 | 0 | 0 | 0s | 0s | input_file_id_hash | RBM::
0 | 0 | 0 | 0s | 0s | is_url | RBM::
0 | 0 | 0 | 0s | 0s | process_template_opt | RBM::
0 | 0 | 0 | 0s | 0s | projectslist | RBM::
0 | 0 | 0 | 0s | 0s | publish | RBM::
0 | 0 | 0 | 0s | 0s | rpmspec | RBM::
0 | 0 | 0 | 0s | 0s | set_git_gpg_wrapper | RBM::
0 | 0 | 0 | 0s | 0s | sha256file | RBM::
0 | 0 | 0 | 0s | 0s | unset_git_gpg_wrapper | RBM::
0 | 0 | 0 | 0s | 0s | urlget | RBM::
0 | 0 | 0 | 0s | 0s | valid_id | RBM::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package RBM; | ||||
2 | |||||
3 | 2 | 21µs | 2 | 45µ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 # spent 30µs making 1 call to RBM::BEGIN@3
# spent 15µs making 1 call to warnings::import |
4 | 2 | 20µs | 2 | 8µ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 # spent 6µs making 1 call to RBM::BEGIN@4
# spent 2µs making 1 call to strict::import |
5 | 2 | 1.50ms | 2 | 28.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 # spent 28.3ms making 1 call to RBM::BEGIN@5
# spent 38µs making 1 call to Exporter::import |
6 | 2 | 133µs | 2 | 13.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 # spent 13.7ms making 1 call to RBM::BEGIN@6
# spent 115µs making 1 call to Exporter::import |
7 | 2 | 28µs | 2 | 80µ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 # spent 44µs making 1 call to RBM::BEGIN@7
# spent 35µs making 1 call to Exporter::import |
8 | 2 | 1.48ms | 2 | 7.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 # spent 7.43ms making 1 call to RBM::BEGIN@8
# spent 33µs making 1 call to Exporter::import |
9 | 2 | 1.09ms | 2 | 24.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 # spent 24.6ms making 1 call to RBM::BEGIN@9
# spent 1µs making 1 call to RBM::__ANON__ |
10 | 2 | 23µs | 2 | 75µ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 # spent 41µs making 1 call to RBM::BEGIN@10
# spent 34µs making 1 call to Exporter::import |
11 | 2 | 165µs | 2 | 4.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 # spent 4.10ms making 1 call to RBM::BEGIN@11
# spent 18µs making 1 call to Exporter::import |
12 | 2 | 695µs | 2 | 12.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 # spent 12.1ms making 1 call to RBM::BEGIN@12
# spent 30µs making 1 call to Exporter::import |
13 | 2 | 21µs | 2 | 99µ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 # spent 53µs making 1 call to RBM::BEGIN@13
# spent 46µs making 1 call to Exporter::import |
14 | 2 | 3.65ms | 2 | 8.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 # spent 8.89ms making 1 call to RBM::BEGIN@14
# spent 49µs making 1 call to Exporter::import |
15 | 2 | 1.11ms | 2 | 4.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 # spent 4.47ms making 1 call to RBM::BEGIN@15
# spent 51µs making 1 call to Exporter::import |
16 | 2 | 22µs | 2 | 45µ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 # spent 27µs making 1 call to RBM::BEGIN@16
# spent 18µs making 1 call to Exporter::import |
17 | 2 | 22µs | 2 | 63µ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 # spent 37µs making 1 call to RBM::BEGIN@17
# spent 27µs making 1 call to Exporter::import |
18 | 2 | 773µs | 2 | 1.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 # spent 1.49ms making 1 call to RBM::BEGIN@18
# spent 39µs making 1 call to Exporter::import |
19 | 2 | 1.05ms | 2 | 1.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 # spent 1.87ms making 1 call to RBM::BEGIN@19
# spent 120µs making 1 call to Exporter::import |
20 | 2 | 111µs | 2 | 2.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 # spent 2.32ms making 1 call to RBM::BEGIN@20
# spent 68µs making 1 call to Exporter::import |
21 | 2 | 1.11ms | 2 | 5.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 # spent 5.27ms making 1 call to RBM::BEGIN@21
# spent 94µs making 1 call to Exporter::import |
22 | 2 | 658µs | 2 | 5.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 # spent 5.06ms making 1 call to RBM::BEGIN@22
# spent 41µs making 1 call to Exporter::import |
23 | 2 | 591µs | 2 | 4.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 # spent 4.68ms making 1 call to RBM::BEGIN@23
# spent 67µs making 1 call to Exporter::import |
24 | 2 | 1.39ms | 2 | 1.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 # spent 1.23ms making 1 call to RBM::BEGIN@24
# spent 35µs making 1 call to feature::import |
25 | |||||
26 | our $config; | ||||
27 | |||||
28 | sub load_config_file { | ||||
29 | 144 | 44µs | my $res = {}; | ||
30 | 144 | 20µs | my @conf; | ||
31 | eval { | ||||
32 | 144 | 240µs | 144 | 46.1ms | @conf = LoadFile($_[0]); # spent 46.1ms making 144 calls to YAML::XS::LoadFile, avg 320µs/call |
33 | 144 | 84µs | } or do { | ||
34 | exit_error("Error reading file $_[0] :\n" . $@); | ||||
35 | }; | ||||
36 | 144 | 66µs | foreach my $c (@conf) { | ||
37 | 145 | 63µs | local $@ = ''; | ||
38 | 145 | 589µs | $res = { %$res, %$c } if ref $c eq 'HASH'; | ||
39 | 145 | 97µ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. | ||
40 | 145 | 80µs | exit_error("Error executing perl config from $_[0] :\n" . $@) if $@; | ||
41 | } | ||||
42 | 144 | 326µ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 | ||||
46 | 1 | 3µs | 1 | 47µs | my $config_file = shift // find_config_file(); # spent 47µs making 1 call to RBM::find_config_file |
47 | 1 | 4µs | 1 | 3.00ms | $config = load_config_file($config_file); # spent 3.00ms making 1 call to RBM::load_config_file |
48 | 1 | 2µs | $config->{default} = \%default_config; | ||
49 | 1 | 4µs | 1 | 58µs | $config->{basedir} = dirname($config_file); # spent 58µs making 1 call to File::Basename::dirname |
50 | 1 | 1µs | $config->{step} = 'rbm_init'; | ||
51 | 1 | 2µs | $config->{opt} = {}; | ||
52 | 1 | 3µs | my $pdir = $config->{projects_dir} || $config->{default}{projects_dir}; | ||
53 | 3 | 9.32ms | 3 | 1.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 # 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 |
54 | 144 | 1.18ms | 144 | 906µs | next unless -f "$p/config"; # spent 906µs making 144 calls to RBM::CORE:ftfile, avg 6µs/call |
55 | 143 | 643µs | 286 | 49.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 | ||||
60 | 1 | 1µs | my ($project) = @_; | ||
61 | 1 | 6µs | 1 | 57.1ms | my $cfile = project_config($project ? $project : 'undef', 'sysconf_file'); # spent 57.1ms making 1 call to RBM::project_config |
62 | 1 | 48µs | 1 | 38µ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 | ||||
66 | 1 | 1µs | my ($project) = @_; | ||
67 | 1 | 4µs | 1 | 4.77ms | my $cfile = project_config($project ? $project : 'undef', 'localconf_file'); # spent 4.77ms making 1 call to RBM::project_config |
68 | 1 | 2µs | 1 | 3µs | $cfile = rbm_path($cfile); # spent 3µs making 1 call to RBM::rbm_path |
69 | 1 | 34µs | 1 | 26µ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 | ||||
73 | 1 | 49µs | 2 | 29µ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 | ||||
80 | 1 | 57µ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 | ||||
84 | 630064 | 320ms | my ($path, $basedir) = @_; | ||
85 | 630064 | 553ms | $basedir //= $config->{basedir}; | ||
86 | 630064 | 6.15s | 630064 | 608ms | 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 | ||||
90 | 89245624 | 53.4s | my ($c, $project, $options, @q) = @_; | ||
91 | 89245624 | 13.5s | foreach my $p (@q) { | ||
92 | 212152625 | 37.5s | return undef unless ref $c eq 'HASH'; | ||
93 | 212152625 | 294s | return undef unless defined $c->{$p}; | ||
94 | 126805773 | 66.3s | 35882 | 3696s | $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 | } | ||||
96 | 3898772 | 11.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 | ||||
100 | 702536 | 2.81s | ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ]; | ||
101 | } | ||||
102 | |||||
103 | sub get_target { | ||||
104 | 2810144 | 1.23s | my ($project, $options, $paths, $target) = @_; | ||
105 | 2810144 | 368ms | my @res; | ||
106 | 2810144 | 1.19s | foreach my $path (@$paths) { | ||
107 | 22481152 | 33.0s | foreach my $step ([ 'steps', $config->{step} ], []) { | ||
108 | 44962304 | 38.5s | 44962304 | 251ms | 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); | ||||
110 | 44962304 | 7.91s | next unless $z; | ||
111 | 3236390 | 1.09s | if (ref $z eq 'HASH') { | ||
112 | 2533854 | 1.34s | push @res, $target unless grep { $_ eq $target } @res; | ||
113 | 2533854 | 630ms | next; | ||
114 | } | ||||
115 | 702536 | 789ms | my @z = ref $z eq 'ARRAY' ? (@{$z}) : ($z); | ||
116 | 3512680 | 3.59s | 1405072 | 0s | 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 | } | ||||
119 | 2810144 | 9.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 | ||||
123 | 702536 | 359ms | my ($project, $options, $paths) = @_; | ||
124 | 702536 | 1.89s | 702536 | 1.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 |
125 | 2107608 | 13.5s | 2810144 | 2.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 |
126 | 3512680 | 6.27s | 1405072 | 336s | 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 | ||||
130 | 702536 | 425ms | my ($project, $options, $step, $paths) = @_; | ||
131 | 702536 | 1.48s | foreach my $path (@$paths) { | ||
132 | 5620288 | 4.78s | 5620288 | 27.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 |
133 | 5620288 | 1.05s | next unless $z; | ||
134 | return $step if ref $z; | ||||
135 | return get_step($project, $options, $z, $paths); | ||||
136 | } | ||||
137 | 702536 | 2.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 | ||||
141 | 702536 | 318ms | my $project = shift; | ||
142 | 702536 | 204ms | my $name = shift; | ||
143 | 702536 | 206ms | my $options = shift; | ||
144 | 702536 | 120ms | my $res; | ||
145 | 702536 | 1.94s | 702536 | 362s | my @targets = @{get_targets($project, $options, \@_)}; # spent 362s making 702536 calls to RBM::get_targets, avg 515µs/call |
146 | 702536 | 1.69s | 702536 | 38.2s | my @step = ('steps', get_step($project, $options, $config->{step}, \@_)); # spent 38.2s making 702536 calls to RBM::get_step, avg 54µs/call |
147 | 702536 | 343ms | my $as_array = $options->{as_array}; | ||
148 | 702536 | 389ms | foreach my $path (@_) { | ||
149 | 4364284 | 498ms | my @l; | ||
150 | 4364284 | 5.63s | 3774640 | 15.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; | ||||
152 | 4364284 | 1.26s | if (!$as_array) { | ||
153 | 4364284 | 1.92s | @l = grep { defined $_ } @l; | ||
154 | 4364284 | 586ms | return $l[0] if @l; | ||
155 | } | ||||
156 | # 1st priority: targets + step matching | ||||
157 | 4364284 | 1.46s | foreach my $t (@targets) { | ||
158 | 13092852 | 12.3s | 13092852 | 71.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 |
159 | 13092852 | 6.22s | if (!$as_array) { | ||
160 | 13092852 | 5.03s | @l = grep { defined $_ } @l; | ||
161 | 13092852 | 1.49s | return $l[0] if @l; | ||
162 | } | ||||
163 | } | ||||
164 | # 2nd priority: step maching | ||||
165 | 4364284 | 4.13s | 4364284 | 21.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 |
166 | 4364284 | 1.15s | if (!$as_array) { | ||
167 | 4364284 | 1.91s | @l = grep { defined $_ } @l; | ||
168 | 4364284 | 466ms | return $l[0] if @l; | ||
169 | } | ||||
170 | # 3rd priority: target matching | ||||
171 | 4364284 | 1.37s | foreach my $t (@targets) { | ||
172 | 13090862 | 11.7s | 13090862 | 68.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 |
173 | 13090862 | 6.04s | if (!$as_array) { | ||
174 | 13090862 | 4.95s | @l = grep { defined $_ } @l; | ||
175 | 13090862 | 1.50s | return $l[0] if @l; | ||
176 | } | ||||
177 | } | ||||
178 | # last priority: no target and no step matching | ||||
179 | 4340394 | 4.03s | 4340394 | 2130s | 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 |
180 | 4340394 | 1.07s | if (!$as_array) { | ||
181 | 4340394 | 1.95s | @l = grep { defined $_ } @l; | ||
182 | 4340394 | 3.36s | return $l[0] if @l; | ||
183 | } | ||||
184 | 3701902 | 824ms | @l = grep { defined $_ } @l; | ||
185 | 3701902 | 1.64s | push @$res, @l if @l; | ||
186 | } | ||||
187 | 40154 | 176ms | 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 | ||||
191 | 505452 | 305ms | my ($name, $project) = @_; | ||
192 | 505452 | 264ms | return 1 if $name eq 'notmpl'; | ||
193 | my @n = (@{$config->{default}{notmpl}}, | ||||
194 | 505452 | 1.51s | 505452 | 0s | @{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 |
195 | 505452 | 2.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 | ||||
199 | 868703 | 3.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 | ||||
203 | 1479423 | 996ms | my ($project, $name, $options) = @_; | ||
204 | CORE::state $cache; | ||||
205 | 1479423 | 268ms | my $res; | ||
206 | 1479423 | 805ms | my $error_if_undef = $options->{error_if_undef}; | ||
207 | 1479423 | 387ms | my $cache_save = $cache; | ||
208 | 1479423 | 746ms | if ($options) { | ||
209 | 1479423 | 2.35s | $options = {%$options, error_if_undef => 0}; | ||
210 | 1479423 | 3.35s | my %ignore_options = map { $_ => 1 } qw(error_if_undef step); | ||
211 | 1479423 | 2.62s | $cache = {} if grep { !$ignore_options{$_} } keys %$options; | ||
212 | } | ||||
213 | 1479423 | 812ms | my $name_str = ref $name eq 'ARRAY' ? join '/', @$name : $name; | ||
214 | 1479423 | 789ms | my $step = $config->{step}; | ||
215 | 1479423 | 1.44s | if (exists $cache->{$project}{$step}{$name_str}) { | ||
216 | 776887 | 477ms | $res = $cache->{$project}{$step}{$name_str}; | ||
217 | 776887 | 1.97s | goto FINISH; | ||
218 | } | ||||
219 | 702536 | 1.47s | $name = [ split '/', $name ] unless ref $name eq 'ARRAY'; | ||
220 | 702536 | 160ms | goto FINISH unless @$name; | ||
221 | 702536 | 335ms | my $opt_save = $config->{opt}; | ||
222 | 702536 | 5.72s | $config->{opt} = { %{$config->{opt}}, %$options } if $options; | ||
223 | 702536 | 3.70s | 702536 | 2131s | $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']); | ||||
226 | 702536 | 3.86s | 1737406 | 2306s | 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 | } | ||||
231 | 702536 | 1.85s | $cache->{$project}{$step}{$name_str} = $res; | ||
232 | 702536 | 2.69s | $config->{opt} = $opt_save; | ||
233 | 1479423 | 718ms | FINISH: | ||
234 | $cache = $cache_save; | ||||
235 | 1479423 | 412ms | 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 | } | ||||
241 | 1479423 | 8.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 | ||||
245 | 29843 | 38.7ms | my $run_save = $config->{run}; | ||
246 | 29843 | 33.2ms | my $step_save = $config->{step}; | ||
247 | 29843 | 40.0ms | if ($_[2] && $_[2]->{step}) { | ||
248 | $config->{step} = $_[2]->{step}; | ||||
249 | } | ||||
250 | 29843 | 57.0ms | $config->{run} = { target => $_[2]->{target} }; | ||
251 | 29843 | 52.3ms | $config->{run}{target} //= $run_save->{target}; | ||
252 | 29843 | 73.6ms | 29843 | 648s | 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 |
253 | 29843 | 56.7ms | $config->{run} = $run_save; | ||
254 | 29843 | 28.4ms | $config->{step} = $step_save; | ||
255 | 29843 | 180ms | return $res; | ||
256 | } | ||||
257 | |||||
258 | sub 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 | ||||
264 | 17 | 15µs | my ($project, $options) = @_; | ||
265 | 17 | 51µs | 17 | 166ms | 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 |
266 | 17 | 103µs | 17 | 336µs | make_path($tmp_dir); # spent 336µs making 17 calls to File::Path::make_path, avg 20µs/call |
267 | 17 | 166µs | return $tmp_dir; | ||
268 | } | ||||
269 | |||||
270 | sub 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 | |||||
281 | sub unset_git_gpg_wrapper { | ||||
282 | unlink $_[0]; | ||||
283 | system('git', 'config', '--unset', 'gpg.program') == 0 | ||||
284 | || exit_error 'Error unsetting gpg.program'; | ||||
285 | } | ||||
286 | |||||
287 | sub 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 | |||||
298 | sub 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 | |||||
311 | sub 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 | |||||
321 | sub 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 | |||||
332 | sub 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 | |||||
346 | sub 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 | sub valid_project { | ||||
362 | 2 | 2µs | my ($project) = @_; | ||
363 | 2 | 9µ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 | ||||
368 | 9942 | 8.60ms | my ($directory) = @_; | ||
369 | 9942 | 369ms | 9942 | 279ms | 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 | ||||
376 | 3974 | 8.41ms | my ($project, $options) = @_; | ||
377 | 3974 | 6.39ms | return 0 if $config->{projects}{$project}{fetched}; | ||
378 | 3974 | 10.6ms | 3974 | 12.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 |
379 | 3974 | 5.45ms | if ($fetch eq 'if_needed') { | ||
380 | 3974 | 21.6ms | 3974 | 5.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"; | ||||
382 | 3974 | 35.2ms | 3974 | 79.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}"); | ||||
384 | 3974 | 54.1ms | return !$success; | ||
385 | } | ||||
386 | return $fetch; | ||||
387 | } | ||||
388 | |||||
389 | sub git_clone_fetch_chdir { | ||||
390 | 3974 | 6.13ms | my ($project, $options) = @_; | ||
391 | 3974 | 28.5ms | 11922 | 179ms | 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))); | ||||
393 | 3974 | 11.4ms | 3974 | 5.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"; | ||||
395 | 3974 | 5.10ms | my @clone_submod = (); | ||
396 | 3974 | 3.76ms | my @fetch_submod = (); | ||
397 | 3974 | 8.08ms | 3974 | 809µ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 | } | ||||
401 | 3974 | 94.6ms | 7948 | 69.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 | } | ||||
408 | 3974 | 54.7ms | 3974 | 91.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 | |||||
426 | sub 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 | |||||
439 | sub 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 | ||||
461 | 3988 | 34.5ms | my ($project, $cmd, $f) = @_; | ||
462 | 3988 | 2.37ms | $f //= \&capture_exec; | ||
463 | 3988 | 2.56ms | my @res; | ||
464 | 3988 | 39.9ms | 3988 | 12.5ms | if ($cmd =~ m/^#/) { # spent 12.5ms making 3988 calls to RBM::CORE:match, avg 3µs/call |
465 | 15 | 369µs | 30 | 167ms | 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 |
466 | 15 | 166µs | 30 | 11.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 |
467 | 15 | 151µs | 15 | 78µs | chmod 0700, $tmp; # spent 78µs making 15 calls to RBM::CORE:chmod, avg 5µs/call |
468 | 15 | 308µs | 15 | 69.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] |
469 | 15 | 1.30ms | 15 | 1.11ms | unlink $tmp; # spent 1.11ms making 15 calls to RBM::CORE:unlink, avg 74µs/call |
470 | } else { | ||||
471 | 3973 | 43.5ms | 3973 | 82.5s | @res = $f->($cmd); # spent 82.5s making 3973 calls to IO::CaptureOutput::capture_exec, avg 20.8ms/call |
472 | } | ||||
473 | 3988 | 61.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 | ||||
477 | 3973 | 8.60ms | my ($project, $cmd, $options) = @_; | ||
478 | 3973 | 107ms | 3973 | 65.7ms | my $old_cwd = getcwd; # spent 65.7ms making 3973 calls to Cwd::getcwd, avg 17µs/call |
479 | 3973 | 13.6ms | 3973 | 0s | 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 |
480 | 3973 | 8.15ms | 3973 | 0s | 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"; | ||||
482 | 3973 | 15.8ms | 3973 | 108s | git_clone_fetch_chdir($project, $options); # spent 108s making 3973 calls to RBM::git_clone_fetch_chdir, avg 27.1ms/call |
483 | 3973 | 25.5ms | 3973 | 81.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); | ||||
485 | 3973 | 2.55ms | exit_error "Cannot checkout $git_hash:\n$stderr" unless $success; | ||
486 | 3973 | 45.8ms | 3973 | 0s | 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 | } | ||||
502 | 3973 | 28.7ms | 3973 | 82.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); | ||||
504 | 3973 | 69.6ms | 3973 | 49.1ms | chdir($old_cwd); # spent 49.1ms making 3973 calls to RBM::CORE:chdir, avg 12µs/call |
505 | 3973 | 9.56ms | chomp $stdout; | ||
506 | 3973 | 61.4ms | return $success ? $stdout : undef; | ||
507 | } | ||||
508 | |||||
509 | sub gpg_id { | ||||
510 | 5969 | 5.04ms | my ($id) = @_; | ||
511 | 5969 | 30.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 | ||||
519 | 1 | 900ns | my ($project, $options, $dest_dir) = @_; | ||
520 | 1 | 500ns | $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir'))); | ||
521 | 1 | 3µs | 1 | 6µs | valid_project($project); # spent 6µs making 1 call to RBM::valid_project |
522 | 1 | 8µs | 1 | 6µs | my $old_cwd = getcwd; # spent 6µs making 1 call to Cwd::getcwd |
523 | 1 | 300ns | my $commit_hash; | ||
524 | 1 | 4µs | 1 | 12.3ms | if (project_config($project, 'git_url', $options)) { # spent 12.3ms making 1 call to RBM::project_config |
525 | 1 | 5µs | 1 | 5.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"; | ||||
527 | 1 | 4µs | 1 | 41.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 | |||||
536 | 1 | 9µs | 1 | 46.9ms | my $version = project_config($project, 'version', $options); # spent 46.9ms making 1 call to RBM::project_config |
537 | 1 | 8µs | 2 | 930µ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 | } | ||||
545 | 1 | 2µs | 2 | 814µ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 | } | ||||
554 | 1 | 900ns | my $tar_file = "$project-$version.tar"; | ||
555 | 1 | 4µs | 1 | 13.9ms | if (project_config($project, 'git_url', $options)) { # spent 13.9ms making 1 call to RBM::project_config |
556 | 1 | 15.2ms | 1 | 15.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.'; | ||||
559 | 1 | 16µs | 1 | 1000µ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 | } | ||||
583 | 1 | 50µs | my %compress = ( | ||
584 | xz => ['xz', '-f'], | ||||
585 | gz => ['gzip', '--no-name', '-f'], | ||||
586 | bz2 => ['bzip2', '-f'], | ||||
587 | ); | ||||
588 | 1 | 5µs | 1 | 5.95ms | if (my $c = project_config($project, 'compress_tar', $options)) { # spent 5.95ms making 1 call to RBM::project_config |
589 | 1 | 1µs | if (!defined $compress{$c}) { | ||
590 | exit_error "Unknow compression $c"; | ||||
591 | } | ||||
592 | 1 | 64.4ms | 1 | 64.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]"; | ||||
594 | 1 | 9µs | $tar_file .= ".$c"; | ||
595 | } | ||||
596 | 1 | 16µs | 1 | 99.2ms | my $timestamp = project_config($project, 'timestamp', $options); # spent 99.2ms making 1 call to RBM::project_config |
597 | 1 | 63µs | 1 | 52µs | utime $timestamp, $timestamp, "$dest_dir/$tar_file" if $timestamp; # spent 52µs making 1 call to RBM::CORE:utime |
598 | 1 | 49µs | 1 | 41µs | print "Created $dest_dir/$tar_file\n"; # spent 41µs making 1 call to RBM::CORE:print |
599 | 1 | 8µs | 1 | 4µs | chdir($old_cwd); # spent 4µs making 1 call to RBM::CORE:chdir |
600 | 1 | 17µs | return $tar_file; | ||
601 | } | ||||
602 | |||||
603 | sub 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 | |||||
610 | sub 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 | sub process_template { | ||||
620 | 383161 | 374ms | my ($project, $tmpl, $dest_dir) = @_; | ||
621 | 383161 | 221ms | return undef unless defined $tmpl; | ||
622 | 383161 | 365ms | exit_error "Can't process template on a hash" if ref $tmpl eq 'HASH'; | ||
623 | 383161 | 210ms | 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 | } | ||||
630 | 383161 | 973ms | 454034 | 2.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 |
631 | 383161 | 1.23s | 766322 | 2.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 |
632 | 383161 | 2.38s | 383161 | 165s | 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}, | ||||
640 | 180865 | 1.36s | 180865 | 0s | # 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 # 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 | ||||
642 | 19909 | 16.2ms | my @args = @_; | ||
643 | 19909 | 29.7ms | $args[2] = { $_[2] ? %{$_[2]} : (), origin_project => $project }; | ||
644 | 19909 | 203ms | 19909 | 67.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, | ||||
648 | 2977 | 40.4ms | 2977 | 203s | # 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 # spent 203s making 2977 calls to RBM::execute, avg 68.2ms/call |
649 | path => \&rbm_path, | ||||
650 | 19910 | 210ms | 19910 | 0s | # 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 # 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 | ||||
654 | 4038 | 174ms | 8076 | 384ms | 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 | }, | ||||
656 | 383161 | 11.2s | sha256file => \&sha256file, | ||
657 | fileparse => \&fileparse, | ||||
658 | ENV => \%ENV, | ||||
659 | }; | ||||
660 | 383161 | 86.9ms | my $output; | ||
661 | 383161 | 1.55s | 383161 | 2134s | $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; | ||||
663 | 383161 | 21.8s | 767335 | 5.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 | |||||
666 | sub 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 | |||||
677 | sub 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 | ||||
682 | 1 | 1µs | my ($project, $dest_dir) = @_; | ||
683 | 1 | 400ns | my @r; | ||
684 | 1 | 2µs | 1 | 833µs | my $copy_files = project_config($project, 'copy_files'); # spent 833µs making 1 call to RBM::project_config |
685 | 1 | 6µ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 | |||||
695 | sub 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 | |||||
706 | sub 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 | ||||
711 | 5967 | 15.4ms | my ($filename, @dir) = @_; | ||
712 | 5967 | 357ms | 11934 | 241ms | 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 | ||||
716 | 5967 | 9.13ms | my ($input_file, $t, $fname, $action) = @_; | ||
717 | 5967 | 5.01ms | return undef if $action eq 'getfpaths'; | ||
718 | 5967 | 185s | 7968 | 201s | 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 | } | ||||
723 | 5967 | 7.77ms | if ($action eq 'input_files_id') { | ||
724 | 5961 | 7.54ms | return undef if $input_file->{input_file_id}; | ||
725 | 5961 | 27.7ms | return undef if $input_file->{sha256sum}; | ||
726 | 3969 | 1.93ms | return undef if $input_file->{exec}; | ||
727 | 3969 | 25.6ms | return undef if $fname; | ||
728 | return 1 if $input_file->{URL}; | ||||
729 | return 1 if $input_file->{content}; | ||||
730 | return undef; | ||||
731 | } | ||||
732 | 6 | 38µs | 6 | 4.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 | |||||
736 | sub 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 | ||||
746 | 5961 | 14.6ms | my ($input_file, $t, $fname, $filename) = @_; | ||
747 | 5961 | 6.32ms | return $t->('input_file_id') if $input_file->{input_file_id}; | ||
748 | 5961 | 47.3ms | return $input_file->{project} . ':' . $filename if $input_file->{project}; | ||
749 | 1992 | 25.6ms | 1992 | 16.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 | ||||
756 | 6 | 7µs | my ($fname, $name, $dest_dir) = @_; | ||
757 | 6 | 44µs | 6 | 20µs | if (-f $fname || -l $fname) { # spent 20µs making 6 calls to RBM::CORE:ftfile, avg 3µs/call |
758 | 6 | 54µs | 6 | 606ms | fcopy($fname, "$dest_dir/$name"); # spent 606ms making 6 calls to File::Copy::Recursive::fcopy, avg 101ms/call |
759 | 6 | 34µ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 | ||||
770 | 5967 | 14.8ms | my ($action, $project, $options, $dest_dir) = @_; | ||
771 | 5967 | 6.53ms | my @res_copy; | ||
772 | my %res_getfnames; | ||||
773 | my @res_getfpaths; | ||||
774 | 5967 | 5.57ms | my $getfnames_noname = 0; | ||
775 | 5967 | 13.2ms | my $input_files_id = ''; | ||
776 | 5967 | 13.2ms | $options = {$options ? %$options : ()}; | ||
777 | 5967 | 9.31ms | $options->{norec} = {}; | ||
778 | 5967 | 13.8ms | 5967 | 650µ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 |
779 | 5967 | 2.14ms | goto RETURN_RES unless $input_files; | ||
780 | 5967 | 29.5ms | 11934 | 64.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 |
781 | 5967 | 8.40ms | my $src_dir = "$proj_dir/$project"; | ||
782 | 5967 | 149ms | 5967 | 92.6ms | my $old_cwd = getcwd; # spent 92.6ms making 5967 calls to Cwd::getcwd, avg 16µs/call |
783 | 5967 | 176ms | 5967 | 123ms | chdir $src_dir || exit_error "cannot chdir to $src_dir"; # spent 123ms making 5967 calls to RBM::CORE:chdir, avg 21µs/call |
784 | 5967 | 37.0ms | foreach my $input_file_alias (@$input_files) { | ||
785 | 29697 | 18.7ms | my $input_file = $input_file_alias; | ||
786 | 29697 | 18.9ms | if (!ref $input_file) { | ||
787 | $input_file = project_config($project, | ||||
788 | process_template_opt($project, $input_file, $options), $options); | ||||
789 | } | ||||
790 | 29697 | 11.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 | ||||
792 | project_config($project, $_[0], {$options ? %$options : (), | ||||
793 | 51584 | 806ms | 51584 | 211ms | %$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 |
794 | 29697 | 110ms | }; | ||
795 | 29697 | 58.9ms | 9024 | 86.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 |
796 | 9024 | 70.0ms | next; | ||
797 | } | ||||
798 | 20673 | 42.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 | } | ||||
820 | 20673 | 20.2ms | if ($action eq 'getfnames') { | ||
821 | 14706 | 4.11ms | my $getfnames_name; | ||
822 | 14706 | 64.1ms | 10730 | 77.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 { | ||||
825 | 3976 | 15.9ms | $getfnames_name = "noname_$getfnames_noname"; | ||
826 | 3976 | 993µ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 | ||||
829 | 3976 | 5.42ms | my ($project, $options) = @_; | ||
830 | 3976 | 1.68ms | $options //= {}; | ||
831 | 3976 | 6.11ms | if ($input_file->{project}) { | ||
832 | 1984 | 4.87ms | $options = {%$options}; | ||
833 | 1984 | 2.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 | ||||
836 | 7944 | 130ms | 7944 | 0s | 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 |
837 | 3976 | 14.6ms | }; | ||
838 | 3976 | 2.82ms | return $t->('filename') if $input_file->{filename}; | ||
839 | 3976 | 13.5ms | 3976 | 23.0s | my $url = $t->('URL'); # spent 23.0s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:837], avg 5.78ms/call |
840 | 3976 | 29.8ms | 1992 | 151ms | 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}) | ||||
843 | 1984 | 76.6ms | 5952 | 732s | 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; | ||||
845 | 14706 | 113ms | }; | ||
846 | 14706 | 83.9ms | next; | ||
847 | } | ||||
848 | 5967 | 2.67ms | my $proj_out_dir; | ||
849 | 5967 | 125ms | 15900 | 63.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 { | ||||
854 | 1992 | 21.6ms | 3984 | 35.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 | } | ||||
857 | 5967 | 21.8ms | 5967 | 226ms | create_dir($proj_out_dir); # spent 226ms making 5967 calls to RBM::create_dir, avg 38µs/call |
858 | 5967 | 29.7ms | 5967 | 26.9s | my $url = $t->('URL'); # spent 26.9s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:794], avg 4.51ms/call |
859 | 5967 | 25.1ms | 1992 | 159ms | 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}) | ||||
865 | 5967 | 126ms | 11925 | 1487s | 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 |
866 | 5967 | 3.58ms | exit_error("Missing filename:\n" . pp($input_file)) unless $name; | ||
867 | 5967 | 32.8ms | 5967 | 353ms | 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 |
868 | 5967 | 50.6ms | 11934 | 7.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 |
869 | 5967 | 29.1ms | 5967 | 216s | 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 | } | ||||
898 | 5967 | 6.17ms | if ($action eq 'input_files_id') { | ||
899 | 5961 | 37.9ms | 5961 | 16.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 |
900 | 5961 | 3.35ms | $input_files_id .= "\n"; | ||
901 | 5961 | 51.9ms | next; | ||
902 | } | ||||
903 | 6 | 5µ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 | } | ||||
922 | 6 | 4µs | exit_error "Missing file $name" unless $fname; | ||
923 | 6 | 17µs | 6 | 4.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 | } | ||||
929 | 6 | 2µ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 | } | ||||
958 | 6 | 116µs | 6 | 74µs | my $file_type = -d $fname ? 'directory' : 'file'; # spent 74µs making 6 calls to RBM::CORE:ftdir, avg 12µs/call |
959 | 6 | 412µs | 6 | 376µs | print "Using $file_type $fname\n"; # spent 376µs making 6 calls to RBM::CORE:print, avg 63µs/call |
960 | 6 | 128µs | 12 | 500µ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 |
961 | 6 | 123µs | 6 | 606ms | push @res_copy, recursive_copy($fname, $name, $dest_dir); # spent 606ms making 6 calls to RBM::recursive_copy, avg 101ms/call |
962 | } | ||||
963 | 5967 | 187ms | 5967 | 145ms | chdir $old_cwd; # spent 145ms making 5967 calls to RBM::CORE:chdir, avg 24µs/call |
964 | 5967 | 62.4ms | 1990 | 17.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'; | ||||
966 | 3977 | 3.14ms | return @res_copy if $action eq 'copy'; | ||
967 | 3976 | 39.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 | ||||
972 | 1 | 1µs | my ($log_file, @args) = @_; | ||
973 | 1 | 600ns | return system(@args) if $log_file eq '-'; | ||
974 | 1 | 30.4ms | if (my $pid = fork) { | ||
975 | 1 | 59.0s | 1 | 59.0s | waitpid($pid, 0); # spent 59.0s making 1 call to RBM::CORE:waitpid |
976 | 1 | 65µ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 | ||||
984 | 1 | 1µs | my ($project, $script_name, $options) = @_; | ||
985 | 1 | 2µs | my $old_step = $config->{step}; | ||
986 | 1 | 1µs | $config->{step} = $script_name; | ||
987 | 1 | 400ns | $options //= {}; | ||
988 | 1 | 800ns | my $error; | ||
989 | 1 | 8µs | 3 | 3.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 |
990 | 1 | 3µs | 1 | 4µs | valid_project($project); # spent 4µs making 1 call to RBM::valid_project |
991 | 1 | 650µs | 2 | 313µ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 |
992 | 1 | 10µs | 2 | 313µs | my $old_cwd = getcwd; # spent 307µs making 1 call to Data::UUID::DESTROY
# spent 6µs making 1 call to Cwd::getcwd |
993 | 1 | 2µs | 1 | 885µs | my $srcdir = project_config($project, 'build_srcdir', $options); # spent 885µs making 1 call to RBM::project_config |
994 | 1 | 400ns | my $use_srcdir = $srcdir; | ||
995 | 1 | 15µs | 2 | 7.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'); | ||||
997 | 1 | 400ns | my @cfiles; | ||
998 | 1 | 900ns | if ($use_srcdir) { | ||
999 | @cfiles = ($srcdir); | ||||
1000 | } else { | ||||
1001 | 1 | 5µs | 1 | 26µs | $srcdir = $tmpdir->dirname; # spent 26µs making 1 call to File::Temp::Dir::dirname |
1002 | 1 | 5µs | 1 | 308ms | my $tarfile = maketar($project, $options, $srcdir); # spent 308ms making 1 call to RBM::maketar |
1003 | 1 | 900ns | push @cfiles, $tarfile if $tarfile; | ||
1004 | 1 | 7µs | 1 | 845µs | push @cfiles, copy_files($project, $srcdir); # spent 845µs making 1 call to RBM::copy_files |
1005 | 1 | 8µs | 1 | 649s | push @cfiles, input_files('copy', $project, $options, $srcdir); # spent 649s making 1 call to RBM::input_files |
1006 | } | ||||
1007 | 1 | 300ns | my ($remote_tmp_src, $remote_tmp_dst, %build_script); | ||
1008 | 1 | 2µs | my @scripts = ('pre', $script_name, 'post'); | ||
1009 | 1 | 4µs | my %scripts_root = ( pre => 1, post => 1); | ||
1010 | 1 | 6µs | 1 | 180ms | if (project_config($project, "remote_exec", $options)) { # spent 180ms making 1 call to RBM::project_config |
1011 | 1 | 9µs | 1 | 169ms | my $cmd = project_config($project, "remote_start", { # spent 169ms making 1 call to RBM::project_config |
1012 | %$options, | ||||
1013 | remote_srcdir => $srcdir, | ||||
1014 | }); | ||||
1015 | 1 | 600ns | if ($cmd) { | ||
1016 | 1 | 4µs | 1 | 6.80s | my ($stdout, $stderr, $success, $exit_code) # spent 6.80s making 1 call to RBM::run_script |
1017 | = run_script($project, $cmd, \&capture_exec); | ||||
1018 | 1 | 600ns | if (!$success) { | ||
1019 | $error = "Error starting remote:\n$stdout\n$stderr"; | ||||
1020 | goto EXIT; | ||||
1021 | } | ||||
1022 | } | ||||
1023 | 1 | 1µs | foreach my $remote_tmp ($remote_tmp_src, $remote_tmp_dst) { | ||
1024 | 2 | 55µs | 4 | 273ms | $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 | }); | ||||
1031 | 2 | 19µs | 2 | 395ms | 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); | ||||
1033 | 2 | 900ns | if (!$success) { | ||
1034 | $error = "Error connecting to remote:\n$stdout\n$stderr"; | ||||
1035 | goto EXIT; | ||||
1036 | } | ||||
1037 | 2 | 70µs | $remote_tmp = (split(/\r?\n/, $stdout))[0]; | ||
1038 | } | ||||
1039 | 1 | 9µs | my $o = { | ||
1040 | %$options, | ||||
1041 | norec => { output_dir => $remote_tmp_dst }, | ||||
1042 | }; | ||||
1043 | 1 | 12µs | foreach my $s (@scripts) { | ||
1044 | 3 | 14µs | 3 | 1482s | $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 | } | ||||
1051 | 1 | 800ns | if (!$build_script{$script_name}) { | ||
1052 | $error = "Missing $script_name config"; | ||||
1053 | goto EXIT; | ||||
1054 | } | ||||
1055 | 1 | 3µs | @scripts = grep { $build_script{$_} } @scripts; | ||
1056 | 1 | 1µs | push @cfiles, @scripts unless $use_srcdir; | ||
1057 | 1 | 1µs | foreach my $s (@scripts) { | ||
1058 | 1 | 12µs | 2 | 816µ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 |
1059 | 1 | 13µs | 1 | 6µs | chmod 0700, "$srcdir/$s"; # spent 6µs making 1 call to RBM::CORE:chmod |
1060 | } | ||||
1061 | 1 | 3µs | 1 | 11.3ms | my $build_log = project_config($project, "build_log", $options); # spent 11.3ms making 1 call to RBM::project_config |
1062 | 1 | 1µs | if ($build_log ne '-') { | ||
1063 | 1 | 2µs | 1 | 14.3ms | my $append = project_config($project, "build_log_append", $options); # spent 14.3ms making 1 call to RBM::project_config |
1064 | 1 | 3µs | 1 | 9µs | $build_log = rbm_path($build_log); # spent 9µs making 1 call to RBM::rbm_path |
1065 | 1 | 500ns | unlink $build_log unless $append; | ||
1066 | 1 | 9µs | 2 | 93µ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 |
1067 | 1 | 49µs | my $now = localtime; | ||
1068 | 1 | 37µs | 2 | 324µ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 |
1069 | 1 | 49µs | 1 | 44µs | print "Build log: $build_log\n"; # spent 44µs making 1 call to RBM::CORE:print |
1070 | } | ||||
1071 | 1 | 12µs | 1 | 7µs | chdir $srcdir; # spent 7µs making 1 call to RBM::CORE:chdir |
1072 | 1 | 400ns | my $res; | ||
1073 | 1 | 54µs | if ($remote_tmp_src && $remote_tmp_dst) { | ||
1074 | 1 | 2µs | foreach my $file (@cfiles) { | ||
1075 | 8 | 967µs | 16 | 2.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 | }); | ||||
1082 | 16 | 2.41s | 16 | 4.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 # 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 | } | ||||
1087 | 1 | 1µ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, | ||||
1092 | 1 | 96µs | 1 | 218ms | exec_as_root => $scripts_root{$s}, # spent 218ms making 1 call to RBM::project_config |
1093 | }); | ||||
1094 | 2 | 65µs | 2 | 118s | # 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 # 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 | } | ||||
1111 | 1 | 86µs | 1 | 53.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 | }); | ||||
1118 | 2 | 60.2ms | 2 | 134ms | # 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 # 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 | } | ||||
1121 | 1 | 74µs | 2 | 574ms | 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: | ||||
1142 | 1 | 36µs | 1 | 240ms | if (project_config($project, "remote_exec", $options)) { # spent 240ms making 1 call to RBM::project_config |
1143 | 1 | 6µs | 1 | 29.6ms | my $cmd = project_config($project, "remote_finish", $options); # spent 29.6ms making 1 call to RBM::project_config |
1144 | 2 | 815ms | 2 | 1.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 # 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 | } | ||||
1148 | 1 | 6µs | $config->{step} = $old_step; | ||
1149 | 1 | 12µs | 1 | 4µs | chdir $old_cwd; # spent 4µs making 1 call to RBM::CORE:chdir |
1150 | 1 | 110µs | 1 | 92.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 | ||||
1154 | 1 | 900ns | my ($project, $options) = @_; | ||
1155 | 1 | 18µs | 2 | 2205s | 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 | |||||
1158 | sub 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 | |||||
1170 | 1 | 3µs | 1; | ||
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:chmod; # opcode | |||||
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 | |||||
# 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 | |||||
# spent 772µs within RBM::CORE:glob which was called:
# once (772µs+0s) by RBM::load_config at line 53 | |||||
# 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 | |||||
# 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: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 | |||||
# 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 | |||||
# 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 | |||||
# spent 52µs within RBM::CORE:utime which was called:
# once (52µs+0s) by RBM::maketar at line 597 | |||||
# spent 59.0s within RBM::CORE:waitpid which was called:
# once (59.0s+0s) by RBM::system_log at line 975 | |||||
# spent 1µs within RBM::__ANON__ which was called:
# once (1µs+0s) by RBM::BEGIN@9 at line 9 |