deploy_to_pkg_repo.py 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env vpython3
  2. #
  3. # Copyright 2019 The Chromium Authors. All rights reserved.
  4. # Use of this source code is governed by a BSD-style license that can be
  5. # found in the LICENSE file.
  6. """Deploys Fuchsia packages to a package repository in a Fuchsia
  7. build output directory."""
  8. import pkg_repo
  9. import argparse
  10. import os
  11. import sys
  12. def main():
  13. parser = argparse.ArgumentParser()
  14. parser.add_argument('--package',
  15. action='append',
  16. required=True,
  17. help='Paths to packages to install.')
  18. parser.add_argument('--fuchsia-out-dir',
  19. required=True,
  20. help='Path to a Fuchsia build output directory. '
  21. 'Setting the GN arg '
  22. '"default_fuchsia_build_dir_for_installation" '
  23. 'will cause it to be passed here.')
  24. args, _ = parser.parse_known_args()
  25. assert args.package
  26. fuchsia_out_dir = os.path.expanduser(args.fuchsia_out_dir)
  27. fuchsia_amber_files_dir = os.path.join(fuchsia_out_dir, 'amber-files')
  28. assert os.path.exists(fuchsia_amber_files_dir), \
  29. '{} not found, check that --fuchsia-out-dir points to a valid out dir.' \
  30. ' eg. /path/to/fuchsia/out/default'.format(fuchsia_amber_files_dir)
  31. repo = pkg_repo.ExternalPkgRepo(fuchsia_amber_files_dir,
  32. os.path.join(fuchsia_out_dir, '.build-id'))
  33. print('Installing packages and symbols in package repo %s...' %
  34. repo.GetPath())
  35. for package in args.package:
  36. repo.PublishPackage(package)
  37. print('Installation success.')
  38. return 0
  39. if __name__ == '__main__':
  40. sys.exit(main())