rbm.conf 13 KB

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