Filename | /root/tor-browser-build/rbm/lib/RBM.pm |
Statements | Executed 1091025645 statements in 833s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
87566440 | 7 | 1 | 272s | 1620s | config_p (recurses: max depth 13, inclusive time 8373s) | RBM::
2763500 | 2 | 1 | 188s | 326s | get_target (recurses: max depth 1, inclusive time 157s) | RBM::
690875 | 1 | 1 | 167s | 1621s | config (recurses: max depth 13, inclusive time 8773s) | RBM::
1 | 1 | 1 | 56.5s | 56.5s | CORE:waitpid (opcode) | RBM::
1432779 | 52 | 2 | 43.6s | 1623s | project_config (recurses: max depth 55, inclusive time 40869s) | RBM::
375387 | 2 | 1 | 41.5s | 1623s | process_template (recurses: max depth 40, inclusive time 30288s) | RBM::
690875 | 1 | 1 | 21.5s | 351s | get_targets | RBM::
690875 | 1 | 1 | 20.1s | 36.1s | get_step | RBM::
497678 | 1 | 1 | 4.50s | 168s | notmpl | RBM::
608734 | 12 | 1 | 4.43s | 5.07s | rbm_path | RBM::
12 | 5 | 1 | 3.62s | 3.62s | CORE:system (opcode) | RBM::
1381750 | 1 | 1 | 2.20s | 2.20s | CORE:regcomp (opcode) | RBM::
5967 | 3 | 2 | 2.08s | 1617s | input_files (recurses: max depth 11, inclusive time 7426s) | RBM::
853155 | 1 | 1 | 1.84s | 1.84s | confkey_str | RBM::
180865 | 54 | 4 | 1.32s | 30338s | __ANON__[rbm/lib/RBM.pm:652] | RBM::
1990615 | 5 | 2 | 1.30s | 1.30s | CORE:match (opcode) | RBM::
690875 | 1 | 1 | 963ms | 963ms | as_array | RBM::
51584 | 10 | 1 | 686ms | 342s | __ANON__[rbm/lib/RBM.pm:807] | RBM::
29843 | 4 | 1 | 554ms | 1618s | project_step_config (recurses: max depth 12, inclusive time 7710s) | RBM::
12110 | 7 | 1 | 246ms | 246ms | CORE:chdir (opcode) | RBM::
11934 | 1 | 1 | 220ms | 220ms | CORE:ftis (opcode) | RBM::
19909 | 8 | 2 | 215ms | 112s | __ANON__[rbm/lib/RBM.pm:657] | RBM::
3976 | 1 | 1 | 180ms | 597s | __ANON__[rbm/lib/RBM.pm:858] | RBM::
6061 | 2 | 1 | 170ms | 170ms | CORE:ftdir (opcode) | RBM::
19910 | 1 | 1 | 128ms | 25.6s | __ANON__[rbm/lib/RBM.pm:662] | RBM::
3973 | 2 | 2 | 126ms | 3.76s | execute | RBM::
5967 | 1 | 1 | 124ms | 344ms | file_in_dir | RBM::
5967 | 1 | 1 | 93.3ms | 15.2s | input_file_need_dl | RBM::
7944 | 2 | 1 | 85.5ms | 49.4s | __ANON__[rbm/lib/RBM.pm:850] | RBM::
5961 | 1 | 1 | 77.1ms | 15.3s | input_file_id | RBM::
6055 | 3 | 1 | 61.7ms | 232ms | create_dir | RBM::
4038 | 6 | 2 | 49.5ms | 382ms | __ANON__[rbm/lib/RBM.pm:667] | RBM::
1 | 1 | 1 | 36.8ms | 56.5s | system_log | RBM::
2977 | 1 | 1 | 36.5ms | 1.84s | __ANON__[rbm/lib/RBM.pm:660] | RBM::
1992 | 1 | 1 | 28.6ms | 242ms | sha256file | RBM::
5969 | 3 | 1 | 26.2ms | 26.2ms | gpg_id | RBM::
1 | 1 | 1 | 8.73ms | 25.9ms | BEGIN@5 | RBM::
101 | 8 | 1 | 5.55ms | 68.7s | run_script | RBM::
87 | 2 | 1 | 4.82ms | 1.53s | git_clone_fetch_chdir | RBM::
8 | 3 | 1 | 4.76ms | 4.76ms | CORE:print (opcode) | RBM::
1 | 1 | 1 | 3.68ms | 4.08ms | BEGIN@23 | RBM::
87 | 1 | 1 | 3.42ms | 1.17s | git_need_fetch | RBM::
1 | 1 | 1 | 3.29ms | 3.68ms | BEGIN@15 | RBM::
1 | 1 | 1 | 3.27ms | 13.6ms | BEGIN@6 | RBM::
1 | 1 | 1 | 2.68ms | 1692s | build_run | RBM::
144 | 2 | 1 | 2.51ms | 15.3ms | load_config_file | RBM::
1 | 1 | 1 | 2.20ms | 2.81ms | BEGIN@22 | RBM::
1 | 1 | 1 | 2.17ms | 2.84ms | BEGIN@21 | RBM::
1 | 1 | 1 | 2.16ms | 4.05ms | BEGIN@11 | RBM::
1 | 1 | 1 | 2.05ms | 3.50ms | BEGIN@14 | RBM::
1 | 1 | 1 | 1.97ms | 2.27ms | BEGIN@20 | RBM::
1 | 1 | 1 | 1.45ms | 4.81ms | BEGIN@8 | RBM::
1 | 1 | 1 | 1.36ms | 11.3ms | BEGIN@12 | RBM::
15 | 1 | 1 | 1.31ms | 1.31ms | CORE:unlink (opcode) | RBM::
1 | 1 | 1 | 1.18ms | 17.8ms | BEGIN@9 | RBM::
1 | 1 | 1 | 890µs | 922µs | BEGIN@24 | RBM::
1 | 1 | 1 | 843µs | 20.9ms | load_config | RBM::
1 | 1 | 1 | 830µs | 944µs | BEGIN@18 | RBM::
155 | 6 | 1 | 760µs | 760µs | CORE:ftfile (opcode) | RBM::
1 | 1 | 1 | 702µs | 951µs | BEGIN@53 | RBM::
1 | 1 | 1 | 656µs | 863µs | BEGIN@19 | RBM::
1 | 1 | 1 | 643µs | 643µs | CORE:glob (opcode) | RBM::
8 | 1 | 1 | 588µs | 2.54s | __ANON__[rbm/lib/RBM.pm:1095] | RBM::
17 | 3 | 2 | 337µs | 182ms | get_tmp_dir | RBM::
1 | 1 | 1 | 297µs | 295ms | maketar | RBM::
1 | 1 | 1 | 192µs | 56.5s | __ANON__[rbm/lib/RBM.pm:1107] | RBM::
1 | 1 | 1 | 143µs | 929ms | __ANON__[rbm/lib/RBM.pm:1157] | RBM::
6 | 1 | 1 | 109µs | 639ms | recursive_copy | RBM::
1 | 1 | 1 | 99µs | 73.8ms | __ANON__[rbm/lib/RBM.pm:1131] | RBM::
16 | 2 | 1 | 65µs | 65µs | CORE:chmod (opcode) | RBM::
1 | 1 | 1 | 52µs | 52µs | CORE:utime (opcode) | RBM::
1 | 1 | 1 | 51µs | 51µs | set_default_env | RBM::
6 | 1 | 1 | 51µs | 51µs | CORE:mkdir (opcode) | RBM::
1 | 1 | 1 | 18µs | 48µs | find_config_file | RBM::
1 | 1 | 1 | 16µs | 5.36ms | load_local_config | RBM::
1 | 1 | 1 | 16µs | 52.0ms | load_system_config | RBM::
1 | 1 | 1 | 16µs | 29µs | BEGIN@3 | RBM::
1 | 1 | 1 | 16µs | 1692s | build_pkg | RBM::
1 | 1 | 1 | 15µs | 43µs | BEGIN@17 | RBM::
1 | 1 | 1 | 12µs | 49µs | BEGIN@7 | RBM::
1 | 1 | 1 | 11µs | 867µs | copy_files | RBM::
1 | 1 | 1 | 10µs | 29µs | BEGIN@16 | RBM::
2 | 2 | 1 | 9µs | 9µs | valid_project | RBM::
1 | 1 | 1 | 8µs | 54µs | BEGIN@13 | RBM::
1 | 1 | 1 | 8µs | 40µs | BEGIN@10 | RBM::
1 | 1 | 1 | 6µs | 7µs | BEGIN@4 | RBM::
1 | 1 | 1 | 1µs | 1µs | __ANON__ (xsub) | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:1119] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:1149] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:710] | RBM::
0 | 0 | 0 | 0s | 0s | __ANON__[rbm/lib/RBM.pm:891] | 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 | 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 | 28µs | 2 | 43µs | # spent 29µs (16+14) within RBM::BEGIN@3 which was called:
# once (16µs+14µs) by main::BEGIN@6 at line 3 # spent 29µs making 1 call to RBM::BEGIN@3
# spent 14µs making 1 call to warnings::import |
4 | 2 | 20µs | 2 | 9µs | # spent 7µs (6+2) within RBM::BEGIN@4 which was called:
# once (6µs+2µs) by main::BEGIN@6 at line 4 # spent 7µs making 1 call to RBM::BEGIN@4
# spent 2µs making 1 call to strict::import |
5 | 2 | 110µs | 2 | 26.0ms | # spent 25.9ms (8.73+17.2) within RBM::BEGIN@5 which was called:
# once (8.73ms+17.2ms) by main::BEGIN@6 at line 5 # spent 25.9ms making 1 call to RBM::BEGIN@5
# spent 43µs making 1 call to Exporter::import |
6 | 2 | 113µs | 2 | 13.7ms | # spent 13.6ms (3.27+10.3) within RBM::BEGIN@6 which was called:
# once (3.27ms+10.3ms) by main::BEGIN@6 at line 6 # spent 13.6ms making 1 call to RBM::BEGIN@6
# spent 92µs making 1 call to Exporter::import |
7 | 2 | 28µs | 2 | 86µs | # spent 49µs (12+37) within RBM::BEGIN@7 which was called:
# once (12µs+37µs) by main::BEGIN@6 at line 7 # spent 49µs making 1 call to RBM::BEGIN@7
# spent 37µs making 1 call to Exporter::import |
8 | 2 | 81µs | 2 | 4.84ms | # spent 4.81ms (1.45+3.36) within RBM::BEGIN@8 which was called:
# once (1.45ms+3.36ms) by main::BEGIN@6 at line 8 # spent 4.81ms making 1 call to RBM::BEGIN@8
# spent 29µs making 1 call to Exporter::import |
9 | 2 | 130µs | 2 | 17.8ms | # spent 17.8ms (1.18+16.7) within RBM::BEGIN@9 which was called:
# once (1.18ms+16.7ms) by main::BEGIN@6 at line 9 # spent 17.8ms making 1 call to RBM::BEGIN@9
# spent 1µs making 1 call to RBM::__ANON__ |
10 | 2 | 23µs | 2 | 73µs | # spent 40µs (8+33) within RBM::BEGIN@10 which was called:
# once (8µs+33µs) by main::BEGIN@6 at line 10 # spent 40µs making 1 call to RBM::BEGIN@10
# spent 32µs making 1 call to Exporter::import |
11 | 2 | 118µs | 2 | 4.07ms | # spent 4.05ms (2.16+1.88) within RBM::BEGIN@11 which was called:
# once (2.16ms+1.88ms) by main::BEGIN@6 at line 11 # spent 4.05ms making 1 call to RBM::BEGIN@11
# spent 22µs making 1 call to Exporter::import |
12 | 2 | 111µs | 2 | 11.3ms | # spent 11.3ms (1.36+9.89) within RBM::BEGIN@12 which was called:
# once (1.36ms+9.89ms) by main::BEGIN@6 at line 12 # spent 11.3ms making 1 call to RBM::BEGIN@12
# spent 33µs making 1 call to Exporter::import |
13 | 2 | 22µs | 2 | 100µs | # spent 54µs (8+46) within RBM::BEGIN@13 which was called:
# once (8µs+46µs) by main::BEGIN@6 at line 13 # spent 54µs making 1 call to RBM::BEGIN@13
# spent 46µs making 1 call to Exporter::import |
14 | 2 | 133µs | 2 | 3.55ms | # spent 3.50ms (2.05+1.45) within RBM::BEGIN@14 which was called:
# once (2.05ms+1.45ms) by main::BEGIN@6 at line 14 # spent 3.50ms making 1 call to RBM::BEGIN@14
# spent 46µs making 1 call to Exporter::import |
15 | 2 | 130µs | 2 | 3.75ms | # spent 3.68ms (3.29+397µs) within RBM::BEGIN@15 which was called:
# once (3.29ms+397µs) by main::BEGIN@6 at line 15 # spent 3.68ms making 1 call to RBM::BEGIN@15
# spent 63µs making 1 call to Exporter::import |
16 | 2 | 24µs | 2 | 48µs | # spent 29µs (10+19) within RBM::BEGIN@16 which was called:
# once (10µs+19µs) by main::BEGIN@6 at line 16 # spent 29µs making 1 call to RBM::BEGIN@16
# spent 19µs making 1 call to Exporter::import |
17 | 2 | 24µs | 2 | 71µs | # spent 43µs (15+28) within RBM::BEGIN@17 which was called:
# once (15µs+28µs) by main::BEGIN@6 at line 17 # spent 43µs making 1 call to RBM::BEGIN@17
# spent 28µs making 1 call to Exporter::import |
18 | 2 | 132µs | 2 | 986µs | # spent 944µs (830+113) within RBM::BEGIN@18 which was called:
# once (830µs+113µs) by main::BEGIN@6 at line 18 # spent 944µs making 1 call to RBM::BEGIN@18
# spent 42µs making 1 call to Exporter::import |
19 | 2 | 122µs | 2 | 964µs | # spent 863µs (656+206) within RBM::BEGIN@19 which was called:
# once (656µs+206µs) by main::BEGIN@6 at line 19 # spent 863µs making 1 call to RBM::BEGIN@19
# spent 101µs making 1 call to Exporter::import |
20 | 2 | 102µs | 2 | 2.34ms | # spent 2.27ms (1.97+298µs) within RBM::BEGIN@20 which was called:
# once (1.97ms+298µs) by main::BEGIN@6 at line 20 # spent 2.27ms making 1 call to RBM::BEGIN@20
# spent 76µs making 1 call to Exporter::import |
21 | 2 | 117µs | 2 | 2.93ms | # spent 2.84ms (2.17+661µs) within RBM::BEGIN@21 which was called:
# once (2.17ms+661µs) by main::BEGIN@6 at line 21 # spent 2.84ms making 1 call to RBM::BEGIN@21
# spent 94µs making 1 call to Exporter::import |
22 | 2 | 108µs | 2 | 2.86ms | # spent 2.81ms (2.20+611µs) within RBM::BEGIN@22 which was called:
# once (2.20ms+611µs) by main::BEGIN@6 at line 22 # spent 2.81ms making 1 call to RBM::BEGIN@22
# spent 52µs making 1 call to Exporter::import |
23 | 2 | 104µs | 2 | 4.13ms | # spent 4.08ms (3.68+403µs) within RBM::BEGIN@23 which was called:
# once (3.68ms+403µs) by main::BEGIN@6 at line 23 # spent 4.08ms making 1 call to RBM::BEGIN@23
# spent 52µs making 1 call to Exporter::import |
24 | 2 | 1.09ms | 2 | 954µs | # spent 922µs (890+32) within RBM::BEGIN@24 which was called:
# once (890µs+32µs) by main::BEGIN@6 at line 24 # spent 922µs making 1 call to RBM::BEGIN@24
# spent 32µ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 | 14µs | my @conf; | ||
31 | eval { | ||||
32 | 144 | 226µs | 144 | 12.7ms | @conf = LoadFile($_[0]); # spent 12.7ms making 144 calls to YAML::XS::LoadFile, avg 88µs/call |
33 | 144 | 70µs | } or do { | ||
34 | exit_error("Error reading file $_[0] :\n" . $@); | ||||
35 | }; | ||||
36 | 144 | 56µs | foreach my $c (@conf) { | ||
37 | 145 | 85µs | local $@ = ''; | ||
38 | 145 | 589µs | $res = { %$res, %$c } if ref $c eq 'HASH'; | ||
39 | 145 | 82µs | $res = { %$res, eval $c } if !ref $c; # spent 2.58ms executing statements in string eval # includes 1.11ms spent executing 32 calls to 6 subs defined therein. | ||
40 | 145 | 63µs | exit_error("Error executing perl config from $_[0] :\n" . $@) if $@; | ||
41 | } | ||||
42 | 144 | 285µs | return $res; | ||
43 | } | ||||
44 | |||||
45 | # spent 20.9ms (843µs+20.1) within RBM::load_config which was called:
# once (843µs+20.1ms) by main::RUNTIME at line 202 of /root/tor-browser-build/rbm/rbm | ||||
46 | 1 | 3µs | 1 | 48µs | my $config_file = shift // find_config_file(); # spent 48µs making 1 call to RBM::find_config_file |
47 | 1 | 3µs | 1 | 2.04ms | $config = load_config_file($config_file); # spent 2.04ms making 1 call to RBM::load_config_file |
48 | 1 | 2µs | $config->{default} = \%default_config; | ||
49 | 1 | 4µs | 1 | 153µs | $config->{basedir} = dirname($config_file); # spent 153µs making 1 call to File::Basename::dirname |
50 | 1 | 2µs | $config->{step} = 'rbm_init'; | ||
51 | 1 | 1µs | $config->{opt} = {}; | ||
52 | 1 | 3µs | my $pdir = $config->{projects_dir} || $config->{default}{projects_dir}; | ||
53 | 3 | 10.2ms | 3 | 1.60ms | # spent 951µs (702+249) within RBM::BEGIN@53 which was called:
# once (702µs+249µs) by main::BEGIN@6 at line 53 # spent 951µs making 1 call to RBM::BEGIN@53
# spent 643µs making 1 call to RBM::CORE:glob
# spent 10µs making 1 call to RBM::rbm_path |
54 | 144 | 851µs | 144 | 632µs | next unless -f "$p/config"; # spent 632µs making 144 calls to RBM::CORE:ftfile, avg 4µs/call |
55 | 143 | 450µs | 286 | 16.6ms | $config->{projects}{basename($p)} = load_config_file("$p/config"); # spent 13.2ms making 143 calls to RBM::load_config_file, avg 93µs/call
# spent 3.32ms making 143 calls to File::Basename::basename, avg 23µs/call |
56 | } | ||||
57 | } | ||||
58 | |||||
59 | # spent 52.0ms (16µs+52.0) within RBM::load_system_config which was called:
# once (16µs+52.0ms) by main::set_options at line 110 of /root/tor-browser-build/rbm/rbm | ||||
60 | 1 | 800ns | my ($project) = @_; | ||
61 | 1 | 6µs | 1 | 51.9ms | my $cfile = project_config($project ? $project : 'undef', 'sysconf_file'); # spent 51.9ms making 1 call to RBM::project_config |
62 | 1 | 26µs | 1 | 16µs | $config->{system} = -f $cfile ? load_config_file($cfile) : {}; # spent 16µs making 1 call to RBM::CORE:ftfile |
63 | } | ||||
64 | |||||
65 | # spent 5.36ms (16µs+5.35) within RBM::load_local_config which was called:
# once (16µs+5.35ms) by main::set_options at line 111 of /root/tor-browser-build/rbm/rbm | ||||
66 | 1 | 900ns | my ($project) = @_; | ||
67 | 1 | 3µs | 1 | 5.33ms | my $cfile = project_config($project ? $project : 'undef', 'localconf_file'); # spent 5.33ms making 1 call to RBM::project_config |
68 | 1 | 1µs | 1 | 4µs | $cfile = rbm_path($cfile); # spent 4µs making 1 call to RBM::rbm_path |
69 | 1 | 26µs | 1 | 17µs | $config->{local} = -f $cfile ? load_config_file($cfile) : {}; # spent 17µs making 1 call to RBM::CORE:ftfile |
70 | } | ||||
71 | |||||
72 | # spent 48µs (18+31) within RBM::find_config_file which was called:
# once (18µs+31µs) by RBM::load_config at line 46 | ||||
73 | 1 | 50µs | 2 | 31µs | for (my $dir = getcwd; $dir ne '/'; $dir = dirname($dir)) { # spent 17µs making 1 call to RBM::CORE:ftfile
# spent 14µs making 1 call to Cwd::getcwd |
74 | return "$dir/rbm.conf" if -f "$dir/rbm.conf"; | ||||
75 | } | ||||
76 | exit_error("Can't find config file"); | ||||
77 | } | ||||
78 | |||||
79 | # spent 51µs within RBM::set_default_env which was called:
# once (51µs+0s) by main::RUNTIME at line 203 of /root/tor-browser-build/rbm/rbm | ||||
80 | 1 | 52µs | %ENV = (%ENV, %{$config->{ENV}}) if ref $config->{ENV} eq 'HASH'; | ||
81 | } | ||||
82 | |||||
83 | # spent 5.07s (4.43+637ms) within RBM::rbm_path which was called 608734 times, avg 8µs/call:
# 375387 times (2.43s+263ms) by RBM::process_template at line 643, avg 7µs/call
# 219243 times (1.88s+355ms) by RBM::process_template at line 642, avg 10µs/call
# 5967 times (61.9ms+7.92ms) by RBM::input_files at line 793, avg 12µs/call
# 3975 times (30.3ms+4.09ms) by RBM::input_files at line 862, avg 9µs/call
# 1992 times (15.0ms+2.06ms) by RBM::input_files at line 867, avg 9µs/call
# 1992 times (10.8ms+4.47ms) by RBM::sha256file at line 612, avg 8µs/call
# 87 times (429µs+235µs) by RBM::git_clone_fetch_chdir at line 401, avg 8µs/call
# 87 times (465µs+73µs) by RBM::git_clone_fetch_chdir at line 391, avg 6µs/call
# once (9µs+1µs) by RBM::load_config at line 53
# once (7µs+1µs) by RBM::build_run at line 1077
# once (4µs+800ns) by RBM::build_run at line 1002
# once (3µs+1µs) by RBM::load_local_config at line 68 | ||||
84 | 608734 | 324ms | my ($path, $basedir) = @_; | ||
85 | 608734 | 555ms | $basedir //= $config->{basedir}; | ||
86 | 608734 | 5.56s | 608734 | 637ms | return ( $path =~ m|^/| ) ? $path : "$basedir/$path"; # spent 637ms making 608734 calls to RBM::CORE:match, avg 1µs/call |
87 | } | ||||
88 | |||||
89 | # spent 1620s (272+1348) within RBM::config_p which was called 87566440 times, avg 19µs/call:
# 44216000 times (137s+-137s) by RBM::get_target at line 108, avg 5ns/call
# 12812988 times (42.0s+-41.9s) by RBM::config at line 158, avg 6ns/call
# 12810998 times (39.7s+-39.7s) by RBM::config at line 172, avg 5ns/call
# 5527000 times (15.9s+-15.9s) by RBM::get_step at line 132, avg 5ns/call
# 4270996 times (13.0s+-13.0s) by RBM::config at line 165, avg 5ns/call
# 4247106 times (13.1s+1606s) by RBM::config at line 179, avg 381µs/call
# 3681352 times (10.5s+-10.5s) by RBM::config at line 150, avg 4ns/call | ||||
90 | 87566440 | 53.7s | my ($c, $project, $options, @q) = @_; | ||
91 | 87566440 | 13.7s | foreach my $p (@q) { | ||
92 | 208256297 | 37.0s | return undef unless ref $c eq 'HASH'; | ||
93 | 208256297 | 281s | return undef unless defined $c->{$p}; | ||
94 | 124534211 | 63.5s | 35882 | 2960s | $c = ref $c->{$p} eq 'CODE' ? $c->{$p}->($project, $options, @_) : $c->{$p}; # spent 8372s making 1990 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606], avg 4.21s/call, recursion: max depth 11, sum of overlapping time 6762s
# spent 597s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:858], avg 150ms/call
# spent 304s making 19910 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557], avg 15.2ms/call
# spent 152s making 1991 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578], avg 76.2ms/call
# spent 145s making 1991 calls to RBM::DefaultConfig::lsb_release, avg 72.7ms/call
# spent 141s making 3976 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605], avg 35.5ms/call
# spent 9.53s making 1992 calls to RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156], avg 4.78ms/call
# spent 903ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:16], avg 60.2ms/call
# spent 891ms making 15 calls to RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:10], avg 59.4ms/call
# spent 6.33ms making 26 calls to RBM::DefaultConfig::rbm_tmp_dir, avg 244µs/call |
95 | } | ||||
96 | 3844354 | 11.3s | return $c; | ||
97 | } | ||||
98 | |||||
99 | # spent 963ms within RBM::as_array which was called 690875 times, avg 1µs/call:
# 690875 times (963ms+0s) by RBM::get_targets at line 124, avg 1µs/call | ||||
100 | 690875 | 3.00s | ref $_[0] eq 'ARRAY' ? $_[0] : [ $_[0] ]; | ||
101 | } | ||||
102 | |||||
103 | sub get_target { | ||||
104 | 2763500 | 1.25s | my ($project, $options, $paths, $target) = @_; | ||
105 | 2763500 | 387ms | my @res; | ||
106 | 2763500 | 1.18s | foreach my $path (@$paths) { | ||
107 | 22108000 | 32.2s | foreach my $step ([ 'steps', $config->{step} ], []) { | ||
108 | 44216000 | 37.6s | 44216000 | 239ms | my $z = config_p($config, $project, $options, @$path, @$step, # spent 137s making 44216000 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 137s |
109 | 'targets', $target); | ||||
110 | 44216000 | 7.69s | next unless $z; | ||
111 | 3189746 | 915ms | if (ref $z eq 'HASH') { | ||
112 | 2498871 | 1.21s | push @res, $target unless grep { $_ eq $target } @res; | ||
113 | 2498871 | 687ms | next; | ||
114 | } | ||||
115 | 690875 | 770ms | my @z = ref $z eq 'ARRAY' ? (@{$z}) : ($z); | ||
116 | 3454375 | 3.39s | 1381750 | 0s | push @res, map { @{get_target($project, $options, $paths, $_)} } @z; # spent 157s making 1381750 calls to RBM::get_target, avg 113µs/call, recursion: max depth 1, sum of overlapping time 157s |
117 | } | ||||
118 | } | ||||
119 | 2763500 | 8.67s | return \@res; | ||
120 | } | ||||
121 | |||||
122 | # spent 351s (21.5+329) within RBM::get_targets which was called 690875 times, avg 508µs/call:
# 690875 times (21.5s+329s) by RBM::config at line 145, avg 508µs/call | ||||
123 | 690875 | 328ms | my ($project, $options, $paths) = @_; | ||
124 | 690875 | 1.71s | 690875 | 963ms | my $tmp = $config->{run}{target} ? as_array($config->{run}{target}) : [ 'notarget' ]; # spent 963ms making 690875 calls to RBM::as_array, avg 1µs/call |
125 | 2072625 | 12.8s | 2763500 | 2.86s | $tmp = [ map { m/^$project:(.+)$/ ? $1 : $_ } @$tmp ]; # spent 2.20s making 1381750 calls to RBM::CORE:regcomp, avg 2µs/call
# spent 660ms making 1381750 calls to RBM::CORE:match, avg 478ns/call |
126 | 3454375 | 5.85s | 1381750 | 326s | return [ map { @{get_target($project, $options, $paths, $_)} } @$tmp ]; # spent 326s making 1381750 calls to RBM::get_target, avg 236µs/call |
127 | } | ||||
128 | |||||
129 | # spent 36.1s (20.1+15.9) within RBM::get_step which was called 690875 times, avg 52µs/call:
# 690875 times (20.1s+15.9s) by RBM::config at line 146, avg 52µs/call | ||||
130 | 690875 | 368ms | my ($project, $options, $step, $paths) = @_; | ||
131 | 690875 | 1.33s | foreach my $path (@$paths) { | ||
132 | 5527000 | 4.47s | 5527000 | 27.2ms | my $z = config_p($config, $project, $options, @$path, 'steps', $step); # spent 15.9s making 5527000 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 15.9s |
133 | 5527000 | 1.09s | next unless $z; | ||
134 | return $step if ref $z; | ||||
135 | return get_step($project, $options, $z, $paths); | ||||
136 | } | ||||
137 | 690875 | 2.14s | return $step; | ||
138 | } | ||||
139 | |||||
140 | # spent 1621s (167+1454) within RBM::config which was called 690875 times, avg 2.35ms/call:
# 690875 times (167s+1454s) by RBM::project_config at line 223, avg 2.35ms/call | ||||
141 | 690875 | 300ms | my $project = shift; | ||
142 | 690875 | 188ms | my $name = shift; | ||
143 | 690875 | 155ms | my $options = shift; | ||
144 | 690875 | 109ms | my $res; | ||
145 | 690875 | 1.80s | 690875 | 351s | my @targets = @{get_targets($project, $options, \@_)}; # spent 351s making 690875 calls to RBM::get_targets, avg 508µs/call |
146 | 690875 | 1.58s | 690875 | 36.1s | my @step = ('steps', get_step($project, $options, $config->{step}, \@_)); # spent 36.1s making 690875 calls to RBM::get_step, avg 52µs/call |
147 | 690875 | 301ms | my $as_array = $options->{as_array}; | ||
148 | 690875 | 321ms | foreach my $path (@_) { | ||
149 | 4270996 | 473ms | my @l; | ||
150 | 4270996 | 5.34s | 3681352 | 14.6ms | push @l, config_p($config, $project, $options, @$path, "override.$name->[0]") # spent 10.5s making 3681352 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 10.5s |
151 | if @$name == 1; | ||||
152 | 4270996 | 1.22s | if (!$as_array) { | ||
153 | 4270996 | 1.86s | @l = grep { defined $_ } @l; | ||
154 | 4270996 | 562ms | return $l[0] if @l; | ||
155 | } | ||||
156 | # 1st priority: targets + step matching | ||||
157 | 4270996 | 1.42s | foreach my $t (@targets) { | ||
158 | 12812988 | 11.7s | 12812988 | 71.1ms | push @l, config_p($config, $project, $options, @$path, @step, 'targets', $t, @$name); # spent 42.0s making 12812988 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 41.9s |
159 | 12812988 | 6.33s | if (!$as_array) { | ||
160 | 12812988 | 4.83s | @l = grep { defined $_ } @l; | ||
161 | 12812988 | 1.37s | return $l[0] if @l; | ||
162 | } | ||||
163 | } | ||||
164 | # 2nd priority: step maching | ||||
165 | 4270996 | 3.88s | 4270996 | 22.9ms | push @l, config_p($config, $project, $options, @$path, @step, @$name); # spent 13.0s making 4270996 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 13.0s |
166 | 4270996 | 1.15s | if (!$as_array) { | ||
167 | 4270996 | 1.81s | @l = grep { defined $_ } @l; | ||
168 | 4270996 | 450ms | return $l[0] if @l; | ||
169 | } | ||||
170 | # 3rd priority: target matching | ||||
171 | 4270996 | 1.36s | foreach my $t (@targets) { | ||
172 | 12810998 | 11.2s | 12810998 | 65.9ms | push @l, config_p($config, $project, $options, @$path, 'targets', $t, @$name); # spent 39.7s making 12810998 calls to RBM::config_p, avg 3µs/call, recursion: max depth 13, sum of overlapping time 39.7s |
173 | 12810998 | 6.00s | if (!$as_array) { | ||
174 | 12810998 | 4.82s | @l = grep { defined $_ } @l; | ||
175 | 12810998 | 1.41s | return $l[0] if @l; | ||
176 | } | ||||
177 | } | ||||
178 | # last priority: no target and no step matching | ||||
179 | 4247106 | 3.83s | 4247106 | 1620s | push @l, config_p($config, $project, $options, @$path, @$name); # spent 9735s making 4247106 calls to RBM::config_p, avg 2.29ms/call, recursion: max depth 13, sum of overlapping time 8115s |
180 | 4247106 | 1.08s | if (!$as_array) { | ||
181 | 4247106 | 1.94s | @l = grep { defined $_ } @l; | ||
182 | 4247106 | 3.42s | return $l[0] if @l; | ||
183 | } | ||||
184 | 3616388 | 859ms | @l = grep { defined $_ } @l; | ||
185 | 3616388 | 1.66s | push @$res, @l if @l; | ||
186 | } | ||||
187 | 36267 | 148ms | return $as_array ? $res : undef; | ||
188 | } | ||||
189 | |||||
190 | # spent 168s (4.50+163) within RBM::notmpl which was called 497678 times, avg 337µs/call:
# 497678 times (4.50s+163s) by RBM::project_config at line 226, avg 337µs/call | ||||
191 | 497678 | 332ms | my ($name, $project) = @_; | ||
192 | 497678 | 228ms | return 1 if $name eq 'notmpl'; | ||
193 | my @n = (@{$config->{default}{notmpl}}, | ||||
194 | 497678 | 1.52s | 497678 | 0s | @{project_config($project, 'notmpl')}); # spent 163s making 497678 calls to RBM::project_config, avg 328µs/call, recursion: max depth 55, sum of overlapping time 163s |
195 | 497678 | 2.13s | return grep { $name eq $_ } @n; | ||
196 | } | ||||
197 | |||||
198 | # spent 1.84s within RBM::confkey_str which was called 853155 times, avg 2µs/call:
# 853155 times (1.84s+0s) by RBM::project_config at line 226, avg 2µs/call | ||||
199 | 853155 | 3.63s | ref $_[0] eq 'ARRAY' ? join '/', @{$_[0]} : $_[0]; | ||
200 | } | ||||
201 | |||||
202 | # spent 1623s (43.6+1580) within RBM::project_config which was called 1432779 times, avg 1.13ms/call:
# 497678 times (10.1s+-10.1s) by RBM::notmpl at line 194, avg 0s/call
# 375387 times (7.57s+-7.57s) by RBM::process_template at line 643, avg 0s/call
# 219243 times (7.01s+-7.01s) by RBM::process_template at line 642, avg 0s/call
# 180865 times (9.83s+-9.83s) by RBM::__ANON__[rbm/lib/RBM.pm:652] at line 652, avg 0s/call
# 51584 times (3.20s+-2.99s) by RBM::__ANON__[rbm/lib/RBM.pm:807] at line 806, avg 4µs/call
# 29843 times (1.73s+528s) by RBM::project_step_config at line 252, avg 17.7ms/call
# 19910 times (1.23s+-1.23s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] at line 537 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 19910 times (1.34s+-1.34s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:557] at line 538 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 7944 times (481ms+-481ms) by RBM::__ANON__[rbm/lib/RBM.pm:850] at line 849, avg 0s/call
# 5967 times (194ms+-192ms) by RBM::input_files at line 793, avg 248ns/call
# 5967 times (237ms+-237ms) by RBM::input_files at line 791, avg 104ns/call
# 3973 times (67.9ms+-67.9ms) by RBM::execute at line 481, avg 0s/call
# 3973 times (33.9ms+-33.9ms) by RBM::execute at line 482, avg 0s/call
# 2988 times (122ms+-122ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 142 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 1992 times (130ms+-130ms) by RBM::input_files at line 867, avg 0s/call
# 1991 times (73.5ms+-73.5ms) by RBM::DefaultConfig::lsb_release at line 37 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 1991 times (209ms+-209ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:578] at line 569 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 996 times (61.9ms+-61.9ms) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 143 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 0s/call
# 87 times (4.25ms+8.71ms) by RBM::git_clone_fetch_chdir at line 391, avg 149µs/call
# 87 times (3.92ms+1.54ms) by RBM::git_need_fetch at line 378, avg 63µs/call
# 87 times (1.71ms+3.31ms) by RBM::git_clone_fetch_chdir at line 393, avg 58µs/call
# 87 times (1.26ms+3.52ms) by RBM::git_need_fetch at line 380, avg 55µs/call
# 87 times (2.64ms+-1.87ms) by RBM::git_clone_fetch_chdir at line 397, avg 9µs/call
# 86 times (4.88ms+-4.88ms) by RBM::execute at line 490, avg 0s/call
# 17 times (887µs+173ms) by RBM::get_tmp_dir at line 265, avg 10.3ms/call
# 8 times (1.68ms+2.01s) by RBM::build_run at line 1088, avg 251ms/call
# 4 times (519µs+300ms) by RBM::build_run at line 1037, avg 75.2ms/call
# 3 times (367µs+1089s) by RBM::build_run at line 1057, avg 363s/call
# once (242µs+225ms) by RBM::build_run at line 1105
# once (225µs+225ms) by RBM::build_run at line 1134
# once (132µs+215ms) by RBM::build_run at line 1155
# once (229µs+161ms) by RBM::build_run at line 1024
# once (125µs+144ms) by RBM::build_run at line 1023
# once (167µs+89.3ms) by RBM::maketar at line 603
# once (222µs+53.6ms) by RBM::maketar at line 543
# once (58µs+51.9ms) by RBM::load_system_config at line 61
# once (248µs+40.1ms) by RBM::build_run at line 1124
# once (59µs+23.0ms) by RBM::build_run at line 1156
# once (51µs+20.5ms) by RBM::build_run at line 1074
# once (52µs+13.6ms) by RBM::build_run at line 1076
# once (33µs+13.6ms) by RBM::maketar at line 562
# once (37µs+6.07ms) by RBM::maketar at line 595
# once (48µs+5.60ms) by RBM::maketar at line 531
# once (53µs+5.52ms) by RBM::maketar at line 532
# once (41µs+5.29ms) by RBM::load_local_config at line 67
# once (42µs+5.08ms) by RBM::build_pkg at line 1168
# once (49µs+3.10ms) by RBM::build_run at line 1002
# once (125µs+943µs) by RBM::maketar at line 566
# once (53µs+943µs) by RBM::maketar at line 544
# once (33µs+823µs) by RBM::copy_files at line 696
# once (40µs+799µs) by RBM::build_run at line 1006
# once (22µs+747µs) by RBM::maketar at line 552 | ||||
203 | 1432779 | 969ms | my ($project, $name, $options) = @_; | ||
204 | CORE::state $cache; | ||||
205 | 1432779 | 239ms | my $res; | ||
206 | 1432779 | 790ms | my $error_if_undef = $options->{error_if_undef}; | ||
207 | 1432779 | 325ms | my $cache_save = $cache; | ||
208 | 1432779 | 663ms | if ($options) { | ||
209 | 1432779 | 2.28s | $options = {%$options, error_if_undef => 0}; | ||
210 | 1432779 | 2.93s | my %ignore_options = map { $_ => 1 } qw(error_if_undef step); | ||
211 | 1432779 | 2.45s | $cache = {} if grep { !$ignore_options{$_} } keys %$options; | ||
212 | } | ||||
213 | 1432779 | 782ms | my $name_str = ref $name eq 'ARRAY' ? join '/', @$name : $name; | ||
214 | 1432779 | 715ms | my $step = $config->{step}; | ||
215 | 1432779 | 1.31s | if (exists $cache->{$project}{$step}{$name_str}) { | ||
216 | 741904 | 481ms | $res = $cache->{$project}{$step}{$name_str}; | ||
217 | 741904 | 1.63s | goto FINISH; | ||
218 | } | ||||
219 | 690875 | 1.41s | $name = [ split '/', $name ] unless ref $name eq 'ARRAY'; | ||
220 | 690875 | 182ms | goto FINISH unless @$name; | ||
221 | 690875 | 279ms | my $opt_save = $config->{opt}; | ||
222 | 690875 | 5.40s | $config->{opt} = { %{$config->{opt}}, %$options } if $options; | ||
223 | 690875 | 3.55s | 690875 | 1621s | $res = config($project, $name, $options, ['opt', 'norec'], ['opt'], # spent 10394s making 690875 calls to RBM::config, avg 15.0ms/call, recursion: max depth 13, sum of overlapping time 8773s |
224 | ['run'], ['projects', $project], ['local'], [], | ||||
225 | ['system'], ['default']); | ||||
226 | 690875 | 3.55s | 1706310 | 1792s | if (!$options->{no_tmpl} && defined($res) && !ref $res # spent 31886s making 355477 calls to RBM::process_template, avg 89.7ms/call, recursion: max depth 40, sum of overlapping time 30263s
# spent 168s making 497678 calls to RBM::notmpl, avg 337µs/call
# spent 1.84s making 853155 calls to RBM::confkey_str, avg 2µs/call |
227 | && !notmpl(confkey_str($name), $project)) { | ||||
228 | $res = process_template($project, $res, | ||||
229 | confkey_str($name) eq 'output_dir' ? '.' : undef); | ||||
230 | } | ||||
231 | 690875 | 1.63s | $cache->{$project}{$step}{$name_str} = $res; | ||
232 | 690875 | 2.32s | $config->{opt} = $opt_save; | ||
233 | 1432779 | 688ms | FINISH: | ||
234 | $cache = $cache_save; | ||||
235 | 1432779 | 313ms | 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 | 1432779 | 8.06s | return $res; | ||
242 | } | ||||
243 | |||||
244 | # spent 1618s (554ms+1617) within RBM::project_step_config which was called 29843 times, avg 54.2ms/call:
# 19909 times (317ms+-254ms) by RBM::__ANON__[rbm/lib/RBM.pm:657] at line 656, avg 3µs/call
# 3975 times (88.8ms+1084s) by RBM::input_files at line 878, avg 273ms/call
# 3975 times (92.4ms+-39.3ms) by RBM::input_files at line 862, avg 13µs/call
# 1984 times (55.8ms+534s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 856, avg 269ms/call | ||||
245 | 29843 | 38.1ms | my $run_save = $config->{run}; | ||
246 | 29843 | 28.5ms | my $step_save = $config->{step}; | ||
247 | 29843 | 45.3ms | if ($_[2] && $_[2]->{step}) { | ||
248 | $config->{step} = $_[2]->{step}; | ||||
249 | } | ||||
250 | 29843 | 56.7ms | $config->{run} = { target => $_[2]->{target} }; | ||
251 | 29843 | 42.2ms | $config->{run}{target} //= $run_save->{target}; | ||
252 | 29843 | 71.2ms | 29843 | 530s | my $res = project_config(@_); # spent 9327s making 29843 calls to RBM::project_config, avg 313ms/call, recursion: max depth 51, sum of overlapping time 8798s |
253 | 29843 | 56.1ms | $config->{run} = $run_save; | ||
254 | 29843 | 33.7ms | $config->{step} = $step_save; | ||
255 | 29843 | 177ms | return $res; | ||
256 | } | ||||
257 | |||||
258 | sub exit_error { | ||||
259 | print STDERR "Error: ", $_[0], "\n"; | ||||
260 | exit (exists $_[1] ? $_[1] : 1); | ||||
261 | } | ||||
262 | |||||
263 | # spent 182ms (337µs+181) within RBM::get_tmp_dir which was called 17 times, avg 10.7ms/call:
# 15 times (299µs+169ms) by RBM::run_script at line 465, avg 11.3ms/call
# once (17µs+7.47ms) by RBM::build_run at line 1008
# once (22µs+4.83ms) by RBM::DefaultConfig::rbm_tmp_dir at line 109 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm | ||||
264 | 17 | 35µs | my ($project, $options) = @_; | ||
265 | 17 | 58µs | 17 | 174ms | my $tmp_dir = project_config($project, 'tmp_dir', $options); # spent 179ms making 17 calls to RBM::project_config, avg 10.5ms/call, recursion: max depth 4, sum of overlapping time 4.73ms |
266 | 17 | 92µs | 17 | 264µs | make_path($tmp_dir); # spent 264µs making 17 calls to File::Path::make_path, avg 16µs/call |
267 | 17 | 247µ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 | 1µs | my ($project) = @_; | ||
363 | 2 | 8µs | exists $config->{projects}{$project} | ||
364 | || exit_error "Unknown project $project"; | ||||
365 | } | ||||
366 | |||||
367 | # spent 232ms (61.7+171) within RBM::create_dir which was called 6055 times, avg 38µs/call:
# 5967 times (61.0ms+168ms) by RBM::input_files at line 870, avg 38µs/call
# 87 times (650µs+2.36ms) by RBM::git_clone_fetch_chdir at line 391, avg 35µs/call
# once (17µs+286µs) by RBM::build_run at line 1002 | ||||
368 | 6055 | 5.51ms | my ($directory) = @_; | ||
369 | 6055 | 235ms | 6055 | 170ms | return $directory if -d $directory; # spent 170ms making 6055 calls to RBM::CORE:ftdir, avg 28µs/call |
370 | 1 | 5µs | 1 | 14µs | my @res = make_path($directory); # spent 14µs making 1 call to File::Path::make_path |
371 | 1 | 400ns | exit_error "Error creating $directory" unless @res; | ||
372 | 1 | 3µs | return $directory; | ||
373 | } | ||||
374 | |||||
375 | # spent 1.17s (3.42ms+1.17) within RBM::git_need_fetch which was called 87 times, avg 13.5ms/call:
# 87 times (3.42ms+1.17s) by RBM::git_clone_fetch_chdir at line 408, avg 13.5ms/call | ||||
376 | 87 | 306µs | my ($project, $options) = @_; | ||
377 | 87 | 128µs | return 0 if $config->{projects}{$project}{fetched}; | ||
378 | 87 | 222µs | 87 | 5.46ms | my $fetch = project_config($project, 'fetch', $options); # spent 235ms making 87 calls to RBM::project_config, avg 2.70ms/call, recursion: max depth 31, sum of overlapping time 230ms |
379 | 87 | 81µs | if ($fetch eq 'if_needed') { | ||
380 | 87 | 234µs | 87 | 4.78ms | my $git_hash = project_config($project, 'git_hash', $options) # spent 11.7ms making 87 calls to RBM::project_config, avg 134µs/call, recursion: max depth 31, sum of overlapping time 6.88ms |
381 | || exit_error "No git_hash specified for project $project"; | ||||
382 | 87 | 720µs | 87 | 920ms | my (undef, undef, $success) = capture_exec('git', 'rev-parse', # spent 920ms making 87 calls to IO::CaptureOutput::capture_exec, avg 10.6ms/call |
383 | '--verify', "$git_hash^{commit}"); | ||||
384 | 87 | 1.06ms | return !$success; | ||
385 | } | ||||
386 | return $fetch; | ||||
387 | } | ||||
388 | |||||
389 | sub git_clone_fetch_chdir { | ||||
390 | 87 | 167µs | my ($project, $options) = @_; | ||
391 | 87 | 592µs | 261 | 16.5ms | my $clonedir = create_dir(rbm_path(project_config($project, # spent 259ms making 87 calls to RBM::project_config, avg 2.98ms/call, recursion: max depth 31, sum of overlapping time 246ms
# spent 3.01ms making 87 calls to RBM::create_dir, avg 35µs/call
# spent 538µs making 87 calls to RBM::rbm_path, avg 6µs/call |
392 | 'git_clone_dir', $options))); | ||||
393 | 87 | 207µs | 87 | 5.02ms | my $git_url = project_config($project, 'git_url', $options) # spent 11.9ms making 87 calls to RBM::project_config, avg 137µs/call, recursion: max depth 31, sum of overlapping time 6.87ms |
394 | || exit_error "git_url is undefined"; | ||||
395 | 87 | 50µs | my @clone_submod = (); | ||
396 | 87 | 67µs | my @fetch_submod = (); | ||
397 | 87 | 135µs | 87 | 770µs | if (project_config($project, 'git_submodule', $options)) { # spent 75.8ms making 87 calls to RBM::project_config, avg 871µs/call, recursion: max depth 31, sum of overlapping time 75.0ms |
398 | @clone_submod = ('--recurse-submodules'); | ||||
399 | @fetch_submod = ('--recurse-submodules=on-demand'); | ||||
400 | } | ||||
401 | 87 | 1.74ms | 174 | 1.39ms | if (!chdir rbm_path("$clonedir/$project")) { # spent 722µs making 87 calls to RBM::CORE:chdir, avg 8µs/call
# spent 664µs making 87 calls to RBM::rbm_path, avg 8µs/call |
402 | chdir $clonedir || exit_error "Can't enter directory $clonedir: $!"; | ||||
403 | if (system('git', 'clone', @clone_submod, $git_url, $project) != 0) { | ||||
404 | exit_error "Error cloning $git_url"; | ||||
405 | } | ||||
406 | chdir($project) || exit_error "Error entering $project directory"; | ||||
407 | } | ||||
408 | 87 | 8.89ms | 87 | 1.17s | if (git_need_fetch($project, $options)) { # spent 1.17s making 87 calls to RBM::git_need_fetch, avg 13.5ms/call |
409 | system('git', 'remote', 'set-url', 'origin', $git_url) == 0 | ||||
410 | || exit_error "Error setting git remote"; | ||||
411 | my (undef, undef, $success) = capture_exec('git', 'rev-parse', '--verify', 'HEAD'); | ||||
412 | if ($success) { | ||||
413 | system('git', 'checkout', '-q', '--detach') == 0 | ||||
414 | || exit_error "Error running git checkout --detach"; | ||||
415 | } | ||||
416 | system('git', 'fetch', @fetch_submod, 'origin', | ||||
417 | '+refs/heads/*:refs/heads/*') == 0 | ||||
418 | || exit_error "Error fetching git repository"; | ||||
419 | system('git', 'fetch', @fetch_submod, 'origin', | ||||
420 | '+refs/tags/*:refs/tags/*') == 0 | ||||
421 | || exit_error "Error fetching git repository"; | ||||
422 | $config->{projects}{$project}{fetched} = 1; | ||||
423 | } | ||||
424 | } | ||||
425 | |||||
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 68.7s (5.55ms+68.7) within RBM::run_script which was called 101 times, avg 680ms/call:
# 86 times (3.31ms+968ms) by RBM::execute at line 508, avg 11.3ms/call
# 8 times (1.17ms+2.64s) by RBM::build_run at line 1095, avg 331ms/call
# 2 times (197µs+410ms) by RBM::build_run at line 1044, avg 205ms/call
# once (217µs+56.5s) by RBM::build_run at line 1107
# once (140µs+6.78s) by RBM::build_run at line 1029
# once (146µs+939ms) by RBM::build_run at line 1157
# once (96µs+337ms) by RBM::build_run at line 1134
# once (275µs+86.2ms) by RBM::build_run at line 1131 | ||||
461 | 101 | 436µs | my ($project, $cmd, $f) = @_; | ||
462 | 101 | 61µs | $f //= \&capture_exec; | ||
463 | 101 | 50µs | my @res; | ||
464 | 101 | 1.10ms | 101 | 425µs | if ($cmd =~ m/^#/) { # spent 425µs making 101 calls to RBM::CORE:match, avg 4µs/call |
465 | 15 | 331µs | 30 | 184ms | my (undef, $tmp) = File::Temp::tempfile(DIR => get_tmp_dir($project)); # spent 169ms making 15 calls to RBM::get_tmp_dir, avg 11.3ms/call
# spent 15.3ms making 15 calls to File::Temp::tempfile, avg 1.02ms/call |
466 | 15 | 150µs | 30 | 18.0ms | path($tmp)->spew_utf8($cmd); # spent 17.3ms making 15 calls to Path::Tiny::spew_utf8, avg 1.16ms/call
# spent 648µs making 15 calls to Path::Tiny::path, avg 43µs/call |
467 | 15 | 160µs | 15 | 60µs | chmod 0700, $tmp; # spent 60µs making 15 calls to RBM::CORE:chmod, avg 4µs/call |
468 | 15 | 344µs | 15 | 67.5s | @res = $f->($tmp); # spent 56.5s making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1107]
# spent 7.47s making 4 calls to IO::CaptureOutput::capture_exec, avg 1.87s/call
# spent 2.54s making 8 calls to RBM::__ANON__[rbm/lib/RBM.pm:1095], avg 317ms/call
# spent 929ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1157]
# spent 73.8ms making 1 call to RBM::__ANON__[rbm/lib/RBM.pm:1131] |
469 | 15 | 1.59ms | 15 | 1.31ms | unlink $tmp; # spent 1.31ms making 15 calls to RBM::CORE:unlink, avg 88µs/call |
470 | } else { | ||||
471 | 86 | 902µs | 86 | 967ms | @res = $f->($cmd); # spent 967ms making 86 calls to IO::CaptureOutput::capture_exec, avg 11.2ms/call |
472 | } | ||||
473 | 101 | 1.71ms | return @res == 1 ? $res[0] : @res; | ||
474 | } | ||||
475 | |||||
476 | # spent 3.76s (126ms+3.63) within RBM::execute which was called 3973 times, avg 946µs/call:
# 2977 times (86.3ms+1.72s) by RBM::__ANON__[rbm/lib/RBM.pm:660] at line 660, avg 605µs/call
# 996 times (39.6ms+1.92s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:156] at line 144 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 1.96ms/call | ||||
477 | 3973 | 7.78ms | my ($project, $cmd, $options) = @_; | ||
478 | CORE::state %cache; | ||||
479 | 3973 | 1.29ms | my $res_name; | ||
480 | 3973 | 79.4ms | 3973 | 56.5ms | my $old_cwd = getcwd; # spent 56.5ms making 3973 calls to Cwd::getcwd, avg 14µs/call |
481 | 3973 | 10.7ms | 3973 | 0s | if (project_config($project, 'git_url', $options)) { # spent 73.2ms making 3973 calls to RBM::project_config, avg 18µs/call, recursion: max depth 48, sum of overlapping time 73.2ms |
482 | 3973 | 8.40ms | 3973 | 0s | my $git_hash = project_config($project, 'git_hash', $options) # spent 38.5ms making 3973 calls to RBM::project_config, avg 10µs/call, recursion: max depth 48, sum of overlapping time 38.5ms |
483 | || exit_error "No git_hash specified for project $project"; | ||||
484 | 3973 | 5.24ms | $res_name = "git-$git_hash-$cmd"; | ||
485 | 3973 | 54.0ms | return $cache{$res_name} if exists $cache{$res_name}; | ||
486 | 86 | 411µs | 86 | 1.49s | git_clone_fetch_chdir($project, $options); # spent 1.49s making 86 calls to RBM::git_clone_fetch_chdir, avg 17.3ms/call |
487 | 86 | 641µs | 86 | 996ms | my ($stdout, $stderr, $success, $exit_code) # spent 996ms making 86 calls to IO::CaptureOutput::capture_exec, avg 11.6ms/call |
488 | = capture_exec('git', 'checkout', $git_hash); | ||||
489 | 86 | 50µs | exit_error "Cannot checkout $git_hash:\n$stderr" unless $success; | ||
490 | 86 | 878µs | 86 | 0s | if (project_config($project, 'git_submodule', $options)) { # spent 5.81ms making 86 calls to RBM::project_config, avg 68µs/call, recursion: max depth 31, sum of overlapping time 5.81ms |
491 | foreach my $action (qw(init sync update)) { | ||||
492 | ($stdout, $stderr, $success, $exit_code) | ||||
493 | = capture_exec('git', 'submodule', $action); | ||||
494 | exit_error "Error running git submodule $action\n$stderr" | ||||
495 | unless $success; | ||||
496 | } | ||||
497 | } | ||||
498 | } elsif (project_config($project, 'hg_url', $options)) { | ||||
499 | my $hg_hash = project_config($project, 'hg_hash', $options) | ||||
500 | || exit_error "No hg_hash specified for project $project"; | ||||
501 | $res_name = "hg-$hg_hash-$cmd"; | ||||
502 | return $cache{$res_name} if exists $cache{$res_name}; | ||||
503 | hg_clone_fetch_chdir($project, $options); | ||||
504 | my ($stdout, $stderr, $success, $exit_code) | ||||
505 | = capture_exec('hg', 'update', '-C', $hg_hash); | ||||
506 | exit_error "Cannot checkout $hg_hash:\n$stderr" unless $success; | ||||
507 | } | ||||
508 | 86 | 758µs | 86 | 971ms | my ($stdout, $stderr, $success, $exit_code) # spent 971ms making 86 calls to RBM::run_script, avg 11.3ms/call |
509 | = run_script($project, $cmd, \&capture_exec); | ||||
510 | 86 | 1.43ms | 86 | 991µs | chdir($old_cwd); # spent 991µs making 86 calls to RBM::CORE:chdir, avg 12µs/call |
511 | 86 | 170µs | chomp $stdout; | ||
512 | 86 | 1.11ms | $cache{$res_name} = $success ? $stdout : undef; | ||
513 | 86 | 997µs | return $cache{$res_name}; | ||
514 | } | ||||
515 | |||||
516 | sub gpg_id { | ||||
517 | 5969 | 5.89ms | my ($id) = @_; | ||
518 | 5969 | 35.7ms | return $id unless $id; | ||
519 | if (ref $id eq 'ARRAY' && @$id == 1 && !$id->[0]) { | ||||
520 | return 0; | ||||
521 | } | ||||
522 | return $id; | ||||
523 | } | ||||
524 | |||||
525 | # spent 295ms (297µs+295) within RBM::maketar which was called:
# once (297µs+295ms) by RBM::build_run at line 1015 | ||||
526 | 1 | 2µs | my ($project, $options, $dest_dir) = @_; | ||
527 | 1 | 800ns | $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir'))); | ||
528 | 1 | 3µs | 1 | 5µs | valid_project($project); # spent 5µs making 1 call to RBM::valid_project |
529 | 1 | 8µs | 1 | 5µs | my $old_cwd = getcwd; # spent 5µs making 1 call to Cwd::getcwd |
530 | 1 | 400ns | my $commit_hash; | ||
531 | 1 | 4µs | 1 | 5.64ms | if (project_config($project, 'git_url', $options)) { # spent 5.64ms making 1 call to RBM::project_config |
532 | 1 | 4µs | 1 | 5.57ms | $commit_hash = project_config($project, 'git_hash', $options) # spent 5.57ms making 1 call to RBM::project_config |
533 | || exit_error "No git_hash specified for project $project"; | ||||
534 | 1 | 5µs | 1 | 35.5ms | git_clone_fetch_chdir($project); # spent 35.5ms making 1 call to RBM::git_clone_fetch_chdir |
535 | } elsif (project_config($project, 'hg_url', $options)) { | ||||
536 | $commit_hash = project_config($project, 'hg_hash', $options) | ||||
537 | || exit_error "No hg_hash specified for project $project"; | ||||
538 | hg_clone_fetch_chdir($project); | ||||
539 | } else { | ||||
540 | return undef; | ||||
541 | } | ||||
542 | |||||
543 | 1 | 9µs | 1 | 53.8ms | my $version = project_config($project, 'version', $options); # spent 53.8ms making 1 call to RBM::project_config |
544 | 1 | 7µs | 2 | 1000µs | if (my $tag_gpg_id = gpg_id(project_config($project, 'tag_gpg_id', $options))) { # spent 997µs making 1 call to RBM::project_config
# spent 3µs making 1 call to RBM::gpg_id |
545 | my $id = git_tag_sign_id($project, $commit_hash) || | ||||
546 | exit_error "$commit_hash is not a signed tag"; | ||||
547 | if (!valid_id($id, $tag_gpg_id)) { | ||||
548 | exit_error "Tag $commit_hash is not signed with a valid key"; | ||||
549 | } | ||||
550 | print "Tag $commit_hash is signed with key $id\n"; | ||||
551 | } | ||||
552 | 1 | 3µs | 2 | 770µs | if (my $commit_gpg_id = gpg_id(project_config($project, 'commit_gpg_id', # spent 769µs making 1 call to RBM::project_config
# spent 1µs making 1 call to RBM::gpg_id |
553 | $options))) { | ||||
554 | my $id = git_commit_sign_id($project, $commit_hash) || | ||||
555 | exit_error "$commit_hash is not a signed commit"; | ||||
556 | if (!valid_id($id, $commit_gpg_id)) { | ||||
557 | exit_error "Commit $commit_hash is not signed with a valid key"; | ||||
558 | } | ||||
559 | print "Commit $commit_hash is signed with key $id\n"; | ||||
560 | } | ||||
561 | 1 | 1µs | my $tar_file = "$project-$version.tar"; | ||
562 | 1 | 4µs | 1 | 13.6ms | if (project_config($project, 'git_url', $options)) { # spent 13.6ms making 1 call to RBM::project_config |
563 | 1 | 16.5ms | 1 | 16.4ms | system('git', 'archive', "--prefix=$project-$version/", # spent 16.4ms making 1 call to RBM::CORE:system |
564 | "--output=$dest_dir/$tar_file", $commit_hash) == 0 | ||||
565 | || exit_error 'Error running git archive.'; | ||||
566 | 1 | 18µs | 1 | 1.07ms | if (project_config($project, 'git_submodule', $options)) { # spent 1.07ms making 1 call to RBM::project_config |
567 | my $tmpdir = File::Temp->newdir( | ||||
568 | get_tmp_dir($project, $options) . '/rbm-XXXXX'); | ||||
569 | my ($stdout, $stderr, $success, $exit_code) | ||||
570 | = capture_exec('git', 'checkout', $commit_hash); | ||||
571 | exit_error "Cannot checkout $commit_hash: $stderr" unless $success; | ||||
572 | foreach my $action (qw(init sync update)) { | ||||
573 | ($stdout, $stderr, $success, $exit_code) | ||||
574 | = capture_exec('git', 'submodule', $action); | ||||
575 | exit_error "Error running git submodule $action\n$stderr" | ||||
576 | unless $success; | ||||
577 | } | ||||
578 | ($stdout, $stderr, $success, $exit_code) | ||||
579 | = capture_exec('git', 'submodule', 'foreach', | ||||
580 | "git archive --prefix=$project-$version/\$path/" | ||||
581 | . " --output=$tmpdir/submodule.tar \$sha1;" | ||||
582 | . "tar -Af \"$dest_dir/$tar_file\" $tmpdir/submodule.tar"); | ||||
583 | exit_error 'Error running git archive on submodules.' unless $success; | ||||
584 | } | ||||
585 | } else { | ||||
586 | system('hg', 'archive', '-r', $commit_hash, '-t', 'tar', | ||||
587 | '--prefix', "$project-$version", "$dest_dir/$tar_file") == 0 | ||||
588 | || exit_error 'Error running hg archive.'; | ||||
589 | } | ||||
590 | 1 | 16µs | my %compress = ( | ||
591 | xz => ['xz', '-f'], | ||||
592 | gz => ['gzip', '--no-name', '-f'], | ||||
593 | bz2 => ['bzip2', '-f'], | ||||
594 | ); | ||||
595 | 1 | 5µs | 1 | 6.11ms | if (my $c = project_config($project, 'compress_tar', $options)) { # spent 6.11ms making 1 call to RBM::project_config |
596 | 1 | 1µs | if (!defined $compress{$c}) { | ||
597 | exit_error "Unknow compression $c"; | ||||
598 | } | ||||
599 | 1 | 65.9ms | 1 | 65.8ms | system(@{$compress{$c}}, "$dest_dir/$tar_file") == 0 # spent 65.8ms making 1 call to RBM::CORE:system |
600 | || exit_error "Error compressing $tar_file with $compress{$c}->[0]"; | ||||
601 | 1 | 13µs | $tar_file .= ".$c"; | ||
602 | } | ||||
603 | 1 | 17µs | 1 | 89.5ms | my $timestamp = project_config($project, 'timestamp', $options); # spent 89.5ms making 1 call to RBM::project_config |
604 | 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 |
605 | 1 | 70µs | 1 | 62µs | print "Created $dest_dir/$tar_file\n"; # spent 62µs making 1 call to RBM::CORE:print |
606 | 1 | 8µs | 1 | 4µs | chdir($old_cwd); # spent 4µs making 1 call to RBM::CORE:chdir |
607 | 1 | 19µs | return $tar_file; | ||
608 | } | ||||
609 | |||||
610 | # spent 242ms (28.6+214) within RBM::sha256file which was called 1992 times, avg 122µs/call:
# 1992 times (28.6ms+214ms) by RBM::input_file_need_dl at line 730, avg 122µs/call | ||||
611 | CORE::state %res; | ||||
612 | 1992 | 5.19ms | 1992 | 15.2ms | my $f = rbm_path(shift); # spent 15.2ms making 1992 calls to RBM::rbm_path, avg 8µs/call |
613 | 1992 | 997µs | my $opt = shift; | ||
614 | 1992 | 1.84ms | if (ref $opt eq 'HASH' && $opt->{remove_cache}) { | ||
615 | delete $res{$f}; | ||||
616 | return; | ||||
617 | } | ||||
618 | 1992 | 19.8ms | return $res{$f} if exists $res{$f}; | ||
619 | 2 | 184ms | 8 | 183ms | return $res{$f} = -f $f ? sha256_hex(path($f)->slurp_raw) : ''; # spent 183ms making 2 calls to Digest::SHA::sha256_hex, avg 91.6ms/call
# spent 126µs making 2 calls to Path::Tiny::path, avg 63µs/call
# spent 52µs making 2 calls to RBM::CORE:ftfile, avg 26µs/call
# spent 16µs making 2 calls to Path::Tiny::slurp_raw, avg 8µs/call |
620 | } | ||||
621 | |||||
622 | sub process_template_opt { | ||||
623 | my ($project, $tmpl, $opt, $dest_dir) = @_; | ||||
624 | my $save_opt = $config->{opt}; | ||||
625 | $config->{opt} = {%{$config->{opt}}, %$opt} if $opt; | ||||
626 | my $res = process_template($project, $tmpl, $dest_dir); | ||||
627 | $config->{opt} = $save_opt; | ||||
628 | return $res; | ||||
629 | } | ||||
630 | |||||
631 | sub process_template { | ||||
632 | 375387 | 376ms | my ($project, $tmpl, $dest_dir) = @_; | ||
633 | 375387 | 137ms | return undef unless defined $tmpl; | ||
634 | 375387 | 273ms | exit_error "Can't process template on a hash" if ref $tmpl eq 'HASH'; | ||
635 | 375387 | 163ms | if (ref $tmpl eq 'ARRAY') { | ||
636 | my $res = []; | ||||
637 | foreach my $t (@$tmpl) { | ||||
638 | push @$res, process_template($project, $t, $dest_dir); | ||||
639 | } | ||||
640 | return $res; | ||||
641 | } | ||||
642 | 375387 | 1.01s | 438486 | 2.24s | $dest_dir //= rbm_path(project_config($project, 'output_dir')); # spent 2.24s making 219243 calls to RBM::rbm_path, avg 10µs/call
# spent 534s making 219243 calls to RBM::project_config, avg 2.43ms/call, recursion: max depth 53, sum of overlapping time 534s |
643 | 375387 | 1.16s | 750774 | 2.69s | my $projects_dir = rbm_path(project_config($project, 'projects_dir')); # spent 2.69s making 375387 calls to RBM::rbm_path, avg 7µs/call
# spent 155s making 375387 calls to RBM::project_config, avg 413µs/call, recursion: max depth 54, sum of overlapping time 155s |
644 | 375387 | 2.08s | 375387 | 147s | my $template = Template->new( # spent 147s making 375387 calls to Template::Base::new, avg 391µs/call |
645 | ENCODING => 'utf8', | ||||
646 | INCLUDE_PATH => "$projects_dir/$project:$projects_dir/common", | ||||
647 | ); | ||||
648 | my $vars = { | ||||
649 | config => $config, | ||||
650 | project => $project, | ||||
651 | p => $config->{projects}{$project}, | ||||
652 | 180865 | 1.35s | 180865 | 0s | # spent 30338s (1.32+30336) within RBM::__ANON__[rbm/lib/RBM.pm:652] which was called 180865 times, avg 168ms/call:
# 77850 times (622ms+19098s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 245ms/call
# 31867 times (184ms+532s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 16.7ms/call
# 18883 times (180ms+193s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 10.3ms/call
# 8971 times (59.3ms+39.6s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 4.42ms/call
# 6990 times (34.6ms+8380s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 1.20s/call
# 5997 times (46.6ms+68.8s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/input text, avg 11.5ms/call
# 3001 times (30.2ms+537s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 179ms/call
# 2987 times (28.6ms+41.7s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 14.0ms/call
# 2009 times (8.56ms+5.25s) by Template::Stash::XS::get at line 4 of /root/tor-browser-build/input text, avg 2.62ms/call
# 2005 times (16.2ms+4.87s) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/input text, avg 2.44ms/call
# 1992 times (16.8ms+103s) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/go/build, avg 51.5ms/call
# 1991 times (6.66ms+30.7ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 19µs/call
# 1986 times (8.40ms+107s) by Template::Stash::XS::get at line 26 of /root/tor-browser-build/input text, avg 53.9ms/call
# 1025 times (9.88ms+1.84s) by Template::Stash::XS::get at line 12 of /root/tor-browser-build/input text, avg 1.80ms/call
# 1016 times (4.89ms+2.59s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/input text, avg 2.56ms/call
# 1008 times (3.66ms+1.05s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/input text, avg 1.04ms/call
# 999 times (3.68ms+1.09s) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 1.10ms/call
# 997 times (2.75ms+948ms) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 953µs/call
# 996 times (4.34ms+56.6s) by Template::Stash::XS::get at line 38 of /root/tor-browser-build/projects/go/build, avg 56.9ms/call
# 996 times (4.90ms+56.5s) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/projects/go/build, avg 56.7ms/call
# 996 times (13.8ms+7.64s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/go/build, avg 7.68ms/call
# 996 times (4.74ms+2.66s) by Template::Stash::XS::get at line 13 of /root/tor-browser-build/projects/go/build, avg 2.67ms/call
# 996 times (11.0ms+17.2ms) by Template::Stash::XS::get at line 74 of /root/tor-browser-build/projects/go/build, avg 28µs/call
# 996 times (3.18ms+16.6ms) by Template::Stash::XS::get at line 34 of /root/tor-browser-build/projects/go/build, avg 20µs/call
# 995 times (4.57ms+2.52s) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/input text, avg 2.54ms/call
# 993 times (2.95ms+1.06s) by Template::Stash::XS::get at line 17 of /root/tor-browser-build/input text, avg 1.07ms/call
# 720 times (1.68ms+8.25ms) by Template::Stash::XS::get at line 23 of /root/tor-browser-build/input text, avg 14µs/call
# 303 times (686µs+3.34ms) by Template::Stash::XS::get at line 25 of /root/tor-browser-build/input text, avg 13µs/call
# 60 times (232µs+963ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 16.1ms/call
# 30 times (98µs+55.2ms) by Template::Stash::XS::get at line 239 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.84ms/call
# 30 times (65µs+319µs) by Template::Stash::XS::get at line 21 of /root/tor-browser-build/input text, avg 13µs/call
# 15 times (230µs+949ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/common/runc-config.json, avg 63.3ms/call
# 15 times (36µs+20.9ms) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/projects/common/runc-config.json, avg 1.40ms/call
# 15 times (61µs+308µs) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/common/runc-config.json, avg 25µs/call
# 15 times (35µs+173µs) by Template::Stash::XS::get at line 251 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call
# 15 times (36µs+169µs) by Template::Stash::XS::get at line 49 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call
# 15 times (32µs+172µs) by Template::Stash::XS::get at line 121 of /root/tor-browser-build/projects/common/runc-config.json, avg 14µs/call
# 15 times (29µs+113µs) by Template::Stash::XS::get at line 65 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call
# 15 times (27µs+107µs) by Template::Stash::XS::get at line 81 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call
# 15 times (28µs+105µs) by Template::Stash::XS::get at line 97 of /root/tor-browser-build/projects/common/runc-config.json, avg 9µs/call
# 15 times (25µs+99µs) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/input text, avg 8µs/call
# 4 times (16µs+555s) by Template::Stash::XS::get at line 28 of /root/tor-browser-build/projects/snowflake/build, avg 139s/call
# 4 times (12µs+8.77ms) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/projects/snowflake/build, avg 2.19ms/call
# 4 times (10µs+57µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 17µs/call
# 4 times (7µs+30µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 9µs/call
# 2 times (12µs+479s) by Template::Stash::XS::get at line 10 of /root/tor-browser-build/projects/snowflake/build, avg 240s/call
# 2 times (14µs+50.8s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/projects/snowflake/build, avg 25.4s/call
# 2 times (10µs+1.63s) by Template::Stash::XS::get at line 8 of /root/tor-browser-build/projects/snowflake/build, avg 814ms/call
# 2 times (11µs+1.60s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/projects/snowflake/build, avg 798ms/call
# 2 times (14µs+956ms) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 478ms/call
# 2 times (7µs+35.0ms) by Template::Stash::XS::get at line 14 of /root/tor-browser-build/projects/snowflake/build, avg 17.5ms/call
# 2 times (18µs+16.7ms) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/projects/snowflake/build, avg 8.36ms/call
# 2 times (10µs+11.9ms) by Template::Stash::XS::get at line 5 of /root/tor-browser-build/projects/snowflake/build, avg 5.95ms/call
# 2 times (6µs+20µs) by Template::Stash::XS::get at line 15 of /root/tor-browser-build/projects/snowflake/build, avg 13µs/call # spent 30336s making 180865 calls to RBM::project_config, avg 168ms/call, recursion: max depth 52, sum of overlapping time 30336s |
653 | # spent 112s (215ms+112) within RBM::__ANON__[rbm/lib/RBM.pm:657] which was called 19909 times, avg 5.65ms/call:
# 7964 times (51.4ms+21.3s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 2.68ms/call
# 3982 times (58.9ms+31.0s) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 7.79ms/call
# 1991 times (25.3ms+15.3s) by Template::Stash::XS::get at line 7 of /root/tor-browser-build/input text, avg 7.70ms/call
# 1991 times (26.1ms+15.1s) by Template::Stash::XS::get at line 6 of /root/tor-browser-build/input text, avg 7.60ms/call
# 1991 times (20.4ms+2.47s) by Template::Stash::XS::get at line 33 of /root/tor-browser-build/input text, avg 1.25ms/call
# 995 times (17.1ms+1.15s) by Template::Stash::XS::get at line 9 of /root/tor-browser-build/input text, avg 1.18ms/call
# 993 times (15.2ms+25.9s) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/input text, avg 26.1ms/call
# 2 times (39µs+62.7ms) by Template::Stash::XS::get at line 3 of /root/tor-browser-build/projects/snowflake/build, avg 31.4ms/call | ||||
654 | 19909 | 16.0ms | my @args = @_; | ||
655 | 19909 | 29.3ms | $args[2] = { $_[2] ? %{$_[2]} : (), origin_project => $project }; | ||
656 | 19909 | 211ms | 19909 | 62.7ms | project_step_config(@args); # spent 112s making 19909 calls to RBM::project_step_config, avg 5.64ms/call, recursion: max depth 12, sum of overlapping time 112s |
657 | }, | ||||
658 | dest_dir => $dest_dir, | ||||
659 | exit_error => \&exit_error, | ||||
660 | 2977 | 20.4ms | 2977 | 1.80s | # spent 1.84s (36.5ms+1.80) within RBM::__ANON__[rbm/lib/RBM.pm:660] which was called 2977 times, avg 618µs/call:
# 2977 times (36.5ms+1.80s) by Template::Stash::XS::get at line 2 of /root/tor-browser-build/input text, avg 618µs/call # spent 1.80s making 2977 calls to RBM::execute, avg 605µs/call |
661 | path => \&rbm_path, | ||||
662 | 19910 | 233ms | 19910 | 0s | # spent 25.6s (128ms+25.4) within RBM::__ANON__[rbm/lib/RBM.pm:662] which was called 19910 times, avg 1.28ms/call:
# 19910 times (128ms+25.4s) by Template::Stash::XS::get at line 11 of /root/tor-browser-build/input text, avg 1.28ms/call # spent 25.4s making 19910 calls to RBM::process_template, avg 1.28ms/call, recursion: max depth 39, sum of overlapping time 25.4s |
663 | shell_quote => \&shell_quote, | ||||
664 | versioncmp => \&versioncmp, | ||||
665 | # spent 382ms (49.5+332) within RBM::__ANON__[rbm/lib/RBM.pm:667] which was called 4038 times, avg 95µs/call:
# 4007 times (49.1ms+331ms) by Template::Stash::XS::get at line 1 of /root/tor-browser-build/input text, avg 95µs/call
# 15 times (292µs+937µs) by Template::Stash::XS::get at line 22 of /root/tor-browser-build/input text, avg 82µs/call
# 4 times (51µs+371µs) by Template::Stash::XS::get at line 237 of /root/tor-browser-build/projects/common/runc-config.json, avg 105µs/call
# 4 times (20µs+103µs) by Template::Stash::XS::get at line 24 of /root/tor-browser-build/input text, avg 31µs/call
# 4 times (12µs+57µs) by Template::Stash::XS::get at line 18 of /root/tor-browser-build/input text, avg 17µs/call
# 4 times (12µs+49µs) by Template::Stash::XS::get at line 20 of /root/tor-browser-build/input text, avg 15µs/call | ||||
666 | 4038 | 155ms | 8076 | 332ms | return sha256_hex(encode("utf8", $_[0])); # spent 252ms making 4038 calls to Encode::encode, avg 62µs/call
# spent 80.3ms making 4038 calls to Digest::SHA::sha256_hex, avg 20µs/call |
667 | }, | ||||
668 | 375387 | 9.78s | sha256file => \&sha256file, | ||
669 | fileparse => \&fileparse, | ||||
670 | ENV => \%ENV, | ||||
671 | }; | ||||
672 | 375387 | 80.9ms | my $output; | ||
673 | 375387 | 1.36s | 375387 | 1623s | $template->process(\$tmpl, $vars, \$output, binmode => ':utf8') # spent 31024s making 375387 calls to Template::process, avg 82.6ms/call, recursion: max depth 40, sum of overlapping time 29402s |
674 | || exit_error "Template Error:\n" . $template->error; | ||||
675 | 375387 | 19.0s | 751787 | 4.99s | return $output; # spent 3.25s making 375387 calls to Template::Context::DESTROY, avg 9µs/call
# spent 1.73s making 375387 calls to Template::Provider::DESTROY, avg 5µs/call
# spent 3.95ms making 1013 calls to Template::Document::AUTOLOAD, avg 4µs/call |
676 | } | ||||
677 | |||||
678 | sub rpmspec { | ||||
679 | my ($project, $dest_dir) = @_; | ||||
680 | $dest_dir //= create_dir(rbm_path(project_config($project, 'output_dir'))); | ||||
681 | valid_project($project); | ||||
682 | my $timestamp = project_config($project, 'timestamp'); | ||||
683 | my $rpmspec = project_config($project, 'rpmspec') | ||||
684 | || exit_error "Undefined config for rpmspec"; | ||||
685 | path("$dest_dir/$project.spec")->spew_utf8($rpmspec); | ||||
686 | utime $timestamp, $timestamp, "$dest_dir/$project.spec" if $timestamp; | ||||
687 | } | ||||
688 | |||||
689 | sub projectslist { | ||||
690 | keys %{$config->{projects}}; | ||||
691 | } | ||||
692 | |||||
693 | # spent 867µs (11+856) within RBM::copy_files which was called:
# once (11µs+856µs) by RBM::build_run at line 1017 | ||||
694 | 1 | 1µs | my ($project, $dest_dir) = @_; | ||
695 | 1 | 300ns | my @r; | ||
696 | 1 | 2µs | 1 | 856µs | my $copy_files = project_config($project, 'copy_files'); # spent 856µs making 1 call to RBM::project_config |
697 | 1 | 12µs | return unless $copy_files; | ||
698 | my $proj_dir = rbm_path(project_config($project, 'projects_dir')); | ||||
699 | my $src_dir = "$proj_dir/$project"; | ||||
700 | foreach my $file (@$copy_files) { | ||||
701 | copy("$src_dir/$file", "$dest_dir/$file"); | ||||
702 | push @r, $file; | ||||
703 | } | ||||
704 | return @r; | ||||
705 | } | ||||
706 | |||||
707 | sub urlget { | ||||
708 | my ($project, $input_file, $exit_on_error) = @_; | ||||
709 | my $cmd = project_config($project, 'urlget', $input_file); | ||||
710 | my $success = run_script($project, $cmd, sub { system(@_) }) == 0; | ||||
711 | if (!$success) { | ||||
712 | unlink project_config($project, 'filename', $input_file); | ||||
713 | exit_error "Error downloading file" if $exit_on_error; | ||||
714 | } | ||||
715 | return $success; | ||||
716 | } | ||||
717 | |||||
718 | sub is_url { | ||||
719 | $_[0] =~ m/^https?:\/\/.*/; | ||||
720 | } | ||||
721 | |||||
722 | # spent 344ms (124+220) within RBM::file_in_dir which was called 5967 times, avg 58µs/call:
# 5967 times (124ms+220ms) by RBM::input_files at line 880, avg 58µs/call | ||||
723 | 5967 | 14.1ms | my ($filename, @dir) = @_; | ||
724 | 5967 | 343ms | 11934 | 220ms | return map { -e "$_/$filename" ? "$_/$filename" : () } @dir; # spent 220ms making 11934 calls to RBM::CORE:ftis, avg 18µs/call |
725 | } | ||||
726 | |||||
727 | # spent 15.2s (93.3ms+15.1) within RBM::input_file_need_dl which was called 5967 times, avg 2.54ms/call:
# 5967 times (93.3ms+15.1s) by RBM::input_files at line 882, avg 2.54ms/call | ||||
728 | 5967 | 7.69ms | my ($input_file, $t, $fname, $action) = @_; | ||
729 | 5967 | 5.43ms | return undef if $action eq 'getfpaths'; | ||
730 | 5967 | 21.7ms | 3984 | 15.1s | if ($fname # spent 14.8s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.45ms/call
# spent 242ms making 1992 calls to RBM::sha256file, avg 122µs/call |
731 | && $input_file->{sha256sum} | ||||
732 | && $t->('sha256sum') ne sha256file($fname)) { | ||||
733 | sha256file($fname, { remove_cache => 1 }); | ||||
734 | $fname = undef; | ||||
735 | } | ||||
736 | 5967 | 6.13ms | if ($action eq 'input_files_id') { | ||
737 | 5961 | 5.67ms | return undef if $input_file->{input_file_id}; | ||
738 | 5961 | 32.5ms | return undef if $input_file->{sha256sum}; | ||
739 | 3969 | 3.86ms | return undef if $input_file->{exec}; | ||
740 | 3969 | 22.5ms | return undef if $fname; | ||
741 | return 1 if $input_file->{URL}; | ||||
742 | return 1 if $input_file->{content}; | ||||
743 | return undef; | ||||
744 | } | ||||
745 | 6 | 50µs | 6 | 4.77ms | return $t->('refresh_input') if $fname; # spent 4.77ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 795µs/call |
746 | return 1; | ||||
747 | } | ||||
748 | |||||
749 | sub input_file_id_hash { | ||||
750 | my ($fname, $filename) = @_; | ||||
751 | return $filename . ':' . sha256file($fname) if -f $fname; | ||||
752 | return $filename . ':' . sha256file(readlink $fname) if -l $fname; | ||||
753 | my @subdirs = sort(map { $_->basename } path($fname)->children); | ||||
754 | my @hashes = map { input_file_id_hash("$fname/$_", "$filename/$_") } @subdirs; | ||||
755 | return join("\n", @hashes); | ||||
756 | } | ||||
757 | |||||
758 | # spent 15.3s (77.1ms+15.2) within RBM::input_file_id which was called 5961 times, avg 2.57ms/call:
# 5961 times (77.1ms+15.2s) by RBM::input_files at line 912, avg 2.57ms/call | ||||
759 | 5961 | 9.03ms | my ($input_file, $t, $fname, $filename) = @_; | ||
760 | 5961 | 4.90ms | return $t->('input_file_id') if $input_file->{input_file_id}; | ||
761 | 5961 | 45.3ms | return $input_file->{project} . ':' . $filename if $input_file->{project}; | ||
762 | 1992 | 21.7ms | 1992 | 15.2s | return $filename . ':' . $t->('sha256sum') if $input_file->{sha256sum}; # spent 15.2s making 1992 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.64ms/call |
763 | return $filename . ':' . sha256_hex($t->('exec', { norec => { output_dir => '/out' } })) | ||||
764 | if $input_file->{exec}; | ||||
765 | return input_file_id_hash($fname, $filename); | ||||
766 | } | ||||
767 | |||||
768 | # spent 639ms (109µs+639) within RBM::recursive_copy which was called 6 times, avg 106ms/call:
# 6 times (109µs+639ms) by RBM::input_files at line 974, avg 106ms/call | ||||
769 | 6 | 9µs | my ($fname, $name, $dest_dir) = @_; | ||
770 | 6 | 57µs | 6 | 26µs | if (-f $fname || -l $fname) { # spent 26µs making 6 calls to RBM::CORE:ftfile, avg 4µs/call |
771 | 6 | 252µs | 6 | 638ms | fcopy($fname, "$dest_dir/$name"); # spent 638ms making 6 calls to File::Copy::Recursive::fcopy, avg 106ms/call |
772 | 6 | 39µs | return ($name); | ||
773 | } | ||||
774 | my @copied; | ||||
775 | mkdir "$dest_dir/$name"; | ||||
776 | foreach my $f (map { $_->basename } path($fname)->children) { | ||||
777 | push @copied, recursive_copy("$fname/$f", "$name/$f", $dest_dir); | ||||
778 | } | ||||
779 | return @copied; | ||||
780 | } | ||||
781 | |||||
782 | # spent 1617s (2.08+1615) within RBM::input_files which was called 5967 times, avg 271ms/call:
# 3976 times (931ms+1.53s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:605] at line 605 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 619µs/call
# 1990 times (1.15s+1083s) by RBM::DefaultConfig::__ANON__[rbm/lib/RBM/DefaultConfig.pm:606] at line 606 of /root/tor-browser-build/rbm/lib/RBM/DefaultConfig.pm, avg 545ms/call
# once (1.26ms+531s) by RBM::build_run at line 1018 | ||||
783 | 5967 | 16.1ms | my ($action, $project, $options, $dest_dir) = @_; | ||
784 | 5967 | 6.25ms | my @res_copy; | ||
785 | my %res_getfnames; | ||||
786 | my @res_getfpaths; | ||||
787 | 5967 | 5.63ms | my $getfnames_noname = 0; | ||
788 | 5967 | 13.7ms | my $input_files_id = ''; | ||
789 | 5967 | 14.8ms | $options = {$options ? %$options : ()}; | ||
790 | 5967 | 10.4ms | $options->{norec} = {}; | ||
791 | 5967 | 12.8ms | 5967 | 619µs | my $input_files = project_config($project, 'input_files', $options); # spent 5.10s making 5967 calls to RBM::project_config, avg 854µs/call, recursion: max depth 50, sum of overlapping time 5.10s |
792 | 5967 | 2.68ms | goto RETURN_RES unless $input_files; | ||
793 | 5967 | 30.6ms | 11934 | 71.3ms | my $proj_dir = rbm_path(project_config($project, 'projects_dir', $options)); # spent 69.8ms making 5967 calls to RBM::rbm_path, avg 12µs/call
# spent 13.0s making 5967 calls to RBM::project_config, avg 2.18ms/call, recursion: max depth 50, sum of overlapping time 13.0s |
794 | 5967 | 8.45ms | my $src_dir = "$proj_dir/$project"; | ||
795 | 5967 | 147ms | 5967 | 97.9ms | my $old_cwd = getcwd; # spent 97.9ms making 5967 calls to Cwd::getcwd, avg 16µs/call |
796 | 5967 | 147ms | 5967 | 113ms | chdir $src_dir || exit_error "cannot chdir to $src_dir"; # spent 113ms making 5967 calls to RBM::CORE:chdir, avg 19µs/call |
797 | 5967 | 37.4ms | foreach my $input_file_alias (@$input_files) { | ||
798 | 29697 | 17.5ms | my $input_file = $input_file_alias; | ||
799 | 29697 | 20.2ms | if (!ref $input_file) { | ||
800 | $input_file = project_config($project, | ||||
801 | process_template_opt($project, $input_file, $options), $options); | ||||
802 | } | ||||
803 | 29697 | 13.5ms | next unless $input_file; | ||
804 | # spent 342s (686ms+341) within RBM::__ANON__[rbm/lib/RBM.pm:807] which was called 51584 times, avg 6.62ms/call:
# 10730 times (130ms+73.5s) by RBM::input_files at line 835, avg 6.87ms/call
# 9024 times (97.2ms+83.4s) by RBM::input_files at line 808, avg 9.25ms/call
# 7950 times (118ms+60.5s) by RBM::input_files at line 862, avg 7.63ms/call
# 7950 times (94.4ms+59.7s) by RBM::input_files at line 878, avg 7.52ms/call
# 5967 times (102ms+26.5s) by RBM::input_files at line 871, avg 4.46ms/call
# 5967 times (103ms+7.32s) by RBM::input_files at line 881, avg 1.24ms/call
# 1992 times (23.6ms+15.2s) by RBM::input_file_id at line 762, avg 7.64ms/call
# 1992 times (18.2ms+14.8s) by RBM::input_file_need_dl at line 730, avg 7.45ms/call
# 6 times (39µs+4.73ms) by RBM::input_file_need_dl at line 745, avg 795µs/call
# 6 times (39µs+4.66ms) by RBM::input_files at line 936, avg 783µs/call | ||||
805 | project_config($project, $_[0], {$options ? %$options : (), | ||||
806 | 51584 | 744ms | 51584 | 215ms | %$input_file, $_[1] ? %{$_[1]} : ()}); # spent 341s making 51584 calls to RBM::project_config, avg 6.61ms/call, recursion: max depth 50, sum of overlapping time 341s |
807 | 29697 | 115ms | }; | ||
808 | 29697 | 68.2ms | 9024 | 83.5s | if ($input_file->{enable} && !$t->('enable')) { # spent 83.5s making 9024 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 9.25ms/call |
809 | 9024 | 74.3ms | next; | ||
810 | } | ||||
811 | 20673 | 47.6ms | if ($input_file->{target} || $input_file->{target_append} | ||
812 | || $input_file->{target_prepend}) { | ||||
813 | $input_file = { %$input_file }; | ||||
814 | if (ref $input_file->{target} eq 'ARRAY') { | ||||
815 | $input_file->{target} = process_template_opt($project, | ||||
816 | $input_file->{target}, $options); | ||||
817 | } else { | ||||
818 | $input_file->{target} = $config->{run}{target}; | ||||
819 | } | ||||
820 | if (ref $input_file->{target_prepend} eq 'ARRAY') { | ||||
821 | $input_file->{target} = [ @{ process_template_opt($project, | ||||
822 | $input_file->{target_prepend}, | ||||
823 | $options) }, | ||||
824 | @{$input_file->{target}} ]; | ||||
825 | } | ||||
826 | if (ref $input_file->{target_append} eq 'ARRAY') { | ||||
827 | $input_file->{target} = [ @{$input_file->{target}}, | ||||
828 | @{ process_template_opt($project, | ||||
829 | $input_file->{target_append}, | ||||
830 | $options) } ]; | ||||
831 | } | ||||
832 | } | ||||
833 | 20673 | 18.3ms | if ($action eq 'getfnames') { | ||
834 | 14706 | 4.24ms | my $getfnames_name; | ||
835 | 14706 | 63.7ms | 10730 | 73.7s | if ($input_file->{name}) { # spent 73.7s making 10730 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 6.87ms/call |
836 | $getfnames_name = $t->('name'); | ||||
837 | } else { | ||||
838 | 3976 | 12.6ms | $getfnames_name = "noname_$getfnames_noname"; | ||
839 | 3976 | 967µs | $getfnames_noname++; | ||
840 | } | ||||
841 | # spent 597s (180ms+597) within RBM::__ANON__[rbm/lib/RBM.pm:858] which was called 3976 times, avg 150ms/call:
# 3976 times (180ms+597s) by RBM::config_p at line 94, avg 150ms/call | ||||
842 | 3976 | 5.57ms | my ($project, $options) = @_; | ||
843 | 3976 | 2.84ms | $options //= {}; | ||
844 | 3976 | 6.83ms | if ($input_file->{project}) { | ||
845 | 1984 | 4.76ms | $options = {%$options}; | ||
846 | 1984 | 1.92ms | $options->{origin_project} = $project; | ||
847 | } | ||||
848 | # spent 49.4s (85.5ms+49.3) within RBM::__ANON__[rbm/lib/RBM.pm:850] which was called 7944 times, avg 6.22ms/call:
# 3976 times (36.4ms+22.2s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 852, avg 5.60ms/call
# 3968 times (49.1ms+27.1s) by RBM::__ANON__[rbm/lib/RBM.pm:858] at line 856, avg 6.84ms/call | ||||
849 | 7944 | 91.3ms | 7944 | 0s | RBM::project_config($project, $_[0], { %$options, %$input_file }) # spent 49.3s making 7944 calls to RBM::project_config, avg 6.21ms/call, recursion: max depth 50, sum of overlapping time 49.3s |
850 | 3976 | 14.3ms | }; | ||
851 | 3976 | 3.68ms | return $t->('filename') if $input_file->{filename}; | ||
852 | 3976 | 13.7ms | 3976 | 22.3s | my $url = $t->('URL'); # spent 22.3s making 3976 calls to RBM::__ANON__[rbm/lib/RBM.pm:850], avg 5.60ms/call |
853 | 3976 | 59.4ms | 1992 | 175ms | return basename($url) if $url; # spent 175ms making 1992 calls to File::Basename::basename, avg 88µs/call |
854 | return RBM::project_step_config($t->('project'), 'filename', | ||||
855 | {%$options, step => $t->('pkg_type'), %$input_file}) | ||||
856 | 1984 | 68.5ms | 5952 | 561s | if $input_file->{project}; # spent 547s making 1984 calls to RBM::project_step_config, avg 276ms/call, recursion: max depth 10, sum of overlapping time 13.7s
# spent 27.1s making 3968 calls to RBM::__ANON__[rbm/lib/RBM.pm:850], avg 6.84ms/call |
857 | return undef; | ||||
858 | 14706 | 159ms | }; | ||
859 | 14706 | 79.7ms | next; | ||
860 | } | ||||
861 | 5967 | 2.67ms | my $proj_out_dir; | ||
862 | 5967 | 122ms | 15900 | 60.7s | if ($input_file->{project}) { # spent 60.6s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.63ms/call
# spent 21.9s making 3975 calls to RBM::project_step_config, avg 5.51ms/call, recursion: max depth 11, sum of overlapping time 21.9s
# spent 34.4ms making 3975 calls to RBM::rbm_path, avg 9µs/call |
863 | $proj_out_dir = rbm_path(project_step_config($t->('project'), 'output_dir', | ||||
864 | { %$options, step => $t->('pkg_type'), | ||||
865 | origin_project => $project, %$input_file })); | ||||
866 | } else { | ||||
867 | 1992 | 19.8ms | 3984 | 17.1ms | $proj_out_dir = rbm_path(project_config($project, 'output_dir', # spent 17.1ms making 1992 calls to RBM::rbm_path, avg 9µs/call
# spent 11.0s making 1992 calls to RBM::project_config, avg 5.52ms/call, recursion: max depth 49, sum of overlapping time 11.0s |
868 | { %$options, %$input_file })); | ||||
869 | } | ||||
870 | 5967 | 19.4ms | 5967 | 229ms | create_dir($proj_out_dir); # spent 229ms making 5967 calls to RBM::create_dir, avg 38µs/call |
871 | 5967 | 28.5ms | 5967 | 26.6s | my $url = $t->('URL'); # spent 26.6s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 4.46ms/call |
872 | 5967 | 31.8ms | 1992 | 204ms | my $name = $input_file->{filename} ? $t->('filename') : # spent 204ms making 1992 calls to File::Basename::basename, avg 103µs/call |
873 | $url ? basename($url) : | ||||
874 | undef; | ||||
875 | $name //= project_step_config($t->('project'), 'filename', | ||||
876 | {%$options, step => $t->('pkg_type'), | ||||
877 | origin_project => $project, %$input_file}) | ||||
878 | 5967 | 126ms | 11925 | 1144s | if $input_file->{project}; # spent 8646s making 3975 calls to RBM::project_step_config, avg 2.18s/call, recursion: max depth 11, sum of overlapping time 7562s
# spent 59.8s making 7950 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 7.52ms/call |
879 | 5967 | 3.93ms | exit_error("Missing filename:\n" . pp($input_file)) unless $name; | ||
880 | 5967 | 29.9ms | 5967 | 344ms | my ($fname) = file_in_dir($name, $src_dir, $proj_out_dir); # spent 344ms making 5967 calls to RBM::file_in_dir, avg 58µs/call |
881 | 5967 | 46.7ms | 11934 | 7.45s | my $file_gpg_id = gpg_id($t->('file_gpg_id')); # spent 7.42s making 5967 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 1.24ms/call
# spent 26.2ms making 5967 calls to RBM::gpg_id, avg 4µs/call |
882 | 5967 | 19.7ms | 5967 | 15.2s | if (input_file_need_dl($input_file, $t, $fname, $action)) { # spent 15.2s making 5967 calls to RBM::input_file_need_dl, avg 2.54ms/call |
883 | if ($t->('content')) { | ||||
884 | path("$proj_out_dir/$name")->spew_utf8($t->('content')); | ||||
885 | } elsif ($t->('URL')) { | ||||
886 | urlget($project, {%$options, %$input_file, filename => $name}, 1); | ||||
887 | } elsif ($t->('exec')) { | ||||
888 | my $exec_script = project_config($project, 'exec', | ||||
889 | { $options ? %$options : (), %$input_file }); | ||||
890 | if (run_script($project, $exec_script, | ||||
891 | sub { system(@_) }) != 0) { | ||||
892 | exit_error "Error creating $name"; | ||||
893 | } | ||||
894 | } elsif ($input_file->{project} && $t->('project')) { | ||||
895 | my $p = $t->('project'); | ||||
896 | print "Building project $p - $name\n"; | ||||
897 | my $run_save = $config->{run}; | ||||
898 | $config->{run} = { target => $input_file->{target} }; | ||||
899 | $config->{run}{target} //= $run_save->{target}; | ||||
900 | build_pkg($p, {%$options, origin_project => $project, | ||||
901 | %$input_file}); | ||||
902 | $config->{run} = $run_save; | ||||
903 | print "Finished build of project $p - $name\n"; | ||||
904 | } else { | ||||
905 | dd $input_file; | ||||
906 | exit_error "Missing file $name"; | ||||
907 | } | ||||
908 | ($fname) = file_in_dir($name, $src_dir, $proj_out_dir); | ||||
909 | exit_error "Error getting file $name" unless $fname; | ||||
910 | } | ||||
911 | 5967 | 6.23ms | if ($action eq 'input_files_id') { | ||
912 | 5961 | 30.6ms | 5961 | 15.3s | $input_files_id .= input_file_id($input_file, $t, $fname, $name); # spent 15.3s making 5961 calls to RBM::input_file_id, avg 2.57ms/call |
913 | 5961 | 3.55ms | $input_files_id .= "\n"; | ||
914 | 5961 | 51.2ms | next; | ||
915 | } | ||||
916 | 6 | 4µs | if ($action eq 'getfpaths') { | ||
917 | push @res_getfpaths, $fname if $fname; | ||||
918 | if ($file_gpg_id && $fname) { | ||||
919 | my $sig_ext = $t->('sig_ext'); | ||||
920 | $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ]; | ||||
921 | foreach my $s (@$sig_ext) { | ||||
922 | if (-f "$fname.$s") { | ||||
923 | push @res_getfpaths, "$fname.$s"; | ||||
924 | last; | ||||
925 | } | ||||
926 | } | ||||
927 | } | ||||
928 | if ($input_file->{project} && $t->('project')) { | ||||
929 | my $r = RBM::project_step_config($t->('project'), 'input_files_paths', | ||||
930 | {%$options, step => $t->('pkg_type'), %$input_file}); | ||||
931 | push @res_getfpaths, @$r if @$r; | ||||
932 | } | ||||
933 | next; | ||||
934 | } | ||||
935 | 6 | 3µs | exit_error "Missing file $name" unless $fname; | ||
936 | 6 | 17µs | 6 | 4.70ms | if ($t->('sha256sum') # spent 4.70ms making 6 calls to RBM::__ANON__[rbm/lib/RBM.pm:807], avg 783µs/call |
937 | && $t->('sha256sum') ne sha256file($fname)) { | ||||
938 | exit_error "Can't have sha256sum on directory: $fname" if -d $fname; | ||||
939 | exit_error "Wrong sha256sum for $fname.\n" . | ||||
940 | "Expected sha256sum: " . $t->('sha256sum'); | ||||
941 | } | ||||
942 | 6 | 3µs | if ($file_gpg_id) { | ||
943 | exit_error "Can't have gpg sig on directory: $fname" if -d $fname; | ||||
944 | my $sig_ext = $t->('sig_ext'); | ||||
945 | $sig_ext = ref $sig_ext eq 'ARRAY' ? $sig_ext : [ $sig_ext ]; | ||||
946 | my $sig_file; | ||||
947 | foreach my $s (@$sig_ext) { | ||||
948 | if (-f "$fname.$s" && !$t->('refresh_input')) { | ||||
949 | $sig_file = "$fname.$s"; | ||||
950 | last; | ||||
951 | } | ||||
952 | } | ||||
953 | foreach my $s ($sig_file ? () : @$sig_ext) { | ||||
954 | if ($url) { | ||||
955 | my $f = { %$options, %$input_file, | ||||
956 | 'override.URL' => "$url.$s", filename => "$name.$s" }; | ||||
957 | if (urlget($project, $f, 0)) { | ||||
958 | $sig_file = "$fname.$s"; | ||||
959 | last; | ||||
960 | } | ||||
961 | } | ||||
962 | } | ||||
963 | exit_error "No signature file for $name" unless $sig_file; | ||||
964 | my $id = file_sign_id($project, { %$input_file, | ||||
965 | filename_data => $fname, filename_sig => $sig_file }); | ||||
966 | print "File $name is signed with id $id\n" if $id; | ||||
967 | if (!$id || !valid_id($id, $file_gpg_id)) { | ||||
968 | exit_error "File $name is not signed with a valid key"; | ||||
969 | } | ||||
970 | } | ||||
971 | 6 | 120µs | 6 | 81µs | my $file_type = -d $fname ? 'directory' : 'file'; # spent 81µs making 6 calls to RBM::CORE:ftdir, avg 13µs/call |
972 | 6 | 4.72ms | 6 | 4.66ms | print "Using $file_type $fname\n"; # spent 4.66ms making 6 calls to RBM::CORE:print, avg 777µs/call |
973 | 6 | 140µs | 12 | 629µs | mkdir dirname("$dest_dir/$name"); # spent 578µs making 6 calls to File::Basename::dirname, avg 96µs/call
# spent 51µs making 6 calls to RBM::CORE:mkdir, avg 8µs/call |
974 | 6 | 147µs | 6 | 639ms | push @res_copy, recursive_copy($fname, $name, $dest_dir); # spent 639ms making 6 calls to RBM::recursive_copy, avg 106ms/call |
975 | } | ||||
976 | 5967 | 181ms | 5967 | 131ms | chdir $old_cwd; # spent 131ms making 5967 calls to RBM::CORE:chdir, avg 22µs/call |
977 | 5967 | 63.6ms | 1990 | 18.8ms | RETURN_RES: # spent 18.8ms making 1990 calls to Digest::SHA::sha256_hex, avg 9µs/call |
978 | return sha256_hex($input_files_id) if $action eq 'input_files_id'; | ||||
979 | 3977 | 1.90ms | return @res_copy if $action eq 'copy'; | ||
980 | 3976 | 40.4ms | return \%res_getfnames if $action eq 'getfnames'; | ||
981 | return \@res_getfpaths if $action eq 'getfpaths'; | ||||
982 | } | ||||
983 | |||||
984 | # spent 56.5s (36.8ms+56.5) within RBM::system_log which was called:
# once (36.8ms+56.5s) by RBM::__ANON__[rbm/lib/RBM.pm:1107] at line 1107 | ||||
985 | 1 | 2µs | my ($log_file, @args) = @_; | ||
986 | 1 | 800ns | return system(@args) if $log_file eq '-'; | ||
987 | 1 | 36.6ms | if (my $pid = fork) { | ||
988 | 1 | 56.5s | 1 | 56.5s | waitpid($pid, 0); # spent 56.5s making 1 call to RBM::CORE:waitpid |
989 | 1 | 224µs | return ${^CHILD_ERROR_NATIVE}; | ||
990 | } | ||||
991 | exit_error "Could not open $log_file" unless open(STDOUT, '>>', $log_file); | ||||
992 | open(STDERR, '>&', *STDOUT); | ||||
993 | exec(@args); | ||||
994 | } | ||||
995 | |||||
996 | # spent 1692s (2.68ms+1691) within RBM::build_run which was called:
# once (2.68ms+1691s) by RBM::build_pkg at line 1168 | ||||
997 | 1 | 900ns | my ($project, $script_name, $options) = @_; | ||
998 | 1 | 1µs | my $old_step = $config->{step}; | ||
999 | 1 | 1µs | $config->{step} = $script_name; | ||
1000 | 1 | 700ns | $options //= {}; | ||
1001 | 1 | 400ns | my $error; | ||
1002 | 1 | 7µs | 3 | 3.45ms | my $dest_dir = create_dir(rbm_path(project_config($project, 'output_dir', $options))); # spent 3.15ms making 1 call to RBM::project_config
# spent 304µs making 1 call to RBM::create_dir
# spent 5µs making 1 call to RBM::rbm_path |
1003 | 1 | 3µs | 1 | 4µs | valid_project($project); # spent 4µs making 1 call to RBM::valid_project |
1004 | 1 | 728µs | 2 | 278µs | $options = { %$options, build_id => Data::UUID->new->create_str }; # spent 191µs making 1 call to Data::UUID::create_str
# spent 86µs making 1 call to Data::UUID::new |
1005 | 1 | 12µs | 2 | 426µs | my $old_cwd = getcwd; # spent 420µs making 1 call to Data::UUID::DESTROY
# spent 7µs making 1 call to Cwd::getcwd |
1006 | 1 | 3µs | 1 | 840µs | my $srcdir = project_config($project, 'build_srcdir', $options); # spent 840µs making 1 call to RBM::project_config |
1007 | 1 | 800ns | my $use_srcdir = $srcdir; | ||
1008 | 1 | 15µs | 2 | 8.09ms | my $tmpdir = File::Temp->newdir(get_tmp_dir($project, $options) # spent 7.49ms making 1 call to RBM::get_tmp_dir
# spent 602µs making 1 call to File::Temp::newdir |
1009 | . '/rbm-XXXXX'); | ||||
1010 | 1 | 300ns | my @cfiles; | ||
1011 | 1 | 1µs | if ($use_srcdir) { | ||
1012 | @cfiles = ($srcdir); | ||||
1013 | } else { | ||||
1014 | 1 | 4µs | 1 | 23µs | $srcdir = $tmpdir->dirname; # spent 23µs making 1 call to File::Temp::Dir::dirname |
1015 | 1 | 5µs | 1 | 295ms | my $tarfile = maketar($project, $options, $srcdir); # spent 295ms making 1 call to RBM::maketar |
1016 | 1 | 3µs | push @cfiles, $tarfile if $tarfile; | ||
1017 | 1 | 6µs | 1 | 867µs | push @cfiles, copy_files($project, $srcdir); # spent 867µs making 1 call to RBM::copy_files |
1018 | 1 | 20µs | 1 | 531s | push @cfiles, input_files('copy', $project, $options, $srcdir); # spent 531s making 1 call to RBM::input_files |
1019 | } | ||||
1020 | 1 | 500ns | my ($remote_tmp_src, $remote_tmp_dst, %build_script); | ||
1021 | 1 | 3µs | my @scripts = ('pre', $script_name, 'post'); | ||
1022 | 1 | 4µs | my %scripts_root = ( pre => 1, post => 1); | ||
1023 | 1 | 7µs | 1 | 145ms | if (project_config($project, "remote_exec", $options)) { # spent 145ms making 1 call to RBM::project_config |
1024 | 1 | 17µs | 1 | 161ms | my $cmd = project_config($project, "remote_start", { # spent 161ms making 1 call to RBM::project_config |
1025 | %$options, | ||||
1026 | remote_srcdir => $srcdir, | ||||
1027 | }); | ||||
1028 | 1 | 500ns | if ($cmd) { | ||
1029 | 1 | 7µs | 1 | 6.78s | my ($stdout, $stderr, $success, $exit_code) # spent 6.78s making 1 call to RBM::run_script |
1030 | = run_script($project, $cmd, \&capture_exec); | ||||
1031 | 1 | 500ns | if (!$success) { | ||
1032 | $error = "Error starting remote:\n$stdout\n$stderr"; | ||||
1033 | goto EXIT; | ||||
1034 | } | ||||
1035 | } | ||||
1036 | 1 | 800ns | foreach my $remote_tmp ($remote_tmp_src, $remote_tmp_dst) { | ||
1037 | 2 | 55µs | 4 | 301ms | $cmd = project_config($project, "remote_exec", { # spent 301ms making 4 calls to RBM::project_config, avg 75.2ms/call |
1038 | %$options, | ||||
1039 | exec_cmd => project_config($project, | ||||
1040 | "remote_mktemp", $options) || 'mktemp -d -p /var/tmp', | ||||
1041 | exec_name => 'mktemp', | ||||
1042 | exec_as_root => 0, | ||||
1043 | }); | ||||
1044 | 2 | 14µs | 2 | 411ms | my ($stdout, $stderr, $success, $exit_code) # spent 411ms making 2 calls to RBM::run_script, avg 205ms/call |
1045 | = run_script($project, $cmd, \&capture_exec); | ||||
1046 | 2 | 800ns | if (!$success) { | ||
1047 | $error = "Error connecting to remote:\n$stdout\n$stderr"; | ||||
1048 | goto EXIT; | ||||
1049 | } | ||||
1050 | 2 | 21µs | $remote_tmp = (split(/\r?\n/, $stdout))[0]; | ||
1051 | } | ||||
1052 | 1 | 10µs | my $o = { | ||
1053 | %$options, | ||||
1054 | norec => { output_dir => $remote_tmp_dst }, | ||||
1055 | }; | ||||
1056 | 1 | 3µs | foreach my $s (@scripts) { | ||
1057 | 3 | 142µs | 3 | 1089s | $build_script{$s} = project_config($project, $s, $o); # spent 1089s making 3 calls to RBM::project_config, avg 363s/call |
1058 | } | ||||
1059 | } else { | ||||
1060 | foreach my $s (@scripts) { | ||||
1061 | $build_script{$s} = project_config($project, $s, $options); | ||||
1062 | } | ||||
1063 | } | ||||
1064 | 1 | 1µs | if (!$build_script{$script_name}) { | ||
1065 | $error = "Missing $script_name config"; | ||||
1066 | goto EXIT; | ||||
1067 | } | ||||
1068 | 1 | 3µs | @scripts = grep { $build_script{$_} } @scripts; | ||
1069 | 1 | 1µs | push @cfiles, @scripts unless $use_srcdir; | ||
1070 | 1 | 2µs | foreach my $s (@scripts) { | ||
1071 | 1 | 12µs | 2 | 832µs | path("$srcdir/$s")->spew_utf8($build_script{$s}); # spent 767µs making 1 call to Path::Tiny::spew_utf8
# spent 65µs making 1 call to Path::Tiny::path |
1072 | 1 | 13µs | 1 | 6µs | chmod 0700, "$srcdir/$s"; # spent 6µs making 1 call to RBM::CORE:chmod |
1073 | } | ||||
1074 | 1 | 3µs | 1 | 20.6ms | my $build_log = project_config($project, "build_log", $options); # spent 20.6ms making 1 call to RBM::project_config |
1075 | 1 | 2µs | if ($build_log ne '-') { | ||
1076 | 1 | 2µs | 1 | 13.6ms | my $append = project_config($project, "build_log_append", $options); # spent 13.6ms making 1 call to RBM::project_config |
1077 | 1 | 3µs | 1 | 8µs | $build_log = rbm_path($build_log); # spent 8µs making 1 call to RBM::rbm_path |
1078 | 1 | 700ns | unlink $build_log unless $append; | ||
1079 | 1 | 12µs | 2 | 111µs | make_path(dirname($build_log)); # spent 98µs making 1 call to File::Basename::dirname
# spent 13µs making 1 call to File::Path::make_path |
1080 | 1 | 44µs | my $now = localtime; | ||
1081 | 1 | 12µs | 2 | 802µs | path($build_log)->append_utf8("Starting build: $now\n"); # spent 750µs making 1 call to Path::Tiny::append_utf8
# spent 53µs making 1 call to Path::Tiny::path |
1082 | 1 | 38µs | 1 | 33µs | print "Build log: $build_log\n"; # spent 33µs making 1 call to RBM::CORE:print |
1083 | } | ||||
1084 | 1 | 13µs | 1 | 6µs | chdir $srcdir; # spent 6µs making 1 call to RBM::CORE:chdir |
1085 | 1 | 300ns | my $res; | ||
1086 | 1 | 55µs | if ($remote_tmp_src && $remote_tmp_dst) { | ||
1087 | 1 | 2µs | foreach my $file (@cfiles) { | ||
1088 | 8 | 775µs | 16 | 2.01s | my $cmd = project_config($project, "remote_put", { # spent 2.01s making 8 calls to RBM::project_config, avg 251ms/call
# spent 1.07ms making 8 calls to File::Basename::dirname, avg 133µs/call |
1089 | %$options, | ||||
1090 | put_src => "$srcdir/$file", | ||||
1091 | put_dst => $remote_tmp_src . '/' . dirname($file), | ||||
1092 | exec_name => 'put', | ||||
1093 | exec_as_root => 0, | ||||
1094 | }); | ||||
1095 | 16 | 2.54s | 16 | 5.18s | # spent 2.54s (588µs+2.54) within RBM::__ANON__[rbm/lib/RBM.pm:1095] which was called 8 times, avg 317ms/call:
# 8 times (588µs+2.54s) by RBM::run_script at line 468, avg 317ms/call # spent 2.65s making 8 calls to RBM::run_script, avg 331ms/call
# spent 2.54s making 8 calls to RBM::CORE:system, avg 317ms/call |
1096 | $error = "Error uploading $file"; | ||||
1097 | goto EXIT; | ||||
1098 | } | ||||
1099 | } | ||||
1100 | 1 | 2µs | foreach my $s (@scripts) { | ||
1101 | my $cmd = project_config($project, "remote_exec", { | ||||
1102 | %$options, | ||||
1103 | exec_cmd => "cd $remote_tmp_src; ./$s", | ||||
1104 | exec_name => $s, | ||||
1105 | 1 | 278µs | 1 | 226ms | exec_as_root => $scripts_root{$s}, # spent 226ms making 1 call to RBM::project_config |
1106 | }); | ||||
1107 | 2 | 83µs | 2 | 113s | # spent 56.5s (192µs+56.5) within RBM::__ANON__[rbm/lib/RBM.pm:1107] which was called:
# once (192µs+56.5s) by RBM::run_script at line 468 # spent 56.5s making 1 call to RBM::run_script
# spent 56.5s making 1 call to RBM::system_log |
1108 | $error = "Error running $script_name"; | ||||
1109 | if (project_config($project, 'debug', $options)) { | ||||
1110 | print STDERR $error, "\nOpening debug shell\n"; | ||||
1111 | print STDERR "Warning: build files will be removed when you exit this shell.\n"; | ||||
1112 | my $cmd = project_config($project, "remote_exec", { | ||||
1113 | %$options, | ||||
1114 | exec_cmd => "cd $remote_tmp_src; PS1='debug-$project\$ ' \${SHELL-/bin/bash}", | ||||
1115 | exec_name => "debug-$s", | ||||
1116 | exec_as_root => $scripts_root{$s}, | ||||
1117 | interactive => 1, | ||||
1118 | }); | ||||
1119 | run_script($project, $cmd, sub { system(@_) }); | ||||
1120 | } | ||||
1121 | goto EXIT; | ||||
1122 | } | ||||
1123 | } | ||||
1124 | 1 | 99µs | 1 | 40.3ms | my $cmd = project_config($project, "remote_get", { # spent 40.3ms making 1 call to RBM::project_config |
1125 | %$options, | ||||
1126 | get_src => $remote_tmp_dst, | ||||
1127 | get_dst => $dest_dir, | ||||
1128 | exec_name => 'get', | ||||
1129 | exec_as_root => 0, | ||||
1130 | }); | ||||
1131 | 2 | 73.9ms | 2 | 160ms | # spent 73.8ms (99µs+73.7) within RBM::__ANON__[rbm/lib/RBM.pm:1131] which was called:
# once (99µs+73.7ms) by RBM::run_script at line 468 # spent 86.5ms making 1 call to RBM::run_script
# spent 73.7ms making 1 call to RBM::CORE:system |
1132 | $error = "Error downloading build result"; | ||||
1133 | } | ||||
1134 | 1 | 62µs | 2 | 563ms | run_script($project, project_config($project, "remote_exec", { # spent 338ms making 1 call to RBM::run_script
# spent 225ms making 1 call to RBM::project_config |
1135 | %$options, | ||||
1136 | exec_cmd => "rm -Rf $remote_tmp_src $remote_tmp_dst", | ||||
1137 | exec_name => 'clean', | ||||
1138 | exec_as_root => 0, | ||||
1139 | }), \&capture_exec); | ||||
1140 | } else { | ||||
1141 | foreach my $s (@scripts) { | ||||
1142 | my $cmd = $scripts_root{$s} ? project_config($project, 'suexec', | ||||
1143 | { suexec_cmd => "$srcdir/$s" }) : "$srcdir/$s"; | ||||
1144 | if (system_log($build_log, $cmd) != 0) { | ||||
1145 | $error = "Error running $script_name"; | ||||
1146 | if (project_config($project, 'debug', $options)) { | ||||
1147 | print STDERR $error, "\nOpening debug shell\n"; | ||||
1148 | print STDERR "Warning: build files will be removed when you exit this shell.\n"; | ||||
1149 | run_script($project, "PS1='debug-$project\$ ' \$SHELL", sub { system(@_) }); | ||||
1150 | } | ||||
1151 | } | ||||
1152 | } | ||||
1153 | } | ||||
1154 | EXIT: | ||||
1155 | 1 | 36µs | 1 | 215ms | if (project_config($project, "remote_exec", $options)) { # spent 215ms making 1 call to RBM::project_config |
1156 | 1 | 3µs | 1 | 23.0ms | my $cmd = project_config($project, "remote_finish", $options); # spent 23.0ms making 1 call to RBM::project_config |
1157 | 2 | 929ms | 2 | 1.87s | # spent 929ms (143µs+928) within RBM::__ANON__[rbm/lib/RBM.pm:1157] which was called:
# once (143µs+928ms) by RBM::run_script at line 468 # spent 939ms making 1 call to RBM::run_script
# spent 928ms making 1 call to RBM::CORE:system |
1158 | $error ||= "Error finishing remote"; | ||||
1159 | } | ||||
1160 | } | ||||
1161 | 1 | 5µs | $config->{step} = $old_step; | ||
1162 | 1 | 149µs | 1 | 3µs | chdir $old_cwd; # spent 3µs making 1 call to RBM::CORE:chdir |
1163 | 1 | 76µs | 1 | 105ms | exit_error $error if $error; # spent 105ms making 1 call to File::Temp::Dir::DESTROY |
1164 | } | ||||
1165 | |||||
1166 | # spent 1692s (16µs+1692) within RBM::build_pkg which was called:
# once (16µs+1692s) by main::build_script at line 178 of /root/tor-browser-build/rbm/rbm | ||||
1167 | 1 | 900ns | my ($project, $options) = @_; | ||
1168 | 1 | 14µs | 2 | 1692s | build_run($project, project_config($project, 'pkg_type', $options), $options); # spent 1692s making 1 call to RBM::build_run
# spent 5.12ms making 1 call to RBM::project_config |
1169 | } | ||||
1170 | |||||
1171 | sub publish { | ||||
1172 | my ($project) = @_; | ||||
1173 | project_config($project, 'publish', { error_if_undef => 1 }); | ||||
1174 | my $publish_src_dir = project_config($project, 'publish_src_dir'); | ||||
1175 | if (!$publish_src_dir) { | ||||
1176 | $publish_src_dir = File::Temp->newdir(get_tmp_dir($project) | ||||
1177 | . '/rbm-XXXXXX'); | ||||
1178 | build_pkg($project, { norec => { output_dir => $publish_src_dir } }); | ||||
1179 | } | ||||
1180 | build_run($project, 'publish', { build_srcdir => $publish_src_dir }); | ||||
1181 | } | ||||
1182 | |||||
1183 | 1 | 4µs | 1; | ||
1184 | # vim: expandtab sw=4 | ||||
# spent 246ms within RBM::CORE:chdir which was called 12110 times, avg 20µs/call:
# 5967 times (131ms+0s) by RBM::input_files at line 976, avg 22µs/call
# 5967 times (113ms+0s) by RBM::input_files at line 796, avg 19µs/call
# 87 times (722µs+0s) by RBM::git_clone_fetch_chdir at line 401, avg 8µs/call
# 86 times (991µs+0s) by RBM::execute at line 510, avg 12µs/call
# once (6µs+0s) by RBM::build_run at line 1084
# once (4µs+0s) by RBM::maketar at line 606
# once (3µs+0s) by RBM::build_run at line 1162 | |||||
sub RBM::CORE:chmod; # opcode | |||||
sub RBM::CORE:ftdir; # opcode | |||||
# spent 760µs within RBM::CORE:ftfile which was called 155 times, avg 5µs/call:
# 144 times (632µs+0s) by RBM::load_config at line 54, avg 4µs/call
# 6 times (26µs+0s) by RBM::recursive_copy at line 770, avg 4µs/call
# 2 times (52µs+0s) by RBM::sha256file at line 619, avg 26µs/call
# once (17µs+0s) by RBM::load_local_config at line 69
# once (17µs+0s) by RBM::find_config_file at line 73
# once (16µs+0s) by RBM::load_system_config at line 62 | |||||
# spent 220ms within RBM::CORE:ftis which was called 11934 times, avg 18µs/call:
# 11934 times (220ms+0s) by RBM::file_in_dir at line 724, avg 18µs/call | |||||
# spent 643µs within RBM::CORE:glob which was called:
# once (643µs+0s) by RBM::load_config at line 53 | |||||
# spent 1.30s within RBM::CORE:match which was called 1990615 times, avg 652ns/call:
# 1381750 times (660ms+0s) by RBM::get_targets at line 125, avg 478ns/call
# 608734 times (637ms+0s) by RBM::rbm_path at line 86, avg 1µs/call
# 101 times (425µs+0s) by RBM::run_script at line 464, avg 4µs/call
# 15 times (390µs+0s) by RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:16] at line 15 of (eval 14)[rbm/lib/RBM.pm:39], avg 26µs/call
# 15 times (86µs+0s) by RBM::__ANON__[(eval 14)[rbm/lib/RBM.pm:39]:10] at line 9 of (eval 14)[rbm/lib/RBM.pm:39], avg 6µs/call | |||||
# spent 51µs within RBM::CORE:mkdir which was called 6 times, avg 8µs/call:
# 6 times (51µs+0s) by RBM::input_files at line 973, avg 8µs/call | |||||
sub RBM::CORE:print; # opcode | |||||
# spent 2.20s within RBM::CORE:regcomp which was called 1381750 times, avg 2µs/call:
# 1381750 times (2.20s+0s) by RBM::get_targets at line 125, avg 2µs/call | |||||
# spent 3.62s within RBM::CORE:system which was called 12 times, avg 302ms/call:
# 8 times (2.54s+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1095] at line 1095, avg 317ms/call
# once (928ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1157] at line 1157
# once (73.7ms+0s) by RBM::__ANON__[rbm/lib/RBM.pm:1131] at line 1131
# once (65.8ms+0s) by RBM::maketar at line 599
# once (16.4ms+0s) by RBM::maketar at line 563 | |||||
# spent 1.31ms within RBM::CORE:unlink which was called 15 times, avg 88µs/call:
# 15 times (1.31ms+0s) by RBM::run_script at line 469, avg 88µs/call | |||||
# spent 52µs within RBM::CORE:utime which was called:
# once (52µs+0s) by RBM::maketar at line 604 | |||||
# spent 56.5s within RBM::CORE:waitpid which was called:
# once (56.5s+0s) by RBM::system_log at line 988 | |||||
# spent 1µs within RBM::__ANON__ which was called:
# once (1µs+0s) by RBM::BEGIN@9 at line 9 |