rbm.conf 20 KB

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