rbm.conf 12.7 KB
Newer Older
boklm's avatar
boklm committed
1
# vim: filetype=yaml sw=2
2
debug: '[% GET ! ENV.RBM_NO_DEBUG %]'
boklm's avatar
boklm committed
3
4
compress_tar: gz
output_dir: "out/[% project %]"
5
tmp_dir: '[% c("basedir") %]/tmp'
6
build_log: '[% GET ENV.RBM_LOGS_DIR ? ENV.RBM_LOGS_DIR : "logs" %]/[% project %][% IF c("var/osname") %]-[% c("var/osname") %][% END %].log'
boklm's avatar
boklm committed
7
8
9

pkg_type: build

10
11
12
13
# buildconf contains build options that the user can change in rbm.local.conf
# When adding a new option to buildconf, a default value should be defined
# in var/build_id, so that changing this option does not affect the build_id.
buildconf:
14
  num_procs: '[% GET ENV.RBM_NUM_PROCS ? ENV.RBM_NUM_PROCS : "4" %]'
boklm's avatar
boklm committed
15
  git_signtag_opt: '-s'
16

boklm's avatar
boklm committed
17
var:
Georg Koppen's avatar
Georg Koppen committed
18
  torbrowser_version: '8.0a9'
Georg Koppen's avatar
Georg Koppen committed
19
  torbrowser_build: 'build3'
20
  torbrowser_incremental_from:
Georg Koppen's avatar
Georg Koppen committed
21
    - 8.0a8
boklm's avatar
boklm committed
22
  project_name: tor-browser
boklm's avatar
boklm committed
23
  multi_lingual: 0
boklm's avatar
boklm committed
24
  build_mar: 1
25
26
27
28
29
  # By default, we sort the list of installed packages. This allows sharing
  # containers with identical list of packages, even if they are not listed
  # in the same order. In the cases where the installation order is
  # important, sort_deps should be set to 0.
  sort_deps: 1
30
  build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]'
boklm's avatar
boklm committed
31
32
  build_id_txt: |
    [% c("version") %]
boklm's avatar
boklm committed
33
    [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
boklm's avatar
boklm committed
34
35
36
    [% IF c("var/container/use_container") -%]
    [% c("var/container/suite") %]
    [% c("var/container/arch") %]
boklm's avatar
boklm committed
37
38
39
40
    [% END -%]
    input_files: [% c("input_files_id") %]
    build:
    [% c("build", { filename => 'f', output_dir => '/out' }) %]
boklm's avatar
boklm committed
41
  container:
42
    dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]'
boklm's avatar
boklm committed
43
    user: rbm
boklm's avatar
boklm committed
44
45
46
47
48
  input_files_list: |
    [% FOREACH file IN c("input_files_by_name").keys.sort -%]
    [% c("input_files_by_name/" _ file) %]
    [% END -%]

boklm's avatar
boklm committed
49
  faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
boklm's avatar
boklm committed
50
51
  touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"

boklm's avatar
boklm committed
52
53
54
  locale_ja: ja
  locales:
    - ar
55
    - ca
56
    - da
boklm's avatar
boklm committed
57
58
59
60
    - de
    - es-ES
    - fa
    - fr
61
    - ga-IE
62
    - he
63
64
    - id
    - is
boklm's avatar
boklm committed
65
66
67
    - it
    - '[% c("var/locale_ja") %]'
    - ko
68
    - nb-NO
boklm's avatar
boklm committed
69
70
71
72
    - nl
    - pl
    - pt-BR
    - ru
73
    - sv-SE
boklm's avatar
boklm committed
74
75
76
    - tr
    - vi
    - zh-CN
77
    - zh-TW
boklm's avatar
boklm committed
78

79
80
81
  sign_build: '[% ENV.RBM_SIGN_BUILD %]'
  sign_build_gpg_opts: '[% ENV.RBM_GPG_OPTS %]'

boklm's avatar
boklm committed
82
83
84
85
86
87
88
89
90
91
92
93
  rezip: |
    rezip_tmpdir=$(mktemp -d)
    mkdir -p "$rezip_tmpdir/z"
    unzip -d "$rezip_tmpdir/z" -- [% c("rezip_file") %] || [ $? -lt 3 ]
    pushd "$rezip_tmpdir/z"
    [% c("zip", {
      zip_src => [ '.' ],
      zip_args => '$rezip_tmpdir/new.zip',
    }) %]
    popd
    mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
    rm -Rf "$rezip_tmpdir"
boklm's avatar
boklm committed
94

95
96
97
98
99
100
101
102
103
104
  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

boklm's avatar
boklm committed
105
106
107
108
109
  DOCSDIR_project: '[% project %]'
  set_PTDIR_DOCSDIR: |
    PTDIR="$distdir/TorBrowser/Tor/PluggableTransports"
    DOCSDIR="$distdir/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"

boklm's avatar
boklm committed
110
111
112
113
targets:
  notarget: linux-x86_64
  noint:
    debug: 0
boklm's avatar
boklm committed
114

115
116
117
  release:
    var:
      release: 1
118
      channel: release
119
120
  alpha:
    var:
121
122
      alpha: 1
      channel: alpha
boklm's avatar
boklm committed
123
  nightly:
124
    fetch: 1
boklm's avatar
boklm committed
125
    var:
126
      nightly: 1
127
      channel: nightly
128
      torbrowser_version: tbb-nightly
boklm's avatar
boklm committed
129

boklm's avatar
boklm committed
130
131
132
133
134
135
136
137
138
139
  torbrowser-testbuild:
    - testbuild
    - alpha
  testbuild:
    var:
      # To make build faster, don't build any locale
      locales: []
      # Don't create mar files to save time
      build_mar: 0

boklm's avatar
boklm committed
140
141
142
  torbrowser-linux-x86_64:
    - linux-x86_64
    - linux
boklm's avatar
boklm committed
143
144
145
146
  torbrowser-linux-x86_64-debug:
    - linux-debug
    - linux-x86_64
    - linux
boklm's avatar
boklm committed
147
148
149
  torbrowser-linux-i686:
    - linux-i686
    - linux
boklm's avatar
boklm committed
150
151
152
  linux-x86_64:
    arch: x86_64
    var:
boklm's avatar
boklm committed
153
      linux-x86_64: 1
boklm's avatar
boklm committed
154
      osname: linux-x86_64
155
156
      container:
        arch: amd64
boklm's avatar
boklm committed
157
158
159
  linux-i686:
    arch: i686
    var:
boklm's avatar
boklm committed
160
      linux-i686: 1
boklm's avatar
boklm committed
161
      osname: linux-i686
162
163
164
165
166
167
168
169
170
171
172
173
      container:
        arch: i386
      setarch: |
        if test -z "$RBM_SETARCH"
        then
           export RBM_SETARCH=1
           exec setarch i686 ./build
        fi
  linux:
    var:
      linux: 1
      compiler: gcc
174
      # We only build snowflake for linux on the alpha and nightly channels for now.
175
      snowflake: '[% c("var/alpha") || c("var/nightly") %]'
176
      fteproxy: 1
177
      selfrando: '[% c("var/linux-x86_64") && ! c("var/release") %]'
178
179
      container:
        suite: wheezy
boklm's avatar
boklm committed
180
181
182
183
184
185
186
187
188
      deps:
        - build-essential
        - python
        - bison
        - hardening-wrapper
        - automake
        - libtool
        - zip
        - unzip
boklm's avatar
boklm committed
189
190
191
  linux-debug:
    var:
      asan: 1
boklm's avatar
boklm committed
192
193
194

  torbrowser-windows-i686:
    - windows-i686
195
196
197
198
199
200
201
202
203
204
205
    - windows
  torbrowser-windows-x86_64:
    - windows-x86_64
    - windows
  windows-x86_64:
    arch: x86_64
    var:
      windows-x86_64: 1
      osname: windows-x86_64
      container:
        arch: amd64
206
      faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
boklm's avatar
boklm committed
207
208
209
  windows-i686:
    arch: i686
    var:
210
      windows-i686: 1
boklm's avatar
boklm committed
211
      osname: windows-i686
boklm's avatar
boklm committed
212
      container:
213
        arch: i386
214
      faketime_path: /usr/lib/i386-linux-gnu/faketime/libfaketime.so.1
215
216
217
218
219
220
      setarch: |
        if test -z "$RBM_SETARCH"
        then
           export RBM_SETARCH=1
           exec setarch i686 ./build
        fi
221
      fteproxy: 1
222
223
224
225
  windows:
    var:
      windows: 1
      container:
226
        suite: jessie
227
      configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
228
229
      CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
      LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_mwindows") %]'
boklm's avatar
boklm committed
230
      flag_mwindows: '-mwindows'
boklm's avatar
boklm committed
231
      compiler: mingw-w64
boklm's avatar
boklm committed
232
233
234
235
236
237
238
239
      deps:
        - build-essential
        - python
        - bison
        - automake
        - libtool
        - zip
        - unzip
boklm's avatar
boklm committed
240
241
242

  torbrowser-osx-x86_64:
    - osx-x86_64
boklm's avatar
boklm committed
243
244
245
246
247
  osx-x86_64:
    arch: x86_64
    var:
      osx: 1
      osname: osx-x86_64
boklm's avatar
boklm committed
248
249
250
      container:
        suite: jessie
        arch: amd64
boklm's avatar
boklm committed
251
      compiler: 'macosx-toolchain'
252
253
      configure_opt: '--host=x86_64-apple-darwin11 CC="x86_64-apple-darwin11-clang [% c("var/FLAGS") %]" CXX="x86_64-apple-darwin11-clang++ [% c("var/FLAGS") %]"'
      FLAGS: "-target x86_64-apple-darwin11 -B $cctoolsdir -isysroot $sysrootdir"
254
      LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
boklm's avatar
boklm committed
255
      locale_ja: ja-JP-mac
256
      # We only build snowflake for linux on the alpha and nightly channels for now.
257
      snowflake: '[% c("var/alpha") || c("var/nightly") %]'
boklm's avatar
boklm committed
258
259
260
261
262
263
264
265
      deps:
        - build-essential
        - python
        - bison
        - automake
        - libtool
        - zip
        - unzip
266
      faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
boklm's avatar
boklm committed
267
268
269
      set_PTDIR_DOCSDIR: |
        PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
        DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
boklm's avatar
boklm committed
270
271
272
273
274

  # The no_build_id target can be useful if you want to quickly display
  # a build template or other option but don't want to spend time to
  # compute the various build ids
  no_build_id:
275
276
277
278
279
280
    # The defaut timestamp value will use the commit time of the
    # selected commit for the project, which will require cloning the
    # git repository if it is not present. When we use the no_build_id
    # target to display a script, we usually don't care about such
    # details, so we set timestamp to 0 to avoid unnecessary cloning.
    timestamp: 0
boklm's avatar
boklm committed
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
    var:
      build_id: 1


# change the default gpg_wrapper to allow git tag signed using an
# expired key.
# https://bugs.torproject.org/19737
gpg_wrapper: |
  #!/bin/bash
  export LC_ALL=C
  [%
      IF c('gpg_keyring');
          SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
      END;
  -%]
296
297
298
299
300
  # git >= 2.10.0-rc0 is calling gpg with 5 args. See #20757
  if ( [ $# -eq 4 ] && [ "$1" = '--status-fd=1' ] \
      && [ "$2" = '--verify' ] ) \
      || ( [ $# -eq 5 ] && [ "$1" = '--status-fd=1' ] \
           && [ "$2" = '--keyid-format=long' ] && [ "$3" = '--verify' ] )
boklm's avatar
boklm committed
301
302
303
304
305
306
  then
        [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
        exit ${PIPESTATUS[0]}
  else
        exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  fi
boklm's avatar
boklm committed
307

boklm's avatar
boklm committed
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
remote_start: '[% IF c("var/container/use_container") %][% c("runc/remote_start") %][% END %]'
remote_exec: '[% IF c("var/container/use_container") %][% c("runc/remote_exec") %][% END %]'
remote_put: '[% IF c("var/container/use_container") %][% c("runc/remote_put") %][% END %]'
remote_get: '[% IF c("var/container/use_container") %][% c("runc/remote_get") %][% END %]'
remote_finish: '[% IF c("var/container/use_container") %][% c("runc/remote_finish") %][% END %]'

runc:
  remote_start: |
    #!/bin/sh
    set -e
    if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
    then
      echo "Can't find container image in input files" >&2
      ls -l '[% c("remote_srcdir") %]' >&2
      exit 1
    fi
    mkdir -p '[% c("var/container/dir") %]'/rootfs/rbm
    sudo tar -C '[% c("var/container/dir") %]'/rootfs -xf $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*)
    [% SET user = c("var/container/user") -%]
    [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'id ' _ user
        _ ' >/dev/null 2>&1 || adduser -m ' _ user _ ' || useradd -m ' _ user }) %]

  remote_exec: |
    #!/bin/sh
    set -e
333
334
335
    [% IF c("interactive") -%]
      echo Container directory: [% shell_quote(c("var/container/dir")) %]
    [% END -%]
boklm's avatar
boklm committed
336
337
338
339
340
341
342
343
    mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/rbm
    echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/cmd
    echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rootfs/rbm/cmd
    echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/run
    [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
    echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rootfs/rbm/run
    chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/cmd
    chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/run
344
345
346
    cat > '[% c("var/container/dir") %]'/config.json << EOF
    [% INCLUDE 'runc-config.json' %]
    EOF
boklm's avatar
boklm committed
347
    sudo runc [% IF c("var_p/runc100") %]run[% ELSE %]start[% END %] -b '[% c("var/container/dir") %]' rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %] [% IF c("runc_hide_stderr") %]2>/dev/null[% END %]
boklm's avatar
boklm committed
348
349
350
351
352
353
354
355
356
357

  remote_put: |
    #!/bin/sh
    set -e
    [%
      SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
      SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
    -%]
    sudo mkdir -p '[% c("var/container/dir") %]'/rootfs/[% dst %]
    sudo cp -aP [% src %] '[% c("var/container/dir") %]'/rootfs/[% dst %]
358
359
360
361
    # On Ubuntu, the /root/.profile file contains a `mesg n` line which is
    # producing some `stdin: is not a tty` messages. To hide them, we hide
    # stderr from this part by setting runc_hide_stderr.
    [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'chown -R ' _ c("var/container/user") _ ' ' _ dst, runc_hide_stderr => 1 }) %]
boklm's avatar
boklm committed
362
363
364
365
366
367
368
369
370
371

  remote_get: |
    #!/bin/sh
    set -e
    [%
      SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
      SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
    -%]
    mkdir -p [% dst %]
    srcdir='[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/[% src %]
372
    sudo chown -R $(whoami) "$srcdir"
boklm's avatar
boklm committed
373
374
    if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ]
    then
375
      mv -f "$srcdir"/* [% dst %]/
boklm's avatar
boklm committed
376
377
378
379
380
381
382
383
    fi

  remote_finish: |
    #!/bin/sh
    set -e
    sudo rm -Rf '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs '[% c("var/container/dir", { error_if_undef => 1 }) %]'/config.json
    rmdir '[% c("var/container/dir") %]'

boklm's avatar
boklm committed
384
385
386
ENV:
  TZ: UTC
  LC_ALL: C
boklm's avatar
boklm committed
387
388
389
390
391
392
--- |
  # This part of the file contains options written in perl
  use IO::CaptureOutput qw(capture_exec);
  (
    var_p => {
      # runc100 is true if we are using runc >= 1.0.0
393
      # we assume that any version that is not 0.1.1 is >= 1.0.0
boklm's avatar
boklm committed
394
      runc100 => sub {
395
396
        my ($out) = capture_exec('sudo', 'runc', '--version');
        return !($out =~ m/^runc version 0.1.1/);
boklm's avatar
boklm committed
397
      },
398
      # runc_spec100 is true if runc spec is at least 1.0.0
399
400
401
      # We will need to update this when there is a new spec version available
      runc_spec100 => sub {
        my ($out) = capture_exec('sudo', 'runc', '--version');
402
        return $out =~ m/^.*spec: 1\.[0-9]+\.[0-9]+$/m;
403
      },
boklm's avatar
boklm committed
404
405
    },
  )