[tor-commits] [rbm/master] Bug 40020: Set origin_step in project_step_config and build_run
gk at torproject.org
gk at torproject.org
Mon Apr 26 15:19:10 UTC 2021
commit 80a3350a52d66e95684e351ec925ad3dfa93d691
Author: Nicolas Vigier <boklm at torproject.org>
Date: Wed Apr 21 17:37:05 2021 +0200
Bug 40020: Set origin_step in project_step_config and build_run
---
doc/rbm_input_files.asc | 6 ++++--
doc/rbm_templates.asc | 4 +++-
lib/RBM.pm | 18 +++++++++---------
3 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/doc/rbm_input_files.asc b/doc/rbm_input_files.asc
index 55aaebf..abe366b 100644
--- a/doc/rbm_input_files.asc
+++ b/doc/rbm_input_files.asc
@@ -70,12 +70,14 @@ project::
of this project. You can add config options such as +version+,
+git_hash+ or +target+ to configure the build. The command line
options are not forwarded. The name of the current project is
- available to that other project in the +origin_project+ option.
+ available to that other project in the +origin_project+ option,
+ and the current step in the +origin_step+ option.
pkg_type::
When the input file is an other project, this option can be
used to select a different type of build (which we call a step).
- This is equivalent to the --step command line option.
+ This is equivalent to the --step command line option. The
+ previous step is available in the +origin_step+ option.
target::
An array defining the build targets for the selected project. If this
diff --git a/doc/rbm_templates.asc b/doc/rbm_templates.asc
index 4c1a619..200043f 100644
--- a/doc/rbm_templates.asc
+++ b/doc/rbm_templates.asc
@@ -82,7 +82,9 @@ pc::
used in this lookup. The current +target+ is used, unless an
other +target+ option is defined in the options argument. The
current project name is available to the requested option in
- the +origin_project+ option.
+ the +origin_project+ option. The current +step+ is used, unless
+ an other +step+ option is defined in the options argument. The
+ previous step is available in the +origin_step+ option.
project::
The name of the project for which we are processing a template.
diff --git a/lib/RBM.pm b/lib/RBM.pm
index 57b5dde..1fadf52 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -253,16 +253,15 @@ sub project_config {
}
sub project_step_config {
- my $run_save = $config->{run};
- my $step_save = $config->{step};
- if ($_[2] && $_[2]->{step}) {
- $config->{step} = $_[2]->{step};
- }
+ my ($run_save, $step_save, $origin_step_save) =
+ ($config->{run}, $config->{step}, $config->{origin_step});
+ $config->{origin_step} = $config->{step};
+ $config->{step} = $_[2]->{step} if $_[2]->{step};
$config->{run} = { target => $_[2]->{target} };
$config->{run}{target} //= $run_save->{target};
my $res = project_config(@_);
- $config->{run} = $run_save;
- $config->{step} = $step_save;
+ ($config->{run}, $config->{step}, $config->{origin_step}) =
+ ($run_save, $step_save, $origin_step_save);
return $res;
}
@@ -1021,7 +1020,8 @@ sub log_end_time {
sub build_run {
my ($project, $script_name, $options) = @_;
- my $old_step = $config->{step};
+ my ($old_step, $old_origin_step) = ($config->{step}, $config->{origin_step});
+ $config->{origin_step} = $config->{step};
$config->{step} = $script_name;
$options //= {};
my $error;
@@ -1185,7 +1185,7 @@ sub build_run {
$error ||= "Error finishing remote";
}
}
- $config->{step} = $old_step;
+ ($config->{step}, $config->{origin_step}) = ($old_step, $old_origin_step);
chdir $old_cwd;
exit_error $error if $error;
}
More information about the tor-commits
mailing list