rbm.conf 17 KB

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