rbm.conf 13 KB

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