commit 36d9a7357740ba9d7b939738b199f7ec11ce80b2 Author: Nicolas Vigier boklm@torproject.org Date: Thu Apr 27 12:19:57 2017 +0200
Add process_template_opt subroutine
In the few places where we are using process_template directly, the $options is ignored. We fix that by adding a process_template_opt subroutine which applies the $options. --- lib/RBM.pm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/RBM.pm b/lib/RBM.pm index 57a6161..3fa8d35 100644 --- a/lib/RBM.pm +++ b/lib/RBM.pm @@ -587,6 +587,15 @@ sub sha256file { return $res{$f} = -f $f ? sha256_hex(scalar read_file($f)) : ''; }
+sub process_template_opt { + my ($project, $tmpl, $opt, $dest_dir) = @_; + my $save_opt = $config->{opt}; + $config->{opt} = {%{$config->{opt}}, %$opt} if $opt; + my $res = process_template($project, $tmpl, $dest_dir); + $config->{opt} = $save_opt; + return $res; +} + sub process_template { my ($project, $tmpl, $dest_dir) = @_; return undef unless defined $tmpl; @@ -745,7 +754,7 @@ sub input_files { foreach my $input_file (@$input_files) { if (!ref $input_file) { $input_file = project_config($project, - process_template($project, $input_file), $options); + process_template_opt($project, $input_file, $options), $options); } next unless $input_file; my $t = sub { @@ -757,8 +766,8 @@ sub input_files { next; } if ($input_file->{target} && ! $input_file->{_target_processed}) { - $input_file->{target} = process_template($project, - $input_file->{target}); + $input_file->{target} = process_template_opt($project, + $input_file->{target}, $options); $input_file->{_target_processed} = 1; } if ($action eq 'getfnames') {