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