rbm.conf 21 KB

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