Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions tools/fuchsia/gen_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ def main():
if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')):
CreateMetaPackage(pkg_dir, args.far_name)

output_dir = os.path.abspath(pkg_dir + '_out')
if not os.path.exists(output_dir):
os.makedirs(output_dir)

manifest_file = None
if args.manifest_file is not None:
assert os.path.exists(args.manifest_file)
manifest_file = args.manifest_file
else:
manifest_file = GenerateManifest(args.package_dir)

strace_out = os.path.abspath(os.path.join(os.path.dirname(pkg_dir), 'strace_out'))
strace_out = os.path.join(output_dir, 'strace_out')

pm_command_base = [
'strace',
Expand All @@ -90,7 +94,7 @@ def main():
strace_out,
args.pm_bin,
'-o',
os.path.abspath(os.path.join(pkg_dir, os.pardir)),
output_dir,
'-k',
args.signing_key,
'-m',
Expand All @@ -100,15 +104,25 @@ def main():
# Build and then archive the package
# Use check_output so if anything goes wrong we get the output.
try:
for pm_command in ['build', 'archive']:
pm_command_args = pm_command_base + [pm_command]
pm_commands = [
['build'],
['archive', '--output='+ os.path.join(os.path.dirname(output_dir), args.far_name + "-0")],
]
for pm_command in pm_commands:
pm_command_args = pm_command_base + pm_command
sys.stderr.write("===== Running %s\n" % pm_command_args)
subprocess.check_output(pm_command_args)
except subprocess.CalledProcessError as e:
print('==================== Manifest contents =========================================')
with open(manifest_file, 'r') as manifest:
sys.stdout.write(manifest.read())
print('==================== End manifest contents =====================================')
meta_contents_path = os.path.join(output_dir, 'meta', 'contents')
if os.path.exists(meta_contents_path):
print('==================== meta/contents =============================================')
with open(meta_contents_path, 'r') as meta_contents:
sys.stdout.write(meta_contents.read())
print('==================== End meta/contents =========================================')
print('==================== Strace output =============================================')
with open(strace_out, 'r') as strace:
sys.stdout.write(strace.read())
Expand Down