fetch_tarball

in mirror_dependencies.rb [33:51]


def fetch_tarball(repository:, tarball_url:, destination_dir: 'mirror/', digest:)
  download = true
  url = tarball_url
  url = "#{repository}/#{tarball_url}" unless tarball_url.start_with? 'https://'

  basename = File.basename(url)
  destination = File.expand_path("#{destination_dir}/#{basename}")

  if File.exist? destination
    puts "== Package exists @ #{destination}"
    download = !existing_digest(existing: destination, digest: digest)
  end

  return unless download

  puts "++ Downloading #{url}"
  download_tarball(url: url, destination: destination)
end