[tor-commits] [rbm/master] Add the build_log_append option

boklm at torproject.org boklm at torproject.org
Fri Aug 11 11:01:51 UTC 2017


commit 0f5857bb0486187fcd35c553dec9ae6d3657a98c
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Fri Aug 11 12:56:25 2017 +0200

    Add the build_log_append option
---
 NEWS                     | 2 ++
 doc/rbm_config.asc       | 5 +++++
 lib/RBM.pm               | 3 ++-
 lib/RBM/DefaultConfig.pm | 1 +
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index c43dc2d..d517840 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- Add the build_log_append option
+
 - Add the rbm_tmp_dir option
 
 - Add the input_files_paths option
diff --git a/doc/rbm_config.asc b/doc/rbm_config.asc
index dc3b5e4..1935cd3 100644
--- a/doc/rbm_config.asc
+++ b/doc/rbm_config.asc
@@ -149,6 +149,11 @@ build_log::
         The file where the build logs will be written. If the value is `-` (the
         default), the logs will be output on stdout and stderr.
 
+build_log_append::
+        If you set to +build_log_append+ to 0, the log file (defined in
+        +build_log+) will be cleaned when starting a new build. The
+        default is 1.
+
 fetch::
         The value should be 0 or 1, depending on whether the commits
         from the remote git or hg repository should be fetched
diff --git a/lib/RBM.pm b/lib/RBM.pm
index c1240cd..df29a01 100644
--- a/lib/RBM.pm
+++ b/lib/RBM.pm
@@ -1020,10 +1020,11 @@ sub build_run {
     }
     my $build_log = project_config($project, "build_log", $options);
     if ($build_log ne '-') {
+        my $append = project_config($project, "build_log_append", $options);
         $build_log = path($build_log);
         make_path(dirname($build_log));
         my $now = localtime;
-        write_file($build_log, {append => 1}, "Starting build: $now\n");
+        write_file($build_log, {append => $append}, "Starting build: $now\n");
         print "Build log: $build_log\n";
     }
     chdir $srcdir;
diff --git a/lib/RBM/DefaultConfig.pm b/lib/RBM/DefaultConfig.pm
index 63021e9..b1f97cb 100644
--- a/lib/RBM/DefaultConfig.pm
+++ b/lib/RBM/DefaultConfig.pm
@@ -126,6 +126,7 @@ our %default_config = (
     rpmspec       => '[% SET tmpl = project _ ".spec"; INCLUDE $tmpl -%]',
     build         => '[% INCLUDE build -%]',
     build_log     => '-',
+    build_log_append => '1',
     notmpl        => [ qw(projects_dir) ],
     describe      => \&git_describe,
     abbrev_lenght => '12',



More information about the tor-commits mailing list