summaryrefslogtreecommitdiffstats
path: root/build/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'build/package.py')
-rwxr-xr-xbuild/package.py17
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__':