# vim: filetype=yaml sw=2
git_hash: 'v[% c("version") %]'
git_url:  https://github.com/mozilla/glean.git
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
version: '[% pc(c("origin_project"), "var/glean_version", { step => "list_toolchain_updates" }) %]'

src: |
  #!/bin/bash
  mv -f [% project %]-[% c('version') %].tar.gz [% dest_dir %]/[% c('filename') %]

var:
  # The `container-image` project looks at the deps list in origin_project
  # in the same step (build), so we cannot put this inside the
  # `create_glean_deps_tarball` step.
  # rbm#40020 should allow us to fix that.
  deps:
    - python3
    - python3-pip
    - torsocks
    - xz-utils
  glean_wheels_sha256sum:
    3.4.0: 6bbf3a9ffa939ca87e00b486f2020ab5cf9dea772f1d37b048f666fed38f98c1
    4.0.0: c974113bd8671364c592fea9b64bac660b59d4f03a7dcecd4dd4e0c355431db8
    4.2.0: 09cda9fb155e4987bdc03b702219960e9729c448146f023f8c93de57836edf31
    4.4.0: afc0eb6497413eab8e5cf95cf9bbfe4dc1cc53a208b9b66572cfde752f3023e9
    5.0.1: 289b843af3d0f4bd5fbdc77c94c7e1b2830bcbbf7e43786d30b2bd02f85b4a1a
  glean_wheels_url:
    3.4.0: https://people.torproject.org/~boklm/mirrors/sources/glean-wheels-3.4.0-build2.tar.xz
    4.0.0: https://people.torproject.org/~boklm/mirrors/sources/glean-wheels-4.0.0.tar.xz
    4.2.0: https://people.torproject.org/~pierov/tbb_files/glean-wheels-4.2.0.tar.xz
    4.4.0: https://people.torproject.org/~boklm/mirrors/sources/glean-wheels-4.4.0.tar.xz
    5.0.1: https://people.torproject.org/~richard/mirrors/sources/glean-wheels-5.0.1.tar.xz

steps:
  create_glean_deps_tarball:
    git_url: ''
    version: 5.0.1
    filename: 'glean-wheels-[% c("version") %].tar.xz'
    build_log: '-'
    container:
      use_container: 1
    create_glean_deps_tarball: |
      #!/bin/bash
      [% c("var/set_default_env") -%]
      mkdir glean-wheels
      cd glean-wheels
      [% IF c("var/use_torsocks") %]torsocks [% END%]python3 -m pip download glean_parser==[% c("version") %]
      # Get pyyaml, needed for building application-services
      [% IF c("var/use_torsocks") %]torsocks [% END%]python3 -m pip download pyyaml==5.3.1
      cd ..
      [% c('tar', {
          tar_src => [ 'glean-wheels' ],
          tar_args => '-cJf ' _ dest_dir _ '/' _ c('filename'),
          }) %]
      cd '[% dest_dir %]'
      sha256sum [% c('filename') %]
      echo 'The file is ready to be uploaded:'
      echo '  scp -p out/glean/[% c("filename") %] people.torproject.org:public_html/mirrors/sources/'
    input_files:
      - project: container-image
        pkg_type: build

targets:
  with_torsocks:
      use_torsocks: 1
