| # Copyright 2016 The Fuchsia Authors. All rights reserved. | 
 | # Use of this source code is governed by a BSD-style license that can be | 
 | # found in the LICENSE file. | 
 |  | 
 | import("//build/compiled_action.gni") | 
 |  | 
 | group("archives") { | 
 |   testonly = true | 
 |   deps = [ ":package_archive" ] | 
 | } | 
 |  | 
 | # Generates an archive of package metadata. | 
 | amber_files = rebase_path("$root_build_dir/amber-files") | 
 | pm_tool = rebase_path("$host_out_dir/pm") | 
 | pkg_archive_contents = [ | 
 |   "amber-files/repository=$amber_files/repository", | 
 |  | 
 |   # TODO(fxbug.dev/24959): this should never contain the root key. In the future, this | 
 |   # should contain no keys, once infra is managing key material itself. | 
 |   # These keys are consumed by the infra train promote scripts. | 
 |   "amber-files/keys=$amber_files/keys", | 
 |   "pm=$pm_tool", | 
 | ] | 
 | pkg_archive_manifest = "$target_gen_dir/package_archive_manifest" | 
 | write_file(pkg_archive_manifest, pkg_archive_contents) | 
 |  | 
 | # NOTE: This is consumed by the system OTA tests. Please check in with the | 
 | # software delivery team if you need to change this. | 
 | pkg_archive = "$root_build_dir/packages.tar.gz" | 
 | compiled_action("package_archive") { | 
 |   testonly = true | 
 |   tool = "//build/tools/tarmaker" | 
 |   inputs = [ pkg_archive_manifest ] | 
 |   outputs = [ pkg_archive ] | 
 |   args = [ | 
 |     "-manifest", | 
 |     rebase_path(pkg_archive_manifest), | 
 |     "-output", | 
 |     rebase_path(pkg_archive), | 
 |   ] | 
 |   deps = [ "//build/images:updates" ] | 
 |  | 
 |   metadata = { | 
 |     archives = [ | 
 |       { | 
 |         name = "packages" | 
 |         path = rebase_path(outputs[0], root_build_dir) | 
 |         type = "tgz" | 
 |       }, | 
 |     ] | 
 |   } | 
 | } |