rbm.conf 16 KB

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