rbm.conf 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  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. compiler: clang
  306. container:
  307. suite: jessie
  308. arch: amd64
  309. # TODO: Maybe re-enable snowflake on linux-cross later?
  310. snowflake: 0
  311. # TODO: Maybe re-enable fteproxy on linux-cross later?
  312. fteproxy: 0
  313. linux:
  314. var:
  315. linux: 1
  316. compiler: gcc
  317. configure_opt: '[% c("var/configure_opt_project") %]'
  318. # We only build snowflake on the alpha and nightly
  319. # channels for now.
  320. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  321. # Only build Namecoin for linux on nightly
  322. namecoin: '[% c("var/nightly") %]'
  323. container:
  324. suite: wheezy
  325. arch: amd64
  326. pre_pkginst: dpkg --add-architecture i386
  327. deps:
  328. - libc6-dev-i386
  329. - lib32stdc++6
  330. - build-essential
  331. - python
  332. - bison
  333. - hardening-wrapper
  334. - automake
  335. - libtool
  336. - zip
  337. - unzip
  338. linux-debug:
  339. var:
  340. asan: 1
  341. torbrowser-windows-i686:
  342. - windows-i686
  343. - windows
  344. torbrowser-windows-x86_64:
  345. - windows-x86_64
  346. - windows
  347. windows-x86_64:
  348. arch: x86_64
  349. var:
  350. windows-x86_64: 1
  351. osname: windows-x86_64
  352. # HEASLR is 64 bit only (see bug 12968)
  353. flag_HEASLR: '-Wl,--high-entropy-va'
  354. windows-i686:
  355. arch: i686
  356. var:
  357. windows-i686: 1
  358. osname: windows-i686
  359. windows:
  360. var:
  361. windows: 1
  362. container:
  363. suite: stretch
  364. arch: amd64
  365. configure_opt: '--host=[% c("arch") %]-w64-mingw32 CFLAGS="[% c("var/CFLAGS") %]" LDFLAGS="[% c("var/LDFLAGS") %]" [% c("var/configure_opt_project") %]'
  366. CFLAGS: '-fstack-protector-strong -fno-strict-overflow -Wno-missing-field-initializers -Wformat -Wformat-security [% c("var/flag_mwindows") %]'
  367. LDFLAGS: '-Wl,--dynamicbase -Wl,--nxcompat -Wl,--enable-reloc-section -Wl,--no-insert-timestamp -lssp -L$gcclibs [% c("var/flag_HEASLR") %] [% c("var/flag_mwindows") %]'
  368. flag_mwindows: '-mwindows'
  369. compiler: mingw-w64
  370. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  371. # We only build snowflake on the alpha and nightly
  372. # channels for now.
  373. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  374. deps:
  375. - build-essential
  376. - python
  377. - bison
  378. - automake
  379. - libtool
  380. - zip
  381. - unzip
  382. torbrowser-osx-x86_64:
  383. - osx-x86_64
  384. osx-x86_64:
  385. arch: x86_64
  386. var:
  387. osx: 1
  388. osname: osx-x86_64
  389. container:
  390. suite: stretch
  391. arch: amd64
  392. compiler: 'macosx-toolchain'
  393. 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") %]'
  394. FLAGS: "-target x86_64-apple-darwin11 -B $cctoolsdir -isysroot $sysrootdir"
  395. LDFLAGS: "-Wl,-syslibroot,$sysrootdir -Wl,-dead_strip -Wl,-pie"
  396. macosx_deployment_target: '10.9'
  397. locale_ja: ja-JP-mac
  398. # We only build snowflake on the alpha and nightly
  399. # channels for now.
  400. snowflake: '[% c("var/alpha") || c("var/nightly") %]'
  401. deps:
  402. - build-essential
  403. - python
  404. - automake
  405. - libtool
  406. - zip
  407. - unzip
  408. faketime_path: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1
  409. set_PTDIR_DOCSDIR: |
  410. PTDIR="$distdir/Contents/MacOS/Tor/PluggableTransports"
  411. DOCSDIR="$distdir/Contents/Resources/TorBrowser/Docs/[% c("var/DOCSDIR_project") %]"
  412. # The no_build_id target can be useful if you want to quickly display
  413. # a build template or other option but don't want to spend time to
  414. # compute the various build ids
  415. no_build_id:
  416. # The defaut timestamp value will use the commit time of the
  417. # selected commit for the project, which will require cloning the
  418. # git repository if it is not present. When we use the no_build_id
  419. # target to display a script, we usually don't care about such
  420. # details, so we set timestamp to 0 to avoid unnecessary cloning.
  421. timestamp: 0
  422. var:
  423. build_id: 1
  424. no_containers:
  425. var:
  426. container:
  427. global_disable: 1
  428. # change the default gpg_wrapper to allow git tag signed using an
  429. # expired key.
  430. # https://bugs.torproject.org/19737
  431. gpg_wrapper: |
  432. #!/bin/bash
  433. export LC_ALL=C
  434. [%
  435. IF c('gpg_keyring');
  436. SET gpg_kr = '--keyring ' _ path(c('gpg_keyring'), path(c('gpg_keyring_dir'))) _ ' --no-default-keyring';
  437. END;
  438. -%]
  439. gpg_verify=0
  440. for opt in "$@"
  441. do
  442. test "$opt" = '--verify' && gpg_verify=1
  443. done
  444. if [ $gpg_verify = 1 ]
  445. then
  446. [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@" | sed 's/^\[GNUPG:\] EXPKEYSIG /\[GNUPG:\] GOODSIG /'
  447. exit ${PIPESTATUS[0]}
  448. else
  449. exec [% c('gpg_bin') %] [% c('gpg_args') %] --with-fingerprint [% gpg_kr %] "$@"
  450. fi
  451. remote_start: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_start") %][% END %]'
  452. remote_exec: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_exec") %][% END %]'
  453. remote_put: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_put") %][% END %]'
  454. remote_get: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_get") %][% END %]'
  455. remote_finish: '[% IF c("var/container/use_container") && ! c("var/container/global_disable") %][% c("runc/remote_finish") %][% END %]'
  456. runc:
  457. remote_start: |
  458. #!/bin/sh
  459. set -e
  460. if [ $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'* | wc -l) -ne 1 ]
  461. then
  462. echo "Can't find container image in input files" >&2
  463. ls -l '[% c("remote_srcdir") %]' >&2
  464. exit 1
  465. fi
  466. mkdir -p '[% c("var/container/dir") %]'/rootfs/rbm
  467. sudo tar -C '[% c("var/container/dir") %]'/rootfs -xf $(ls -1 '[% c("remote_srcdir", { error_if_undef => 1 }) %]/container-image_'*)
  468. [% SET user = c("var/container/user") -%]
  469. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'id ' _ user
  470. _ ' >/dev/null 2>&1 || adduser -m ' _ user _ ' || useradd -m ' _ user }) %]
  471. remote_exec: |
  472. #!/bin/sh
  473. set -e
  474. [% IF c("interactive") -%]
  475. echo Container directory: [% shell_quote(c("var/container/dir")) %]
  476. [% END -%]
  477. mkdir -p '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/rbm
  478. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  479. echo [% shell_quote(c('exec_cmd')) %] >> '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  480. echo '#!/bin/sh' > '[% c("var/container/dir") %]'/rootfs/rbm/run
  481. [% IF c('exec_as_root'); SET user = 'root'; ELSE; SET user = c("var/container/user", { error_if_undef => 1 }); END; %]
  482. echo 'su - [% user %] -c /rbm/cmd' >> '[% c("var/container/dir") %]'/rootfs/rbm/run
  483. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/cmd
  484. chmod +x '[% c("var/container/dir") %]'/rootfs/rbm/run
  485. cat > '[% c("var/container/dir") %]'/config.json << EOF
  486. [% INCLUDE 'runc-config.json' %]
  487. EOF
  488. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  489. sudo ip netns add 'rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %]'
  490. # make sure the lo interface is up (see bug 31293)
  491. sudo ip netns exec 'rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %]' ip link set lo up
  492. [% END -%]
  493. 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 %]
  494. [% IF c("var/container/disable_network/" _ c("exec_name")) -%]
  495. sudo ip netns delete 'rbm-[% sha256(c("build_id", { error_if_undef => 1 })) %]'
  496. [% END -%]
  497. remote_put: |
  498. #!/bin/sh
  499. set -e
  500. [%
  501. SET src = shell_quote(c('put_src', { error_if_undef => 1 }));
  502. SET dst = shell_quote(c('put_dst', { error_if_undef => 1 }));
  503. -%]
  504. sudo mkdir -p '[% c("var/container/dir") %]'/rootfs/[% dst %]
  505. sudo cp -aP [% src %] '[% c("var/container/dir") %]'/rootfs/[% dst %]
  506. # On Ubuntu, the /root/.profile file contains a `mesg n` line which is
  507. # producing some `stdin: is not a tty` messages. To hide them, we hide
  508. # stderr from this part by setting runc_hide_stderr.
  509. [% c("remote_exec", { exec_as_root => 1, exec_cmd => 'chown -R ' _ c("var/container/user") _ ' ' _ dst, runc_hide_stderr => 1 }) %]
  510. remote_get: |
  511. #!/bin/sh
  512. set -e
  513. [%
  514. SET src = shell_quote(c('get_src', { error_if_undef => 1 }));
  515. SET dst = shell_quote(c('get_dst', { error_if_undef => 1 }));
  516. -%]
  517. mkdir -p [% dst %]
  518. srcdir='[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs/[% src %]
  519. sudo chown -R $(whoami) "$srcdir"
  520. if [ $(ls -1 "$srcdir"/* 2> /dev/null | wc -l) -gt 0 ]
  521. then
  522. for file in "$srcdir"/*
  523. do
  524. bname="$(basename "$file")"
  525. test -e [% dst %]/"$bname" && rm -Rf [% dst %]/"$bname"
  526. mv -f "$file" [% dst %]/
  527. done
  528. fi
  529. remote_finish: |
  530. #!/bin/sh
  531. set -e
  532. sudo rm -Rf '[% c("var/container/dir", { error_if_undef => 1 }) %]'/rootfs '[% c("var/container/dir", { error_if_undef => 1 }) %]'/config.json
  533. rmdir '[% c("var/container/dir") %]'
  534. ENV:
  535. TZ: UTC
  536. LC_ALL: C
  537. --- |
  538. # This part of the file contains options written in perl
  539. use IO::CaptureOutput qw(capture_exec);
  540. (
  541. var_p => {
  542. # runc100 is true if we are using runc >= 1.0.0
  543. # we assume that any version that is not 0.1.1 is >= 1.0.0
  544. runc100 => sub {
  545. my ($out) = capture_exec('sudo', 'runc', '--version');
  546. return !($out =~ m/^runc version 0.1.1/);
  547. },
  548. # runc_spec100 is true if runc spec is at least 1.0.0
  549. # We will need to update this when there is a new spec version available
  550. runc_spec100 => sub {
  551. my ($out) = capture_exec('sudo', 'runc', '--version');
  552. return $out =~ m/^.*spec: 1\.[0-9]+\.[0-9]+(?:-dev)?$/m;
  553. },
  554. nightly_torbrowser_version => sub {
  555. state $version = '';
  556. return $version if $version;
  557. my (undef, undef, undef, $day, $mon, $year) = gmtime;
  558. $version = sprintf("tbb-nightly.%u.%02u.%02u", $year + 1900, $mon + 1, $day);
  559. return $version;
  560. },
  561. nightly_torbrowser_incremental_from => sub {
  562. my ($project, $options) = @_;
  563. my $nightly_dir = project_config($project, 'basedir', $options) . '/nightly';
  564. my $current_version = project_config($project, 'var/torbrowser_version', $options);
  565. use Path::Tiny;
  566. return [] unless -d $nightly_dir;
  567. my @dirs = sort map { $_->basename } path($nightly_dir)->children(qr/^tbb-nightly\./);
  568. my $nb_incr = project_config($project, ['var', 'max_torbrowser_incremental_from'], $options);
  569. my @res;
  570. while ($nb_incr > 0) {
  571. my $dir = pop @dirs;
  572. last unless $dir;
  573. next if $dir eq $current_version;
  574. $nb_incr--;
  575. push @res, $dir;
  576. }
  577. return [@res];
  578. },
  579. },
  580. )