rbm.conf 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  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. linux:
  397. var:
  398. linux: 1
  399. compiler: gcc
  400. configure_opt: '[% c("var/configure_opt_project") %]'
  401. # We only build snowflake on the alpha and nightly
  402. # channels for now.
  403. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  404. # Only build Namecoin for linux on nightly
  405. namecoin: '[% c("var/nightly") %]'
  406. container:
  407. suite: jessie
  408. arch: amd64
  409. pre_pkginst: dpkg --add-architecture i386
  410. deps:
  411. - libc6-dev-i386
  412. - lib32stdc++6
  413. - build-essential
  414. - python
  415. - bison
  416. - hardening-wrapper
  417. - automake
  418. - libtool
  419. - zip
  420. - unzip
  421. linux-asan:
  422. var:
  423. asan: 1
  424. # RLBox needs clang to create .wasm files but we use mostly GCC for our
  425. # ASan builds. Thus, the compilation currently breaks with RLBox enabled.
  426. # See: tor-browser-build#40063.
  427. rlbox: 0
  428. torbrowser-windows-i686:
  429. - windows-i686
  430. - windows
  431. torbrowser-windows-x86_64:
  432. - windows-x86_64
  433. - windows
  434. windows-x86_64:
  435. arch: x86_64
  436. var:
  437. windows-x86_64: 1
  438. windows-i686: 0
  439. osname: windows-x86_64
  440. # HEASLR is 64 bit only (see bug 12968)
  441. flag_HEASLR: '-Wl,--high-entropy-va'
  442. windows-i686:
  443. arch: i686
  444. var:
  445. windows-i686: 1
  446. windows-x86_64: 0
  447. osname: windows-i686
  448. # mingw-w64 does not support SEH on 32bit systems. Be explicit about that.
  449. flag_noSEH: '-Wl,--no-seh'
  450. windows:
  451. var:
  452. windows: 1
  453. container:
  454. suite: buster
  455. arch: amd64
  456. configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]" [% c("var/configure_opt_project") %]'
  457. CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
  458. 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") %]'
  459. flag_mwindows: '-mwindows'
  460. compiler: mingw-w64
  461. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  462. # We only build snowflake on the alpha and nightly
  463. # channels for now.
  464. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  465. deps:
  466. - build-essential
  467. - python
  468. - bison
  469. - automake
  470. - libtool
  471. - zip
  472. - unzip
  473. torbrowser-osx-x86_64:
  474. - osx-x86_64
  475. osx-x86_64:
  476. arch: x86_64
  477. var:
  478. osx: 1
  479. osname: osx-x86_64
  480. container:
  481. suite: buster
  482. arch: amd64
  483. compiler: 'macosx-toolchain'
  484. 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") %]'
  485. FLAGS: "-target x86_64-apple-darwin -B $cctoolsdir -isysroot $sysrootdir"
  486. LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
  487. macosx_deployment_target: '10.9'
  488. locale_ja: ja-JP-mac
  489. # We only support RLBox on the nightly channel for now
  490. rlbox: '[% c("var/nightly") %]'
  491. # We only build snowflake on the alpha and nightly
  492. # channels for now.
  493. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  494. deps:
  495. - build-essential
  496. - python
  497. - automake
  498. - libtool
  499. - zip
  500. - unzip
  501. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  502. set_PTDIR_DOCSDIR: |
  503. PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
  504. DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  505. # The no_build_id target can be useful if you want to quickly display
  506. # a build template or other option but don't want to spend time to
  507. # compute the various build ids
  508. no_build_id:
  509. # The defaut timestamp value will use the commit time of the
  510. # selected commit for the project, which will require cloning the
  511. # git repository if it is not present. When we use the no_build_id
  512. # target to display a script, we usually don't care about such
  513. # details, so we set timestamp to 0 to avoid unnecessary cloning.
  514. timestamp: 0
  515. var:
  516. build_id: 1
  517. no_containers:
  518. var:
  519. container:
  520. global_disable: 1
  521. # change the default gpg_wrapper to allow git tag signed using an
  522. # expired key.
  523. # https://bugs.torproject.org/19737
  524. gpg_wrapper: |
  525. #!/bin/bash
  526. export LC_ALL=C
  527. [%
  528. IF c('gpg_keyring');
  529. SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
  530. END;
  531. -%]
  532. gpg_verify=0
  533. for opt in "$@"
  534. do
  535. test "$opt" = '--verify' && gpg_verify=1
  536. done
  537. if [ $gpg_verify = 1 ]
  538. then
  539. [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
  540. exit ${PIPESTATUS[0]}
  541. else
  542. exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  543. fi
  544. remote_start: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_start") %][% END %]'
  545. remote_exec: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_exec") %][% END %]'
  546. remote_put: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_put") %][% END %]'
  547. remote_get: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_get") %][% END %]'
  548. remote_finish: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("container/remote_finish") %][% END %]'
  549. container:
  550. remote_start: |
  551. #!/bin/sh
  552. set -e
  553. if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
  554. then
  555. echo "Can't find container image in input files" >&2
  556. ls -l '[% c("remote_srcdir") %]' >&2
  557. exit 1
  558. fi
  559. [% c("rbmdir") %]/container extract '[% c("var/container/dir") %]' '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*
  560. test -d '[% c("var/container/dir") %]'/home/rbm || \
  561. [% c("rbmdir") %]/container run --chroot='[% c("var/container/dir") %]' -- /usr/sbin/useradd -m [% c("var/container/user") %]
  562. remote_exec: |
  563. #!/bin/sh
  564. set -e
  565. [% IF c("interactive") -%]
  566. echo Container directory: [% shell_quote(c("var/container/dir")) %]
  567. [% END -%]
  568. mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rbm
  569. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rbm/cmd
  570. echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rbm/cmd
  571. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rbm/run
  572. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  573. # Some programs such as gradle need the lo interface to be up.
  574. # See for example tor-browser#31293
  575. echo 'ip link set lo up' >> '[% c("var/container/dir") %]'/rbm/run
  576. [% END -%]
  577. [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
  578. echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rbm/run
  579. chmod +x '[% c("var/container/dir") %]'/rbm/cmd
  580. chmod +x '[% c("var/container/dir") %]'/rbm/run
  581. [%
  582. IF c("var/container/disable_network/" _ c("exec_name"));
  583. SET disable_network = '--disable-network';
  584. ELSE;
  585. SET disable_network = '';
  586. END;
  587. -%]
  588. [% c("rbmdir") %]/container run [% disable_network %] --chroot='[% c("var/container/dir") %]' -- /rbm/run
  589. remote_put: |
  590. #!/bin/sh
  591. set -e
  592. [%
  593. SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
  594. SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
  595. -%]
  596. [% c("rbmdir") %]/container put '[% c("var/container/dir") %]' [% src %] [% dst %] [% c("var/container/user") %]
  597. remote_get: |
  598. #!/bin/sh
  599. set -e
  600. [%
  601. SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
  602. SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
  603. -%]
  604. [% c("rbmdir") %]/container get '[% c("var/container/dir") %]' [% src %] [% dst %]
  605. remote_finish: |
  606. #!/bin/sh
  607. set -e
  608. [% c("rbmdir") %]/container remove '[% c("var/container/dir") %]'
  609. ENV:
  610. TZ: UTC
  611. LC_ALL: C
  612. --- |
  613. # This part of the file contains options written in perl
  614. use IO::CaptureOutput qw(capture_exec);
  615. (
  616. var_p => {
  617. nightly_torbrowser_version => sub {
  618. state $version = '';
  619. return $version if $version;
  620. my (undef, undef, undef, $day, $mon, $year) = gmtime;
  621. $version = sprintf("tbb-nightly.%u.%02u.%02u", $year + 1900, $mon + 1, $day);
  622. return $version;
  623. },
  624. nightly_torbrowser_incremental_from => sub {
  625. my ($project, $options) = @_;
  626. my $nightly_dir = project_config($project, 'basedir', $options) . '/nightly';
  627. my $current_version = project_config($project, 'var/torbrowser_version', $options);
  628. use Path::Tiny;
  629. return [] unless -d $nightly_dir;
  630. my @dirs = sort map { $_->basename } path($nightly_dir)->children(qr/^tbb-nightly\./);
  631. my $nb_incr = project_config($project, ['var', 'max_torbrowser_incremental_from'], $options);
  632. my @res;
  633. while ($nb_incr > 0) {
  634. my $dir = pop @dirs;
  635. last unless $dir;
  636. next if $dir eq $current_version;
  637. $nb_incr--;
  638. push @res, $dir;
  639. }
  640. return [@res];
  641. },
  642. },
  643. )