rbm.conf 14 KB

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