Skip to content

Commit

Permalink
modules/build.py: Allow building individual modules
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
  • Loading branch information
chenxiaolong committed May 23, 2023
1 parent 7bce3c5 commit 60f5b44
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion modules/build.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

import argparse
import io
import os
import re
Expand Down Expand Up @@ -117,13 +118,24 @@ def build_module(dist_dir, common_dir, module_dir, extra_files):
return zip_path


def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('module', nargs='*',
default=('clearotacerts', 'oemunlockonboot'),
help='Module to build')

return parser.parse_args()


def main():
args = parse_args()

dist_dir = os.path.join(sys.path[0], 'dist')
os.makedirs(dist_dir, exist_ok=True)

common_dir = os.path.join(sys.path[0], 'common')

for module in ('clearotacerts', 'oemunlockonboot'):
for module in args.module:
module_dir = os.path.join(sys.path[0], module)

if module == 'clearotacerts':
Expand All @@ -141,6 +153,8 @@ def main():
'file': os.path.join(module_dir, 'service.sh'),
},
}
else:
raise ValueError(f'Invalid module: {module}')

module_zip = build_module(dist_dir, common_dir, module_dir, extra_files)
print('Built module', module_zip)
Expand Down

0 comments on commit 60f5b44

Please sign in to comment.