[tbb-commits] [tor-browser-build/master] Add var/set_default_env and use it in all build scripts

boklm at torproject.org boklm at torproject.org
Sun Mar 5 17:31:10 UTC 2017


commit 73c030f1c8a7283d8343ad6ab7401ce4b6ada0ab
Author: Nicolas Vigier <boklm at torproject.org>
Date:   Sun Mar 5 18:28:04 2017 +0100

    Add var/set_default_env and use it in all build scripts
---
 projects/binutils/build              |  5 ++---
 projects/clang/build                 |  2 +-
 projects/cmake/build                 |  3 +--
 projects/firefox-langpacks/build     |  2 +-
 projects/firefox/build               |  9 +--------
 projects/fonts/build                 |  3 +--
 projects/gcc/build                   |  2 +-
 projects/gmp/build                   |  3 +--
 projects/go/build                    |  3 +--
 projects/go/config                   |  3 +--
 projects/https-everywhere/build      |  4 ++--
 projects/libdmg-hfsplus/build        |  4 ++--
 projects/libevent/build              |  3 +--
 projects/llvm/build                  |  3 +--
 projects/macosx-toolchain-gcc/build  |  3 +--
 projects/macosx-toolchain/build      |  5 ++---
 projects/meek/build                  |  3 +--
 projects/mingw-w64/build             |  5 ++---
 projects/nsis/build                  |  5 ++---
 projects/obfs4/build                 |  3 +--
 projects/openssl/build               |  3 +--
 projects/release/config              |  3 +--
 projects/sandbox/build               |  3 +--
 projects/tbb-windows-installer/build |  2 +-
 projects/tor-browser/build           |  6 +-----
 projects/tor-launcher/build          |  4 ++--
 projects/tor/build                   |  6 +-----
 projects/torbutton/build             |  4 ++--
 projects/zlib/build                  |  6 +-----
 rbm.conf                             | 10 ++++++++++
 30 files changed, 47 insertions(+), 73 deletions(-)

diff --git a/projects/binutils/build b/projects/binutils/build
index cdd01a6..e3064cf 100644
--- a/projects/binutils/build
+++ b/projects/binutils/build
@@ -1,6 +1,5 @@
-#!/bin/sh
-set -e
-rootdir=$(pwd)
+#!/bin/bash
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/binutils
 [% IF c("var/linux") %]
   # Config options for hardening-wrapper
diff --git a/projects/clang/build b/projects/clang/build
index 380ca1c..ac0f21b 100644
--- a/projects/clang/build
+++ b/projects/clang/build
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -e
+[% c("var/set_default_env") -%]
 tar xf [% project %]-[% c("version") %].tar.gz
 mv [% project %]-[% c("version") %] [% project %]
 [% c('tar', {
diff --git a/projects/cmake/build b/projects/cmake/build
index d59522a..dd5017a 100644
--- a/projects/cmake/build
+++ b/projects/cmake/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
 tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
diff --git a/projects/firefox-langpacks/build b/projects/firefox-langpacks/build
index 82e5452..9ac07cb 100644
--- a/projects/firefox-langpacks/build
+++ b/projects/firefox-langpacks/build
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -e
+[% c("var/set_default_env") -%]
 
 [% FOREACH lang = c('var/locales') %]
 [% SET lang = tmpl(lang) %]
diff --git a/projects/firefox/build b/projects/firefox/build
index 7610510..453f6b3 100644
--- a/projects/firefox/build
+++ b/projects/firefox/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% IF c("var/windows") -%]
   mkdir -p /var/tmp/dist
   tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/gcc') %]
@@ -17,12 +16,6 @@ rootdir=$(pwd)
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
 
-export SHELL=/bin/bash
-export HOME=$rootdir
-export TZ=UTC
-export LC_ALL=C
-umask 0022
-
 [% IF c("var/linux") %]
 tar xf $rootdir/[% c('input_files_by_name/binutils') %]
 export PATH="/var/tmp/dist/binutils/bin:$PATH"
diff --git a/projects/fonts/build b/projects/fonts/build
index 4984c3b..e645c31 100644
--- a/projects/fonts/build
+++ b/projects/fonts/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/fonts
 mkdir -p $distdir
 tar xf [% project %]-[% c("version") %].tar.gz
diff --git a/projects/gcc/build b/projects/gcc/build
index 03cfcbd..1c24af7 100644
--- a/projects/gcc/build
+++ b/projects/gcc/build
@@ -1,5 +1,5 @@
 #!/bin/sh
-set -e
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 mkdir /var/tmp/build
 tar -C /var/tmp/build -xf [% project %]-[% c("version") %].tar.bz2
diff --git a/projects/gmp/build b/projects/gmp/build
index d7b3b14..34173d6 100644
--- a/projects/gmp/build
+++ b/projects/gmp/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
diff --git a/projects/go/build b/projects/go/build
index 2efd928..72117f6 100644
--- a/projects/go/build
+++ b/projects/go/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/dist
 
diff --git a/projects/go/config b/projects/go/config
index 9341f98..5e55a09 100644
--- a/projects/go/config
+++ b/projects/go/config
@@ -20,8 +20,7 @@ var:
   # a list of install targets.
   build_go_lib: |
     #!/bin/bash
-    set -e
-    rootdir=$(pwd)
+    [% c("var/set_default_env") -%]
     [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
     distdir=/var/tmp/dist/[% project %]
     mkdir -p /var/tmp/build
diff --git a/projects/https-everywhere/build b/projects/https-everywhere/build
index 6e49e7b..71b2a21 100644
--- a/projects/https-everywhere/build
+++ b/projects/https-everywhere/build
@@ -1,5 +1,5 @@
-#!/bin/sh
-set -e
+#!/bin/bash
+[% c("var/set_default_env") -%]
 tar xf [% project %]-[% c('version') %].tar.gz
 cd [% project %]-[% c('version') %]
 # patch makexpi.sh because we don't have a git repository
diff --git a/projects/libdmg-hfsplus/build b/projects/libdmg-hfsplus/build
index 2903150..47a5e43 100644
--- a/projects/libdmg-hfsplus/build
+++ b/projects/libdmg-hfsplus/build
@@ -1,5 +1,5 @@
-#!/bin/sh
-set -e
+#!/bin/bash
+[% c("var/set_default_env") -%]
 distdir=$(pwd)/dist
 mkdir -p $distdir/[% project %]
 tar xf [% project %]-[% c('version') %].tar.gz
diff --git a/projects/libevent/build b/projects/libevent/build
index 8aa85fc..2bed816 100644
--- a/projects/libevent/build
+++ b/projects/libevent/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
diff --git a/projects/llvm/build b/projects/llvm/build
index bdf7576..3773cfd 100644
--- a/projects/llvm/build
+++ b/projects/llvm/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/dist
 tar -C /var/tmp/dist -xf [% c('input_files_by_name/cmake') %]
diff --git a/projects/macosx-toolchain-gcc/build b/projects/macosx-toolchain-gcc/build
index 778194d..4a8f0db 100644
--- a/projects/macosx-toolchain-gcc/build
+++ b/projects/macosx-toolchain-gcc/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 destdir='[% dest_dir _ '/' _ c('filename') %]'
 mkdir -p "$destdir"
 mv -f [% c('input_files_by_name/SDK') %] "$destdir"/apple-uni-sdk.deb
diff --git a/projects/macosx-toolchain/build b/projects/macosx-toolchain/build
index b263940..b718023 100644
--- a/projects/macosx-toolchain/build
+++ b/projects/macosx-toolchain/build
@@ -1,6 +1,5 @@
-#!/bin/sh
-set -e
-rootdir=$(pwd)
+#!/bin/bash
+[% c("var/set_default_env") -%]
 distdir="/var/tmp/dist/[% project %]"
 mkdir -p "$distdir"
 tar xzf [% c('input_files_by_name/SDK') %]
diff --git a/projects/meek/build b/projects/meek/build
index 283066a..8d1beb7 100644
--- a/projects/meek/build
+++ b/projects/meek/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
 distdir=/var/tmp/dist/[% project %]
 [% IF c("var/osx") %]
diff --git a/projects/mingw-w64/build b/projects/mingw-w64/build
index 39361e7..42ee716 100644
--- a/projects/mingw-w64/build
+++ b/projects/mingw-w64/build
@@ -1,6 +1,5 @@
-#!/bin/sh
-set -e
-rootdir=$(pwd)
+#!/bin/bash
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
 
 mkdir /var/tmp/build
diff --git a/projects/nsis/build b/projects/nsis/build
index 48f1cb1..af19dd7 100755
--- a/projects/nsis/build
+++ b/projects/nsis/build
@@ -1,6 +1,5 @@
-#!/bin/sh
-set -e
-rootdir=$(pwd)
+#!/bin/bash
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 # remove hardening wrappers
 rm -Rf /var/tmp/dist/mingw-w64/helpers
diff --git a/projects/obfs4/build b/projects/obfs4/build
index ff313e9..61ef481 100644
--- a/projects/obfs4/build
+++ b/projects/obfs4/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
 distdir=/var/tmp/dist/[% project %]
 [% IF c("var/osx") %]
diff --git a/projects/openssl/build b/projects/openssl/build
index acd7bbb..3a5365e 100644
--- a/projects/openssl/build
+++ b/projects/openssl/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
diff --git a/projects/release/config b/projects/release/config
index e2b2eb9..f6712c0 100644
--- a/projects/release/config
+++ b/projects/release/config
@@ -119,8 +119,7 @@ input_files:
 
 build: |
   #!/bin/sh
-  set -e
-  export LC_ALL=C
+  [% c("var/set_default_env") -%]
   destdir="[% dest_dir _ '/' _ c("var/publish_dir") %]"
   mkdir -p "$destdir"
   [% IF c("var/torbrowser-windows-i686") -%]
diff --git a/projects/sandbox/build b/projects/sandbox/build
index 28b5a48..8a3edb3 100644
--- a/projects/sandbox/build
+++ b/projects/sandbox/build
@@ -1,6 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 [% pc('go', 'var/setup', { go_tarfile => c('input_files_by_name/go') }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p $distdir
diff --git a/projects/tbb-windows-installer/build b/projects/tbb-windows-installer/build
index 380ca1c..ac0f21b 100644
--- a/projects/tbb-windows-installer/build
+++ b/projects/tbb-windows-installer/build
@@ -1,5 +1,5 @@
 #!/bin/bash
-set -e
+[% c("var/set_default_env") -%]
 tar xf [% project %]-[% c("version") %].tar.gz
 mv [% project %]-[% c("version") %] [% project %]
 [% c('tar', {
diff --git a/projects/tor-browser/build b/projects/tor-browser/build
index 4eeb350..904f1b6 100644
--- a/projects/tor-browser/build
+++ b/projects/tor-browser/build
@@ -1,11 +1,7 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
+[% c("var/set_default_env") -%]
 distdir=/var/tmp/dist/[% project %]
-export TZ=UTC
-export LC_ALL=C
 export TORBROWSER_VERSION='[% c("version") %]'
-umask 0022
 
 mkdir -p $distdir
 
diff --git a/projects/tor-launcher/build b/projects/tor-launcher/build
index 69e01b3..90c5268 100644
--- a/projects/tor-launcher/build
+++ b/projects/tor-launcher/build
@@ -1,5 +1,5 @@
-#!/bin/sh
-set -e
+#!/bin/bash
+[% c("var/set_default_env") -%]
 tar xvf [% project %]-[% c('version') %].tar.gz
 cd [% project %]-[% c('version') %]
 make package
diff --git a/projects/tor/build b/projects/tor/build
index f0b57f1..c56cddc 100644
--- a/projects/tor/build
+++ b/projects/tor/build
@@ -1,9 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
-export TZ=UTC
-export LC_ALL=C
-umask 0022
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
diff --git a/projects/torbutton/build b/projects/torbutton/build
index b7a7262..38136c4 100644
--- a/projects/torbutton/build
+++ b/projects/torbutton/build
@@ -1,5 +1,5 @@
-#!/bin/sh
-set -e
+#!/bin/bash
+[% c("var/set_default_env") -%]
 tar xvf [% project %]-[% c('version') %].tar.gz
 cd [% project %]-[% c('version') %]
 mkdir -p pkg
diff --git a/projects/zlib/build b/projects/zlib/build
index fdcfbfb..4031ef5 100644
--- a/projects/zlib/build
+++ b/projects/zlib/build
@@ -1,9 +1,5 @@
 #!/bin/bash
-set -e
-rootdir=$(pwd)
-export TZ=UTC
-export LC_ALL=C
-umask 0022
+[% c("var/set_default_env") -%]
 [% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
 distdir=/var/tmp/dist/[% project %]
 mkdir -p /var/tmp/build
diff --git a/rbm.conf b/rbm.conf
index b2fb21a..e5c69b0 100644
--- a/rbm.conf
+++ b/rbm.conf
@@ -67,6 +67,16 @@ var:
     mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
     rm -Rf "$rezip_tmpdir"
 
+  set_default_env: |
+    set -e
+    [% FOREACH env = c('ENV') -%]
+    export [% env.key %]="[% env.value %]"
+    [% END -%]
+    rootdir=$(pwd)
+    export SHELL=/bin/bash
+    export HOME=$rootdir
+    umask 0022
+
 targets:
   notarget: linux-x86_64
   noint:



More information about the tbb-commits mailing list