rbm.conf 19 KB

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