rbm.conf 15 KB

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