diff options
author | Ondřej Šmalec <o.smalec@partner.samsung.com> | 2020-01-22 07:38:29 +0100 |
---|---|---|
committer | Ondřej Šmalec <o.smalec@partner.samsung.com> | 2020-01-22 09:24:03 +0100 |
commit | 6e5944123a88f62c5adda619cf258700146e85d1 (patch) | |
tree | e1bc41e10dea78b4d02f58d6031c7524fed11991 /build | |
parent | 9c14b7d8aed7c055a9ef3495f5e0fe5448202631 (diff) |
Option for additional metadata in package.py
Issue-ID: OOM-2269
Signed-off-by: Ondřej Šmalec <o.smalec@partner.samsung.com>
Change-Id: I6b23512746171fdeaac3883fb61695db2c48c3ab
Diffstat (limited to 'build')
-rwxr-xr-x | build/package.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/build/package.py b/build/package.py index 47f78b87..9e9a6606 100755 --- a/build/package.py +++ b/build/package.py @@ -69,12 +69,13 @@ def prepare_application_repository(directory, url, refspec, patch_path): return repository -def create_package_info_file(output_file, repository_list, tag): +def create_package_info_file(output_file, repository_list, tag, metadata): """ Generates text file in json format containing basic information about the build :param output_file: :param repository_list: list of repositories to be included in package info :param tag: build version of packages + :param metadata: additional metadata into package.info :return: """ log.info('Generating package.info file') @@ -88,6 +89,9 @@ def create_package_info_file(output_file, repository_list, tag): build_info['Build_info'][ repository.config_reader().get_value('remote "origin"', 'url')] = repository.head.commit.hexsha + if len(metadata) != 0: + build_info['Build_info'][metadata[0]] = metadata[1] + with open(output_file, 'w') as outfile: json.dump(build_info, outfile, indent=4) @@ -118,7 +122,8 @@ def build_offline_deliverables(build_version, skip_sw, skip_resources, skip_aux, - overwrite): + overwrite, + metadata): """ Prepares offline deliverables :param build_version: Version for packages tagging @@ -135,6 +140,7 @@ def build_offline_deliverables(build_version, :param skip_resources: skip resources package generation :param skip_aux: skip aux package generation :param overwrite: overwrite files in output directory + :param metadata: add metadata info into package.info :return: """ @@ -155,7 +161,7 @@ def build_offline_deliverables(build_version, # Package info info_file = os.path.join(output_dir, 'package.info') - create_package_info_file(info_file, [application_repository, offline_repository], build_version) + create_package_info_file(info_file, [application_repository, offline_repository], build_version, metadata) # packages layout as dictionaries. <file> : <file location under tar archive> sw_content = { @@ -262,6 +268,8 @@ def run_cli(): help='overwrite files in output directory') parser.add_argument('--debug', action='store_true', default=False, help='Turn on debug output') + parser.add_argument('--add-metadata', nargs=2, + help='additional metadata added into package.info, format: key value', default=[]) args = parser.parse_args() if args.debug: @@ -282,7 +290,8 @@ def run_cli(): args.skip_sw, args.skip_resources, args.skip_aux, - args.overwrite) + args.overwrite, + args.add_metadata) if __name__ == '__main__': |