rbm.conf 19 KB

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