rbm.conf 20 KB

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