rbm.conf 12.3 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 %]-[% c("var/osname") %].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:
boklm's avatar
boklm committed
18
  torbrowser_version: '7.5a4'
boklm's avatar
boklm committed
19
  torbrowser_build: 'build2'
20
21
22
  torbrowser_incremental_from:
    - 7.5a2
    - 7.5a3
boklm's avatar
boklm committed
23
  project_name: tor-browser
boklm's avatar
boklm committed
24
  multi_lingual: 0
boklm's avatar
boklm committed
25
  build_mar: 1
26
27
28
29
30
  # 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
31
  build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]'
boklm's avatar
boklm committed
32
33
  build_id_txt: |
    [% c("version") %]
boklm's avatar
boklm committed
34
    [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
boklm's avatar
boklm committed
35
36
37
    [% IF c("var/container/use_container") -%]
    [% c("var/container/suite") %]
    [% c("var/container/arch") %]
boklm's avatar
boklm committed
38
39
40
41
    [% END -%]
    input_files: [% c("input_files_id") %]
    build:
    [% c("build", { filename => 'f', output_dir => '/out' }) %]
boklm's avatar
boklm committed
42
  container:
43
    dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]'
boklm's avatar
boklm committed
44
    user: rbm
boklm's avatar
boklm committed
45
46
47
48
49
  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
50
  faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
boklm's avatar
boklm committed
51
52
  touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"

boklm's avatar
boklm committed
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
  locale_ja: ja
  locales:
    - ar
    - de
    - es-ES
    - fa
    - fr
    - it
    - '[% c("var/locale_ja") %]'
    - ko
    - nl
    - pl
    - pt-BR
    - ru
    - tr
    - vi
    - zh-CN

71
72
73
  sign_build: '[% ENV.RBM_SIGN_BUILD %]'
  sign_build_gpg_opts: '[% ENV.RBM_GPG_OPTS %]'

boklm's avatar
boklm committed
74
75
76
77
78
79
80
81
82
83
84
85
  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
86

87
88
89
90
91
92
93
94
95
96
  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
97
98
99
100
101
  DOCSDIR_project: '[% project %]'
  set_PTDIR_DOCSDIR: |
    PTDIR="$distdir/TorBrowser/Tor/PluggableTransports"
    DOCSDIR="$distdir/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"

boklm's avatar
boklm committed
102
103
104
105
targets:
  notarget: linux-x86_64
  noint:
    debug: 0
boklm's avatar
boklm committed
106

107
108
109
110
111
112
  release:
    var:
      release: 1
  alpha:
    var:
      alpha:1
boklm's avatar
boklm committed
113
114
  nightly:
    var:
115
      nightly: 1
116
      torbrowser_version: tbb-nightly
boklm's avatar
boklm committed
117

boklm's avatar
boklm committed
118
119
120
121
122
123
124
125
126
127
  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
128
129
130
131
132
133
  torbrowser-linux-x86_64:
    - linux-x86_64
    - linux
  torbrowser-linux-i686:
    - linux-i686
    - linux
boklm's avatar
boklm committed
134
135
136
  linux-x86_64:
    arch: x86_64
    var:
boklm's avatar
boklm committed
137
      linux-x86_64: 1
boklm's avatar
boklm committed
138
      osname: linux-x86_64
139
140
      container:
        arch: amd64
boklm's avatar
boklm committed
141
142
143
  linux-i686:
    arch: i686
    var:
boklm's avatar
boklm committed
144
      linux-i686: 1
boklm's avatar
boklm committed
145
      osname: linux-i686
146
147
148
149
150
151
152
153
154
155
156
157
      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
boklm's avatar
boklm committed
158
      # We only build snowflake on linux and osx for now
boklm's avatar
boklm committed
159
      snowflake: 1
160
      fteproxy: 1
161
162
      container:
        suite: wheezy
boklm's avatar
boklm committed
163
164
165
166
167
168
169
170
171
      deps:
        - build-essential
        - python
        - bison
        - hardening-wrapper
        - automake
        - libtool
        - zip
        - unzip
boklm's avatar
boklm committed
172
173
174

  torbrowser-windows-i686:
    - windows-i686
boklm's avatar
boklm committed
175
176
177
178
179
  windows-i686:
    arch: i686
    var:
      windows: 1
      osname: windows-i686
boklm's avatar
boklm committed
180
181
      container:
        suite: precise
182
        arch: i386
boklm's avatar
boklm committed
183
      configure_opt: '--host=i686-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
184
185
      CFLAGS: '[% c("var/flag_mwindows") %] -fstack-protector-all -Wstack-protector --param ssp-buffer-size=4 -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security'
      LDFLAGS: '[% c("var/flag_mwindows") %] -Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -lssp -L$gcclibs'
boklm's avatar
boklm committed
186
      flag_mwindows: '-mwindows'
boklm's avatar
boklm committed
187
      compiler: mingw-w64
boklm's avatar
boklm committed
188
189
190
191
192
193
194
195
      deps:
        - build-essential
        - python
        - bison
        - automake
        - libtool
        - zip
        - unzip
196
      faketime_path: /usr/lib/faketime/libfaketime.so.1
197
198
199
200
201
202
      setarch: |
        if test -z "$RBM_SETARCH"
        then
           export RBM_SETARCH=1
           exec setarch i686 ./build
        fi
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
      fteproxy: 1
      install_wine_ppa: |
        # Install a Wine new enough to have a fix for
        # http://bugs.winehq.org/show_bug.cgi?id=29764; otherwise Python run under
        # Wine constantly crashes in _PyVerify_fd, which is called by such common
        # operations as io.open and os.fstat (anything involving a file descriptor
        # number). Ubuntu's main repository only has wine1.4, and the issue was fixed
        # in 1.5.29.
        echo 'deb http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu precise main' >> /etc/apt/sources.list
        # This key is from https://launchpad.net/~ubuntu-wine/+archive/ppa and
        # http://keyserver.ubuntu.com:11371/pks/lookup?op=get&search=0x5A9A06AEF9CB8DB0.
        apt-key add - << EOF
        -----BEGIN PGP PUBLIC KEY BLOCK-----
        Version: GnuPG v1
        
        mI0ESXVzlQEEAN1BxiR961SiFrJ7tacrAImCmDdxs4OSifgpBAp8q0fe0iLcSeAo
        WdS7H+7Y4T+/2t3XEw7+3cD831WBu8c/Pv0ldx5TyDyOQmEtUBlMqy33WdKVxsci
        rnag8ShrNM9PtG/vAQU/JtfQl68dXfD3BsCtrXVrjqcO2AxNYBSvd9hpABEBAAG0
        IkxhdW5jaHBhZCBQUEEgZm9yIFVidW50dSBXaW5lIFRlYW2ItgQTAQIAIAUCSXVz
        lQIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEFqaBq75y42wflcD/jLMihWM
        zRCO60S/a7SqD0QNqV/nAYEOsma/Y2C/uhQ44j0np+iOB6+PDRbyJ8GVgIjpaIbt
        l4sReXcf7bS9Dhhn5Gbe/n6VQr7xoMr1Io0PrXdmWpmsOfCuebWU4bV1w+YBvHFF
        qTu5QF2Y0Fj9bRxQdQ1M2HcnXOiLq82hKlb+
        =Z9DY
        -----END PGP PUBLIC KEY BLOCK-----
        EOF
        apt-get update
        apt-get --no-install-recommends -y install wine
boklm's avatar
boklm committed
231
232
233

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

  # 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:
    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;
  -%]
281
282
283
284
285
  # 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
286
287
288
289
290
291
  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
292

boklm's avatar
boklm committed
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
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
318
319
320
    [% IF c("interactive") -%]
      echo Container directory: [% shell_quote(c("var/container/dir")) %]
    [% END -%]
boklm's avatar
boklm committed
321
322
323
324
325
326
327
328
    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
329
330
331
    cat > '[% c("var/container/dir") %]'/config.json << EOF
    [% INCLUDE 'runc-config.json' %]
    EOF
332
    sudo runc start -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
333
334
335
336
337
338
339
340
341
342

  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 %]
343
344
345
346
    # 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
347
348
349
350
351
352
353
354
355
356

  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 %]
357
    sudo chown -R $(whoami) "$srcdir"
boklm's avatar
boklm committed
358
359
    if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ]
    then
360
      mv -f "$srcdir"/* [% dst %]/
boklm's avatar
boklm committed
361
362
363
364
365
366
367
368
    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
369
370
371
ENV:
  TZ: UTC
  LC_ALL: C