rbm.conf 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. # vim: filetype=yaml sw=2
  2. debug: '[% GET ! ENV.RBM_NO_DEBUG %]'
  3. compress_tar: gz
  4. 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'
  7. pkg_type: build
  8. # buildconf contains build options that the user can change in rbm.local.conf
  9. # When adding a new option to buildconf, a default value should be defined
  10. # in var/build_id, so that changing this option does not affect the build_id.
  11. buildconf:
  12. num_procs: '[% GET ENV.RBM_NUM_PROCS ? ENV.RBM_NUM_PROCS : "4" %]'
  13. git_signtag_opt: '-s'
  14. var:
  15. torbrowser_version: '8.5a8'
  16. torbrowser_build: 'build2'
  17. torbrowser_incremental_from:
  18. - 8.5a7
  19. project_name: tor-browser
  20. multi_lingual: 0
  21. build_mar: 1
  22. # By default, we sort the list of installed packages. This allows sharing
  23. # containers with identical list of packages, even if they are not listed
  24. # in the same order. In the cases where the installation order is
  25. # important, sort_deps should be set to 0.
  26. sort_deps: 1
  27. build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]'
  28. build_id_txt: |
  29. [% c("version") %]
  30. [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
  31. [% IF c("var/container/use_container") -%]
  32. [% c("var/container/suite") %]
  33. [% c("var/container/arch") %]
  34. [% END -%]
  35. input_files: [% c("input_files_id") %]
  36. build:
  37. [% c("build", { filename => 'f', output_dir => '/out' }) %]
  38. container:
  39. dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]'
  40. user: rbm
  41. input_files_list: |
  42. [% FOREACH file IN c("input_files_by_name").keys.sort -%]
  43. [% c("input_files_by_name/" _ file) %]
  44. [% END -%]
  45. faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
  46. touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"
  47. locale_ja: ja
  48. locales:
  49. - ar
  50. - ca
  51. - cs
  52. - da
  53. - de
  54. - el
  55. - es-ES
  56. - fa
  57. - fr
  58. - ga-IE
  59. - he
  60. - hu
  61. - id
  62. - is
  63. - it
  64. - '[% c("var/locale_ja") %]'
  65. - ka
  66. - ko
  67. - nb-NO
  68. - nl
  69. - pl
  70. - pt-BR
  71. - ru
  72. - sv-SE
  73. - tr
  74. - vi
  75. - zh-CN
  76. - zh-TW
  77. sign_build: '[% ENV.RBM_SIGN_BUILD %]'
  78. sign_build_gpg_opts: '[% ENV.RBM_GPG_OPTS %]'
  79. rezip: |
  80. rezip_tmpdir=$(mktemp -d)
  81. mkdir -p "$rezip_tmpdir/z"
  82. unzip -d "$rezip_tmpdir/z" -- [% c("rezip_file") %] || [ $? -lt 3 ]
  83. pushd "$rezip_tmpdir/z"
  84. [% c("zip", {
  85. zip_src => [ '.' ],
  86. zip_args => '$rezip_tmpdir/new.zip',
  87. }) %]
  88. popd
  89. mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
  90. rm -Rf "$rezip_tmpdir"
  91. set_default_env: |
  92. set -e
  93. [% FOREACH env = c('ENV') -%]
  94. export [% env.key %]="[% env.value %]"
  95. [% END -%]
  96. rootdir=$(pwd)
  97. export SHELL=/bin/bash
  98. export HOME=$rootdir
  99. umask 0022
  100. DOCSDIR_project: '[% project %]'
  101. set_PTDIR_DOCSDIR: |
  102. PTDIR="$distdir/TorBrowser/Tor/PluggableTransports"
  103. DOCSDIR="$distdir/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  104. targets:
  105. notarget: linux-x86_64
  106. noint:
  107. debug: 0
  108. release:
  109. var:
  110. release: 1
  111. channel: release
  112. alpha:
  113. var:
  114. alpha: 1
  115. channel: alpha
  116. nightly:
  117. fetch: 1
  118. var:
  119. nightly: 1
  120. channel: nightly
  121. torbrowser_version: tbb-nightly
  122. torbrowser-testbuild:
  123. - testbuild
  124. - alpha
  125. testbuild:
  126. var:
  127. testbuild: 1
  128. # Don't create mar files to save time
  129. build_mar: 0
  130. # The common-stretch target is used to build components that are common to all
  131. # platforms, using Debian stretch.
  132. common-stretch:
  133. var:
  134. common: 1
  135. container:
  136. suite: stretch
  137. arch: amd64
  138. deps:
  139. - build-essential
  140. - python
  141. - bison
  142. - automake
  143. - libtool
  144. - zip
  145. - unzip
  146. torbrowser-android-armv7:
  147. - android-armv7
  148. - android
  149. android-armv7:
  150. arch: armv7
  151. var:
  152. android-armv7: 1
  153. osname: android-armv7
  154. torbrowser-android-x86:
  155. - android-x86
  156. - android
  157. android-x86:
  158. arch: x86
  159. var:
  160. android-x86: 1
  161. osname: android-x86
  162. android:
  163. var:
  164. android: 1
  165. compiler: android-toolchain
  166. snowflake: 0
  167. fteproxy: 0
  168. container:
  169. suite: stretch
  170. arch: amd64
  171. deps:
  172. - build-essential
  173. - python
  174. - bison
  175. - automake
  176. - libtool
  177. - zip
  178. - unzip
  179. torbrowser-linux-x86_64:
  180. - linux-x86_64
  181. - linux
  182. torbrowser-linux-x86_64-debug:
  183. - linux-debug
  184. - linux-x86_64
  185. - linux
  186. torbrowser-linux-i686:
  187. - linux-i686
  188. - linux
  189. torbrowser-linux-aarch64:
  190. - linux-aarch64
  191. - linux-next
  192. torbrowser-linux-armv7:
  193. - linux-armv7
  194. - linux-next
  195. linux-x86_64:
  196. arch: x86_64
  197. triple: x86_64-unknown-linux-gnu
  198. var:
  199. linux-x86_64: 1
  200. osname: linux-x86_64
  201. container:
  202. arch: amd64
  203. linux-i686:
  204. arch: i686
  205. triple: i686-unknown-linux-gnu
  206. var:
  207. linux-i686: 1
  208. osname: linux-i686
  209. container:
  210. arch: i386
  211. setarch: |
  212. if test -z "$RBM_SETARCH"
  213. then
  214. export RBM_SETARCH=1
  215. exec setarch i686 ./build
  216. fi
  217. linux-aarch64:
  218. arch: arm64
  219. triple: aarch64-unknown-linux-gnu
  220. var:
  221. linux-aarch64: 1
  222. osname: linux-aarch64
  223. container:
  224. arch: aarch64
  225. linux-armv7:
  226. arch: arm
  227. triple: armv7-unknown-linux-gnueabihf
  228. var:
  229. linux-armv7: 1
  230. osname: linux-armv7
  231. container:
  232. arch: armhf
  233. linux-next:
  234. var:
  235. linux-next: 1
  236. linux: 1
  237. compiler: gcc
  238. # We only build snowflake for linux and macOS on the alpha and nightly
  239. # channels for now.
  240. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  241. fteproxy: 1
  242. selfrando: '[% c("var/linux-x86_64") && ! c("var/release") %]'
  243. container:
  244. suite: stretch
  245. deps:
  246. - build-essential
  247. - python
  248. - bison
  249. - automake
  250. - libtool
  251. - zip
  252. - unzip
  253. linux:
  254. var:
  255. linux: 1
  256. compiler: gcc
  257. # We only build snowflake for linux and macOS on the alpha and nightly
  258. # channels for now.
  259. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  260. fteproxy: 1
  261. selfrando: '[% c("var/linux-x86_64") && ! c("var/release") %]'
  262. container:
  263. suite: wheezy
  264. deps:
  265. - build-essential
  266. - python
  267. - bison
  268. - hardening-wrapper
  269. - automake
  270. - libtool
  271. - zip
  272. - unzip
  273. linux-debug:
  274. var:
  275. asan: 1
  276. torbrowser-windows-i686:
  277. - windows-i686
  278. - windows
  279. torbrowser-windows-x86_64:
  280. - windows-x86_64
  281. - windows
  282. windows-x86_64:
  283. arch: x86_64
  284. var:
  285. windows-x86_64: 1
  286. osname: windows-x86_64
  287. container:
  288. arch: amd64
  289. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  290. # HEASLR is 64 bit only (see bug 12968)
  291. flag_HEASLR: '-Wl,--high-entropy-va'
  292. windows-i686:
  293. arch: i686
  294. var:
  295. windows-i686: 1
  296. osname: windows-i686
  297. container:
  298. arch: i386
  299. faketime_path: /usr/lib/i386-linux-gnu/faketime/libfaketime.so.1
  300. setarch: |
  301. if test -z "$RBM_SETARCH"
  302. then
  303. export RBM_SETARCH=1
  304. exec setarch i686 ./build
  305. fi
  306. fteproxy: 1
  307. windows:
  308. var:
  309. windows: 1
  310. container:
  311. suite: jessie
  312. configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]"'
  313. CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
  314. LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_HEASLR") %] [% c("var/flag_mwindows") %]'
  315. flag_mwindows: '-mwindows'
  316. compiler: mingw-w64
  317. deps:
  318. - build-essential
  319. - python
  320. - bison
  321. - automake
  322. - libtool
  323. - zip
  324. - unzip
  325. torbrowser-osx-x86_64:
  326. - osx-x86_64
  327. osx-x86_64:
  328. arch: x86_64
  329. var:
  330. osx: 1
  331. osname: osx-x86_64
  332. container:
  333. suite: jessie
  334. arch: amd64
  335. compiler: 'macosx-toolchain'
  336. 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") %]"'
  337. FLAGS: "-target x86_64-apple-darwin11 -B $cctoolsdir -isysroot $sysrootdir"
  338. LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
  339. locale_ja: ja-JP-mac
  340. # We only build snowflake for linux and macOS on the alpha and nightly
  341. # channels for now.
  342. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  343. deps:
  344. - build-essential
  345. - python
  346. - bison
  347. - automake
  348. - libtool
  349. - zip
  350. - unzip
  351. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  352. set_PTDIR_DOCSDIR: |
  353. PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
  354. DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  355. # The no_build_id target can be useful if you want to quickly display
  356. # a build template or other option but don't want to spend time to
  357. # compute the various build ids
  358. no_build_id:
  359. # The defaut timestamp value will use the commit time of the
  360. # selected commit for the project, which will require cloning the
  361. # git repository if it is not present. When we use the no_build_id
  362. # target to display a script, we usually don't care about such
  363. # details, so we set timestamp to 0 to avoid unnecessary cloning.
  364. timestamp: 0
  365. var:
  366. build_id: 1
  367. # change the default gpg_wrapper to allow git tag signed using an
  368. # expired key.
  369. # https://bugs.torproject.org/19737
  370. gpg_wrapper: |
  371. #!/bin/bash
  372. export LC_ALL=C
  373. [%
  374. IF c('gpg_keyring');
  375. SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
  376. END;
  377. -%]
  378. # git >= 2.10.0-rc0 is calling gpg with 5 args. See #20757
  379. if ( [ $# -eq 4 ] && [ "$1" = '--status-fd=1' ] \
  380. && [ "$2" = '--verify' ] ) \
  381. || ( [ $# -eq 5 ] && [ "$1" = '--status-fd=1' ] \
  382. && [ "$2" = '--keyid-format=long' ] && [ "$3" = '--verify' ] )
  383. then
  384. [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
  385. exit ${PIPESTATUS[0]}
  386. else
  387. exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  388. fi
  389. remote_start: '[% IF c("var/container/use_container") %][% c("runc/remote_start") %][% END %]'
  390. remote_exec: '[% IF c("var/container/use_container") %][% c("runc/remote_exec") %][% END %]'
  391. remote_put: '[% IF c("var/container/use_container") %][% c("runc/remote_put") %][% END %]'
  392. remote_get: '[% IF c("var/container/use_container") %][% c("runc/remote_get") %][% END %]'
  393. remote_finish: '[% IF c("var/container/use_container") %][% c("runc/remote_finish") %][% END %]'
  394. runc:
  395. remote_start: |
  396. #!/bin/sh
  397. set -e
  398. if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
  399. then
  400. echo "Can't find container image in input files" >&2
  401. ls -l '[% c("remote_srcdir") %]' >&2
  402. exit 1
  403. fi
  404. mkdir -p '[% c("var/container/dir") %]'/rootfs/rbm
  405. sudo tar -C '[% c("var/container/dir") %]'/rootfs -xf $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*)
  406. [% SET user = c("var/container/user") -%]
  407. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'id ' _ user
  408. _ ' >/dev/null 2>&1 || adduser -m ' _ user _ ' || useradd -m ' _ user }) %]
  409. remote_exec: |
  410. #!/bin/sh
  411. set -e
  412. [% IF c("interactive") -%]
  413. echo Container directory: [% shell_quote(c("var/container/dir")) %]
  414. [% END -%]
  415. mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/rbm
  416. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  417. echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  418. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/run
  419. [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
  420. echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rootfs/rbm/run
  421. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  422. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/run
  423. cat > '[% c("var/container/dir") %]'/config.json << EOF
  424. [% INCLUDE 'runc-config.json' %]
  425. EOF
  426. 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 %]
  427. remote_put: |
  428. #!/bin/sh
  429. set -e
  430. [%
  431. SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
  432. SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
  433. -%]
  434. sudo mkdir -p '[% c("var/container/dir") %]'/rootfs/[% dst %]
  435. sudo cp -aP [% src %] '[% c("var/container/dir") %]'/rootfs/[% dst %]
  436. # On Ubuntu, the /root/.profile file contains a `mesg n` line which is
  437. # producing some `stdin: is not a tty` messages. To hide them, we hide
  438. # stderr from this part by setting runc_hide_stderr.
  439. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'chown -R ' _ c("var/container/user") _ ' ' _ dst, runc_hide_stderr => 1 }) %]
  440. remote_get: |
  441. #!/bin/sh
  442. set -e
  443. [%
  444. SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
  445. SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
  446. -%]
  447. mkdir -p [% dst %]
  448. srcdir='[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/[% src %]
  449. sudo chown -R $(whoami) "$srcdir"
  450. if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ]
  451. then
  452. for file in "$srcdir"/*
  453. do
  454. bname="$(basename "$file")"
  455. test -e [% dst %]/"$bname" && rm -Rf [% dst %]/"$bname"
  456. mv -f "$file" [% dst %]/
  457. done
  458. fi
  459. remote_finish: |
  460. #!/bin/sh
  461. set -e
  462. sudo rm -Rf '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs '[% c("var/container/dir", { error_if_undef => 1 }) %]'/config.json
  463. rmdir '[% c("var/container/dir") %]'
  464. ENV:
  465. TZ: UTC
  466. LC_ALL: C
  467. --- |
  468. # This part of the file contains options written in perl
  469. use IO::CaptureOutput qw(capture_exec);
  470. (
  471. var_p => {
  472. # runc100 is true if we are using runc >= 1.0.0
  473. # we assume that any version that is not 0.1.1 is >= 1.0.0
  474. runc100 => sub {
  475. my ($out) = capture_exec('sudo', 'runc', '--version');
  476. return !($out =~ m/^runc version 0.1.1/);
  477. },
  478. # runc_spec100 is true if runc spec is at least 1.0.0
  479. # We will need to update this when there is a new spec version available
  480. runc_spec100 => sub {
  481. my ($out) = capture_exec('sudo', 'runc', '--version');
  482. return $out =~ m/^.*spec: 1\.[0-9]+\.[0-9]+$/m;
  483. },
  484. },
  485. )