rbm.conf 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  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. list_toolchain_updates:
  17. build_log: '-'
  18. list_toolchain_updates: '[% INCLUDE list_toolchain_updates %]'
  19. cargo_vendor:
  20. output_dir: "out/[% project %]/cargo_vendor"
  21. var:
  22. container:
  23. suite: bullseye
  24. arch: amd64
  25. pre_pkginst: ''
  26. deps:
  27. - patch
  28. - bzip2
  29. cargo_vendor: |
  30. #!/bin/bash
  31. [% c("var/set_default_env") %]
  32. mkdir /var/tmp/dist
  33. # NOTE: since different projects need different rust versions,
  34. # we use the version of cargo produced by the rust project
  35. # build rather than the build container's debian package.
  36. # Thus, any project that wants to run a `cargo_vendor` step
  37. # must be sure to provide the rust project as an `input_file`.
  38. # See, e.g.,`application-services/config.steps.cargo_vendor.input_files`.
  39. tar -C /var/tmp/dist -xf [% c('input_files_by_name/rust') %]
  40. export PATH="/var/tmp/dist/rust/bin:$PATH"
  41. tar -xf [% project %]-[% c('version') %].tar.gz
  42. cd [% project %]-[% c('version') %]
  43. [% c("var/pre_cargo_vendor") %]
  44. cargo vendor vendor [% c("var/cargo_vendor_opts") %]
  45. [% c('tar', {
  46. tar_src => [ 'vendor' ],
  47. tar_args => '-caf ' _ dest_dir _ '/' _ c('filename'),
  48. }) %]
  49. cd [% dest_dir %]
  50. fname="out/[% project %]/cargo_vendor/[% c('filename') %]"
  51. echo
  52. echo "Finished creating $fname"
  53. sha256sum "[% c('filename') %]"
  54. echo "You can upload it with:"
  55. echo " scp -p $fname people.torproject.org:public_html/mirrors/sources"
  56. # buildconf contains build options that the user can change in rbm.local.conf
  57. # When adding a new option to buildconf, a default value should be defined
  58. # in var/build_id, so that changing this option does not affect the build_id.
  59. buildconf:
  60. num_procs: '[% GET ENV.RBM_NUM_PROCS ? ENV.RBM_NUM_PROCS : "4" %]'
  61. git_signtag_opt: '-s'
  62. var:
  63. torbrowser_version: '11.5a9'
  64. torbrowser_build: 'build1'
  65. torbrowser_incremental_from:
  66. - 11.5a8
  67. project_name: tor-browser
  68. multi_lingual: 0
  69. build_mar: 1
  70. # By default, we sort the list of installed packages. This allows sharing
  71. # containers with identical list of packages, even if they are not listed
  72. # in the same order. In the cases where the installation order is
  73. # important, sort_deps should be set to 0.
  74. sort_deps: 1
  75. build_id: '[% sha256(c("var/build_id_txt", { buildconf => { num_procs => 4 } })).substr(0, 6) %]'
  76. build_id_txt: |
  77. [% c("version") %]
  78. [% IF c("git_hash") || c("hg_hash"); GET c("abbrev"); END; %]
  79. [% IF c("var/container/use_container") && ! c("var/container/global_disable") -%]
  80. [% c("var/container/suite") %]
  81. [% c("var/container/arch") %]
  82. [% END -%]
  83. input_files: [% c("input_files_id") %]
  84. build:
  85. [% SET step = c("step") -%]
  86. [% c(step, { filename => 'f', output_dir => '/out', norec => {} }) %]
  87. container:
  88. dir: '[% c("rbm_tmp_dir") %]/rbm-containers/[% sha256(c("build_id")) %]'
  89. user: rbm
  90. disable_network:
  91. # disable network in the build scripts
  92. build: 1
  93. input_files_list: |
  94. [% FOREACH file IN c("input_files_by_name").keys.sort -%]
  95. [% c("input_files_by_name/" _ file) %]
  96. [% END -%]
  97. faketime: "faketime -f \"[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d %H:%M:%S') %]\""
  98. touch: "[% USE date %]touch -m -t [% date.format(c('timestamp'), format = '%Y%m%d%H%M') %]"
  99. locale_ja: ja
  100. locales:
  101. - ar
  102. - ca
  103. - cs
  104. - da
  105. - de
  106. - el
  107. - es-AR
  108. - es-ES
  109. - fa
  110. - fr
  111. - ga-IE
  112. - he
  113. - hu
  114. - id
  115. - is
  116. - it
  117. - '[% c("var/locale_ja") %]'
  118. - ka
  119. - ko
  120. - lt
  121. - mk
  122. - ms
  123. - my
  124. - nb-NO
  125. - nl
  126. - pl
  127. - pt-BR
  128. - ro
  129. - ru
  130. - sv-SE
  131. - th
  132. - tr
  133. - vi
  134. - zh-CN
  135. - zh-TW
  136. locales_mobile:
  137. - ar
  138. - ca
  139. - cs
  140. - da
  141. - de
  142. - el
  143. - es-rAR
  144. - es-rES
  145. - fa
  146. - fr
  147. - ga-rIE
  148. - hu
  149. - in
  150. - is
  151. - it
  152. - iw
  153. - ja
  154. - ka
  155. - ko
  156. - lt
  157. - my
  158. - nb-rNO
  159. - nl
  160. - pl
  161. - pt-rBR
  162. - ro
  163. - ru
  164. - sv-rSE
  165. - th
  166. - tr
  167. - vi
  168. - zh-rCN
  169. - zh-rTW
  170. sign_build: '[% ENV.RBM_SIGN_BUILD %]'
  171. sign_build_gpg_opts: '[% ENV.RBM_GPG_OPTS %]'
  172. rezip: |
  173. rezip_tmpdir=$(mktemp -d)
  174. mkdir -p "$rezip_tmpdir/z"
  175. unzip -d "$rezip_tmpdir/z" -- [% c("rezip_file") %] || [ $? -lt 3 ]
  176. pushd "$rezip_tmpdir/z"
  177. [% c("zip", {
  178. zip_src => [ '.' ],
  179. zip_args => '$rezip_tmpdir/new.zip',
  180. }) %]
  181. popd
  182. mv -f -- "$rezip_tmpdir/new.zip" [% c("rezip_file") %]
  183. rm -Rf "$rezip_tmpdir"
  184. set_default_env: |
  185. set -e
  186. [% FOREACH env = c('ENV') -%]
  187. export [% env.key %]="[% env.value %]"
  188. [% END -%]
  189. rootdir=$(pwd)
  190. export SHELL=/bin/bash
  191. export HOME=$rootdir
  192. umask 0022
  193. [% IF c("var/container/global_disable") -%]
  194. rm -Rf /var/tmp/build /var/tmp/dist
  195. [% END -%]
  196. DOCSDIR_project: '[% project %]'
  197. set_PTDIR_DOCSDIR: |
  198. PTDIR="$distdir/TorBrowser/Tor/PluggableTransports"
  199. DOCSDIR="$distdir/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  200. targets:
  201. notarget: linux-x86_64
  202. noint:
  203. debug: 0
  204. release:
  205. var:
  206. release: 1
  207. channel: release
  208. alpha:
  209. var:
  210. alpha: 1
  211. channel: alpha
  212. nightly:
  213. fetch: 1
  214. var:
  215. nightly: 1
  216. channel: nightly
  217. torbrowser_version: |
  218. [%
  219. IF ENV.TORBROWSER_NIGHTLY_VERSION;
  220. GET ENV.TORBROWSER_NIGHTLY_VERSION;
  221. ELSIF c("var/testbuild");
  222. GET "testbuild";
  223. ELSE;
  224. GET c("var_p/nightly_torbrowser_version");
  225. END;
  226. -%]
  227. # For nightly builds, we support updates for a limited set of locales
  228. mar_locales:
  229. - de
  230. - es-ES
  231. - fr
  232. - ru
  233. max_torbrowser_incremental_from: 2
  234. build_infos_json: 1
  235. torbrowser-testbuild:
  236. - testbuild
  237. - alpha
  238. testbuild:
  239. var:
  240. testbuild: 1
  241. # Don't create mar files to save time
  242. build_mar: 0
  243. torbrowser-android-armv7:
  244. - android-armv7
  245. - android
  246. android-armv7:
  247. arch: armv7
  248. var:
  249. android-armv7: 1
  250. osname: android-armv7
  251. toolchain_arch: arm
  252. abi: armeabi-v7a
  253. cross_prefix: armv7a-linux-androideabi
  254. torbrowser-android-x86:
  255. - android-x86
  256. - android
  257. android-x86:
  258. arch: x86
  259. var:
  260. android-x86: 1
  261. osname: android-x86
  262. toolchain_arch: x86
  263. abi: x86
  264. cross_prefix: i686-linux-android
  265. torbrowser-android-x86_64:
  266. - android-x86_64
  267. - android
  268. android-x86_64:
  269. arch: x86_64
  270. var:
  271. android-x86_64: 1
  272. osname: android-x86_64
  273. toolchain_arch: x86_64
  274. abi: x86_64
  275. cross_prefix: x86_64-linux-android
  276. torbrowser-android-aarch64:
  277. - android-aarch64
  278. - android
  279. android-aarch64:
  280. arch: aarch64
  281. var:
  282. android-aarch64: 1
  283. osname: android-aarch64
  284. toolchain_arch: arm64
  285. abi: arm64-v8a
  286. cross_prefix: aarch64-linux-android
  287. android:
  288. var:
  289. android: 1
  290. compiler: android-toolchain
  291. android_min_api: '[% GET c("var/android_min_api_" _ c("arch")) %]'
  292. CC: '[% c("var/cross_prefix") %][% c("var/android_min_api") %]-clang'
  293. CXX: '[% c("var/cross_prefix") %][% c("var/android_min_api") %]-clang'
  294. # API 21 is the minimum we currently support on Android
  295. android_min_api_armv7: 21
  296. android_min_api_x86: 21
  297. android_min_api_x86_64: 21
  298. android_min_api_aarch64: 21
  299. container:
  300. suite: bullseye
  301. arch: amd64
  302. disable_network:
  303. # Disable network in the script for merging GeckoView .aar files
  304. merge_aars: 1
  305. deps:
  306. - build-essential
  307. - python3
  308. - python3-distutils
  309. - automake
  310. - libtool
  311. - zip
  312. - unzip
  313. - libtinfo5
  314. configure_opt: '--host=[% c("var/cross_prefix") %] CC=[% c("var/CC") %] [% c("var/configure_opt_project") %]'
  315. pre_pkginst: |
  316. SNAPSHOT_VERSION=20191201T212855Z
  317. OPENJDK_URL=https://snapshot.debian.org/archive/debian/$SNAPSHOT_VERSION/pool/main/o/openjdk-8
  318. JDK_VERSION=8u232-b09-1~deb9u1_amd64
  319. apt-get install -y -q wget ca-certificates-java
  320. wget $OPENJDK_URL/openjdk-8-jdk-headless_$JDK_VERSION.deb
  321. wget $OPENJDK_URL/openjdk-8-jre-headless_$JDK_VERSION.deb
  322. echo 92b4f8fb77d793a86e0b03b3b0750592b40a26a5d75956d10dd984a7b3aad4c9 openjdk-8-jdk-headless_$JDK_VERSION.deb | sha256sum -c
  323. echo 84bf52b6cce20ead08b0d5b9fd9b81b4aa3da385ca951b313fe11d5cb1aa4d17 openjdk-8-jre-headless_$JDK_VERSION.deb | sha256sum -c
  324. apt-get install -y -q ./openjdk-8-jre-headless_$JDK_VERSION.deb ./openjdk-8-jdk-headless_$JDK_VERSION.deb
  325. torbrowser-linux-x86_64:
  326. - linux-x86_64
  327. - linux
  328. torbrowser-linux-x86_64-asan:
  329. - linux-asan
  330. - linux-x86_64
  331. - linux
  332. torbrowser-linux-i686:
  333. - linux-i686
  334. - linux
  335. torbrowser-linux-arm:
  336. - linux-arm
  337. - linux-cross
  338. - linux
  339. torbrowser-linux-ppc64le:
  340. - linux-ppc64le
  341. - linux-cross
  342. - linux
  343. torbrowser-linux-ppc64:
  344. - linux-ppc64
  345. - linux-cross
  346. - linux
  347. torbrowser-linux-ppc:
  348. - linux-ppc
  349. - linux-cross
  350. - linux
  351. linux-x86_64:
  352. arch: x86_64
  353. var:
  354. linux-x86_64: 1
  355. osname: linux-x86_64
  356. linux-cross: 0
  357. arch_debian: amd64
  358. arch_kernel: x86
  359. # We only support RLBox on the nightly channel and x86_64 for now
  360. rlbox: 0
  361. linux-i686:
  362. arch: i686
  363. var:
  364. linux-i686: 1
  365. osname: linux-i686
  366. linux-cross: 0
  367. configure_opt: '--host=i686-linux-gnu CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 [% c("var/configure_opt_project") %]'
  368. arch_debian: i386
  369. arch_kernel: x86
  370. linux-arm:
  371. arch: arm
  372. var:
  373. linux-arm: 1
  374. osname: linux-arm
  375. crosstarget: arm-linux-gnueabihf
  376. arch_debian: armhf
  377. arch_kernel: arm
  378. linux-ppc64le:
  379. arch: ppc64le
  380. var:
  381. linux-ppc64le: 1
  382. osname: linux-ppc64le
  383. crosstarget: powerpc64le-linux-gnu
  384. configure_opt: '--host=powerpc64le-linux-gnu [% c("var/configure_opt_project") %]'
  385. arch_debian: ppc64el
  386. arch_kernel: powerpc
  387. linux-ppc64:
  388. arch: ppc64
  389. var:
  390. linux-ppc64: 1
  391. osname: linux-ppc64
  392. crosstarget: powerpc64-linux-gnu
  393. configure_opt: '--host=powerpc64-linux-gnu [% c("var/configure_opt_project") %]'
  394. arch_debian: ppc64
  395. arch_kernel: powerpc
  396. linux-ppc:
  397. arch: ppc
  398. var:
  399. linux-ppc: 1
  400. osname: linux-ppc
  401. crosstarget: powerpc-linux-gnu
  402. configure_opt: '--host=powerpc-linux-gnu [% c("var/configure_opt_project") %]'
  403. arch_debian: powerpc
  404. arch_kernel: powerpc
  405. linux-cross:
  406. var:
  407. linux-cross: 1
  408. container:
  409. arch: amd64
  410. configure_opt: '--host=[% c("var/crosstarget") %] [% c("var/configure_opt_project") %]'
  411. linux:
  412. var:
  413. linux: 1
  414. compiler: gcc
  415. configure_opt: '[% c("var/configure_opt_project") %]'
  416. # Only build Namecoin for linux on nightly
  417. namecoin: '[% c("var/nightly") %]'
  418. container:
  419. suite: jessie
  420. arch: amd64
  421. pre_pkginst: dpkg --add-architecture i386
  422. deps:
  423. - libc6-dev-i386
  424. - lib32stdc++6
  425. - build-essential
  426. - python
  427. - bison
  428. - hardening-wrapper
  429. - automake
  430. - libtool
  431. - zip
  432. - unzip
  433. linux-asan:
  434. var:
  435. asan: 1
  436. # RLBox needs clang to create .wasm files but we use mostly GCC for our
  437. # ASan builds. Thus, the compilation currently breaks with RLBox enabled.
  438. # See: tor-browser-build#40063.
  439. rlbox: 0
  440. torbrowser-windows-i686:
  441. - windows-i686
  442. - windows
  443. torbrowser-windows-x86_64:
  444. - windows-x86_64
  445. - windows
  446. windows-x86_64:
  447. arch: x86_64
  448. var:
  449. windows-x86_64: 1
  450. windows-i686: 0
  451. osname: windows-x86_64
  452. # HEASLR is 64 bit only (see bug 12968)
  453. flag_HEASLR: '-Wl,--high-entropy-va'
  454. windows-i686:
  455. arch: i686
  456. var:
  457. windows-i686: 1
  458. windows-x86_64: 0
  459. osname: windows-i686
  460. # mingw-w64 does not support SEH on 32bit systems. Be explicit about that.
  461. flag_noSEH: '-Wl,--no-seh'
  462. windows:
  463. var:
  464. windows: 1
  465. container:
  466. suite: bullseye
  467. arch: amd64
  468. configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]" [% c("var/configure_opt_project") %]'
  469. CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
  470. LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_HEASLR") %] [% c("var/flag_noSEH") %] [% c("var/flag_mwindows") %]'
  471. flag_mwindows: '-mwindows'
  472. compiler: mingw-w64
  473. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  474. deps:
  475. - build-essential
  476. - python3
  477. - python3-distutils
  478. - bison
  479. - automake
  480. - libtool
  481. - zip
  482. - unzip
  483. torbrowser-osx-x86_64:
  484. - osx-x86_64
  485. osx-x86_64:
  486. arch: x86_64
  487. var:
  488. osx: 1
  489. osname: osx-x86_64
  490. container:
  491. suite: bullseye
  492. arch: amd64
  493. compiler: 'macosx-toolchain'
  494. configure_opt: '--host=x86_64-apple-darwin CC="x86_64-apple-darwin-clang [% c("var/FLAGS") %]" CXX="x86_64-apple-darwin-clang++ [% c("var/FLAGS") %]" [% c("var/configure_opt_project") %]'
  495. FLAGS: "-target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir"
  496. LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
  497. macosx_deployment_target: '10.12'
  498. locale_ja: ja-JP-mac
  499. rlbox: 0
  500. deps:
  501. - build-essential
  502. - python3
  503. - python3-distutils
  504. - automake
  505. - libtool
  506. - zip
  507. - unzip
  508. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  509. set_PTDIR_DOCSDIR: |
  510. PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
  511. DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  512. # The no_build_id target can be useful if you want to quickly display
  513. # a build template or other option but don't want to spend time to
  514. # compute the various build ids
  515. no_build_id:
  516. # The defaut timestamp value will use the commit time of the
  517. # selected commit for the project, which will require cloning the
  518. # git repository if it is not present. When we use the no_build_id
  519. # target to display a script, we usually don't care about such
  520. # details, so we set timestamp to 0 to avoid unnecessary cloning.
  521. timestamp: 0
  522. var:
  523. build_id: 1
  524. no_containers:
  525. var:
  526. container:
  527. global_disable: 1
  528. # change the default gpg_wrapper to allow git tag signed using an
  529. # expired key.
  530. # https://bugs.torproject.org/19737
  531. gpg_wrapper: |
  532. #!/bin/bash
  533. export LC_ALL=C
  534. [%
  535. IF c('gpg_keyring');
  536. SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
  537. END;
  538. -%]
  539. gpg_verify=0
  540. for opt in "$@"
  541. do
  542. test "$opt" = '--verify' && gpg_verify=1
  543. done
  544. if [ $gpg_verify = 1 ]
  545. then
  546. [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
  547. exit ${PIPESTATUS[0]}
  548. else
  549. exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  550. fi
  551. remote_start: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_start") %][% END %]'
  552. remote_exec: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_exec") %][% END %]'
  553. remote_put: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_put") %][% END %]'
  554. remote_get: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_get") %][% END %]'
  555. remote_finish: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_finish") %][% END %]'
  556. container:
  557. remote_start: |
  558. #!/bin/sh
  559. set -e
  560. if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
  561. then
  562. echo "Can't find container image in input files" >&2
  563. ls -l '[% c("remote_srcdir") %]' >&2
  564. exit 1
  565. fi
  566. [% c("rbmdir") %]/container extract '[% c("var/container/dir") %]' '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*
  567. test -d '[% c("var/container/dir") %]'/home/rbm || \
  568. [% c("rbmdir") %]/container run --chroot='[% c("var/container/dir") %]' -- /usr/sbin/useradd -m [% c("var/container/user") %]
  569. remote_exec: |
  570. #!/bin/sh
  571. set -e
  572. [% IF c("interactive") -%]
  573. echo Container directory: [% shell_quote(c("var/container/dir")) %]
  574. [% END -%]
  575. mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rbm
  576. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rbm/cmd
  577. echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rbm/cmd
  578. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rbm/run
  579. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  580. # Some programs such as gradle need the lo interface to be up.
  581. # See for example tor-browser#31293
  582. echo 'ip link set lo up' >> '[% c("var/container/dir") %]'/rbm/run
  583. [% END -%]
  584. [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
  585. echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rbm/run
  586. chmod +x '[% c("var/container/dir") %]'/rbm/cmd
  587. chmod +x '[% c("var/container/dir") %]'/rbm/run
  588. [%
  589. IF c("var/container/disable_network/" _ c("exec_name"));
  590. SET disable_network = '--disable-network';
  591. ELSE;
  592. SET disable_network = '';
  593. END;
  594. -%]
  595. [% c("rbmdir") %]/container run [% disable_network %] --chroot='[% c("var/container/dir") %]' -- /rbm/run
  596. remote_put: |
  597. #!/bin/sh
  598. set -e
  599. [%
  600. SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
  601. SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
  602. -%]
  603. [% c("rbmdir") %]/container put '[% c("var/container/dir") %]' [% src %] [% dst %] [% c("var/container/user") %]
  604. remote_get: |
  605. #!/bin/sh
  606. set -e
  607. [%
  608. SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
  609. SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
  610. -%]
  611. [% c("rbmdir") %]/container get '[% c("var/container/dir") %]' [% src %] [% dst %]
  612. remote_finish: |
  613. #!/bin/sh
  614. set -e
  615. [% c("rbmdir") %]/container remove '[% c("var/container/dir") %]'
  616. ENV:
  617. TZ: UTC
  618. LC_ALL: C
  619. --- |
  620. # This part of the file contains options written in perl
  621. use IO::CaptureOutput qw(capture_exec);
  622. (
  623. var_p => {
  624. nightly_torbrowser_version => sub {
  625. state $version = '';
  626. return $version if $version;
  627. my (undef, undef, undef, $day, $mon, $year) = gmtime;
  628. $version = sprintf("tbb-nightly.%u.%02u.%02u", $year + 1900, $mon + 1, $day);
  629. return $version;
  630. },
  631. nightly_torbrowser_incremental_from => sub {
  632. my ($project, $options) = @_;
  633. my $nightly_dir = project_config($project, 'basedir', $options) . '/nightly';
  634. my $current_version = project_config($project, 'var/torbrowser_version', $options);
  635. use Path::Tiny;
  636. return [] unless -d $nightly_dir;
  637. my @dirs = sort map { $_->basename } path($nightly_dir)->children(qr/^tbb-nightly\./);
  638. my $nb_incr = project_config($project, ['var', 'max_torbrowser_incremental_from'], $options);
  639. my @res;
  640. while ($nb_incr > 0) {
  641. my $dir = pop @dirs;
  642. last unless $dir;
  643. next if $dir eq $current_version;
  644. $nb_incr--;
  645. push @res, $dir;
  646. }
  647. return [@res];
  648. },
  649. },
  650. )