[tor-commits] [rbm/master] Bug 30039: Add the target_append and target_prepend input_files options

gk at torproject.org gk at torproject.org
Tue Apr 9 18:45:54 UTC 2019


commit 87adfb7b7be7e7e0f437020dbf8a119673133412
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Thu Apr 4 19:11:56 2019 +0200

    Bug 30039: Add the target_append and target_prepend input_files options
---
 NEWS                    |  2 ++
 doc/rbm_input_files.asc | 11 ++++++++++-
 lib/RBM.pm              | 23 ++++++++++++++++++++---
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 256cad9..e54f988 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- Add the target_append and target_prepend input_files options
+
 - Add the build_log_append option
 
 - Add the rbm_tmp_dir option
diff --git a/doc/rbm_input_files.asc b/doc/rbm_input_files.asc
index 2716b23..d56f125 100644
--- a/doc/rbm_input_files.asc
+++ b/doc/rbm_input_files.asc
@@ -77,7 +77,16 @@ project::
 
 target::
         An array defining the build targets for the selected project. If this
-        option is not set, the current build target is forwarded.
+        option is not set, the current build target is forwarded. If set,
+        this replaces the current targets.
+
+target_append::
+        The same as +target+, but instead of replacing the current targets,
+        the new targets are appended.
+
+target_prepend::
+        The same as +target+, but instead of replacing the current targets,
+        the new targets are prepended.
 
 enable::
         The files are enabled by default. If this option is set to
diff --git a/lib/RBM.pm b/lib/RBM.pm
index 1400700..4416a0c 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -784,10 +784,27 @@ sub input_files {
         if ($input_file->{enable} && !$t->('enable')) {
             next;
         }
-        if ($input_file->{target}) {
+        if ($input_file->{target} || $input_file->{target_append}
+                                  || $input_file->{target_prepend}) {
             $input_file = { %$input_file };
-            $input_file->{target} = process_template_opt($project,
-                                        $input_file->{target}, $options);
+            if (ref $input_file->{target} eq 'ARRAY') {
+                $input_file->{target} = process_template_opt($project,
+                                            $input_file->{target}, $options);
+            } else {
+                $input_file->{target} = $config->{run}{target};
+            }
+            if (ref $input_file->{target_prepend} eq 'ARRAY') {
+                $input_file->{target} = [ @{ process_template_opt($project,
+                                               $input_file->{target_prepend},
+                                               $options) },
+                                          @{$input_file->{target}} ];
+            }
+            if (ref $input_file->{target_append} eq 'ARRAY') {
+                $input_file->{target} = [ @{$input_file->{target}},
+                                          @{ process_template_opt($project,
+                                               $input_file->{target_append},
+                                               $options) } ];
+            }
         }
         if ($action eq 'getfnames') {
             my $getfnames_name;



More information about the tor-commits mailing list