Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5a4bd0d

Browse files
Create a separate directory for the intermediate outputs of each Fuchsia archive build action (#13341)
1 parent 7b4c38d commit 5a4bd0d

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

tools/fuchsia/gen_package.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,18 @@ def main():
7474
if not os.path.exists(os.path.join(pkg_dir, 'meta', 'package')):
7575
CreateMetaPackage(pkg_dir, args.far_name)
7676

77+
output_dir = os.path.abspath(pkg_dir + '_out')
78+
if not os.path.exists(output_dir):
79+
os.makedirs(output_dir)
80+
7781
manifest_file = None
7882
if args.manifest_file is not None:
7983
assert os.path.exists(args.manifest_file)
8084
manifest_file = args.manifest_file
8185
else:
8286
manifest_file = GenerateManifest(args.package_dir)
8387

84-
strace_out = os.path.abspath(os.path.join(os.path.dirname(pkg_dir), 'strace_out'))
88+
strace_out = os.path.join(output_dir, 'strace_out')
8589

8690
pm_command_base = [
8791
'strace',
@@ -90,7 +94,7 @@ def main():
9094
strace_out,
9195
args.pm_bin,
9296
'-o',
93-
os.path.abspath(os.path.join(pkg_dir, os.pardir)),
97+
output_dir,
9498
'-k',
9599
args.signing_key,
96100
'-m',
@@ -100,15 +104,25 @@ def main():
100104
# Build and then archive the package
101105
# Use check_output so if anything goes wrong we get the output.
102106
try:
103-
for pm_command in ['build', 'archive']:
104-
pm_command_args = pm_command_base + [pm_command]
107+
pm_commands = [
108+
['build'],
109+
['archive', '--output='+ os.path.join(os.path.dirname(output_dir), args.far_name + "-0")],
110+
]
111+
for pm_command in pm_commands:
112+
pm_command_args = pm_command_base + pm_command
105113
sys.stderr.write("===== Running %s\n" % pm_command_args)
106114
subprocess.check_output(pm_command_args)
107115
except subprocess.CalledProcessError as e:
108116
print('==================== Manifest contents =========================================')
109117
with open(manifest_file, 'r') as manifest:
110118
sys.stdout.write(manifest.read())
111119
print('==================== End manifest contents =====================================')
120+
meta_contents_path = os.path.join(output_dir, 'meta', 'contents')
121+
if os.path.exists(meta_contents_path):
122+
print('==================== meta/contents =============================================')
123+
with open(meta_contents_path, 'r') as meta_contents:
124+
sys.stdout.write(meta_contents.read())
125+
print('==================== End meta/contents =========================================')
112126
print('==================== Strace output =============================================')
113127
with open(strace_out, 'r') as strace:
114128
sys.stdout.write(strace.read())

0 commit comments

Comments
 (0)