diff options
author | LaMont Jones <lamontjones@chromium.org> | 2021-02-09 17:15:13 -0700 |
---|---|---|
committer | LaMont Jones <lamontjones@chromium.org> | 2021-02-10 21:53:03 +0000 |
commit | bd0a091787d9b3cb57ff88dd37b9895ed5c72f03 (patch) | |
tree | 31fc598d374217d8478ff78dffc9738099afb413 | |
parent | d91a433c715099dc2bf7a2f5e9155fcfec69ef16 (diff) | |
download | chrome-ec-bd0a091787d9b3cb57ff88dd37b9895ed5c72f03.tar.gz |
firmware_builder: start creating FirmwareArtifactInfo
BUG=b:176926834, b:177907747
BRANCH=None
TEST=manual
Change-Id: I8728f45b6ece0c6e047439ed8b4b6e6b0d0e9e2e
Signed-off-by: LaMont Jones <lamontjones@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2686259
Reviewed-by: Sean McAllister <smcallis@google.com>
Tested-by: Sean McAllister <smcallis@google.com>
-rwxr-xr-x | firmware_builder.py | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/firmware_builder.py b/firmware_builder.py index fc8aa29262..3d9f6dd12f 100755 --- a/firmware_builder.py +++ b/firmware_builder.py @@ -48,25 +48,28 @@ def build(opts): def bundle(opts): """Bundles the artifacts from each target into its own tarball.""" + info = firmware_pb2.FirmwareArtifactInfo() bundle_dir = opts.output_dir if opts.output_dir else DEFAULT_BUNDLE_DIRECTORY if not os.path.isdir(bundle_dir): os.mkdir(bundle_dir) - for build_target in os.listdir( - os.path.join(os.path.dirname(__file__), 'build')): - subprocess.run([ - 'tar', 'cvfj', - os.path.join( - bundle_dir, ''.join([ - build_target, '.firmware_from_source.tar.bz2' - ])), '--exclude=\'*.o\'', '.' - ], - cwd=os.path.join(os.path.dirname(__file__), 'build', - build_target), - check=True) + ec_dir = os.path.dirname(__file__) + for build_target in sorted(os.listdir(os.path.join(ec_dir, 'build'))): + tarball_name = ''.join([build_target, '.firmware.tbz2']) + tarball_path = os.path.join(bundle_dir, tarball_name) + cmd = [ + 'tar', 'cvfj', tarball_path, '--exclude=*.o.d', '--exclude=*.o', '.' + ] + subprocess.run( + cmd, cwd=os.path.join(ec_dir, 'build', build_target), check=True) + meta = info.objects.add() + meta.file_name = tarball_name + meta.tarball_info.type = firmware_pb2.FirmwareArtifactInfo.TarballInfo.FirmwareType.EC + # TODO(kmshelton): Populate the rest of metadata contents as it gets defined in + # infra/proto/src/chromite/api/firmware.proto. + bundle_metadata_file = opts.metadata if opts.metadata else DEFAULT_BUNDLE_METADATA_FILE - # TODO(kmshelton): Populate the metatadata contents when it is defined in - # infra/proto/src/chromite/api/firmware.proto. - os.mknod(bundle_metadata_file) + with open(bundle_metadata_file, 'w') as f: + f.write(json_format.MessageToJson(info)) def test(opts): |