rbm.conf 14 KB

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