summaryrefslogtreecommitdiff
path: root/yaml-to-json.py
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2014-09-12 11:58:51 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2014-09-12 11:58:51 +0300
commit3479aea34436b63cc29fbced82c0f0443bda3223 (patch)
treeda23aa105014c7dd4b6aede69cc937edad4ed9bd /yaml-to-json.py
parenta5d146ea306b6cf426663adedd41f9b87b8323e3 (diff)
downloadlci-build-tools-3479aea34436b63cc29fbced82c0f0443bda3223.tar.gz
Split yaml to json conversion into its own program
Change-Id: I31bf97795eac4366b4f4352126013c387af1f0e8 Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Diffstat (limited to 'yaml-to-json.py')
-rwxr-xr-xyaml-to-json.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/yaml-to-json.py b/yaml-to-json.py
new file mode 100755
index 0000000..2c7bdb3
--- /dev/null
+++ b/yaml-to-json.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+import json
+import os
+import string
+import sys
+import yaml
+
+
+def main():
+ with open(sys.argv[1]) as f:
+ template = string.Template(f.read())
+
+ lava_template = template.safe_substitute(
+ BUILD_NUMBER=os.environ.get('BUILD_NUMBER'),
+ BUILD_URL=os.environ.get('BUILD_URL'),
+ BUNDLE_STREAM_NAME=os.environ.get('BUNDLE_STREAM_NAME'),
+ DEVICE_TYPE=os.environ.get('DEVICE_TYPE'),
+ DTB=os.environ.get('DTB'),
+ DTB_URL=os.environ.get('DTB_URL'),
+ GIT_BRANCH=os.environ.get('GIT_BRANCH'),
+ GIT_COMMIT=os.environ.get('GIT_COMMIT'),
+ GIT_URL=os.environ.get('GIT_URL'),
+ HWPACK_BUILD_URL=os.environ.get('HWPACK_BUILD_URL'),
+ KERNEL=os.environ.get('KERNEL'),
+ KERNEL_URL=os.environ.get('KERNEL_URL'),
+ LAVA_SERVER=os.environ.get('LAVA_SERVER'),
+ ROOTFS_BUILD_NUMBER=os.environ.get('ROOTFS_BUILD_NUMBER'),
+ ROOTFS_BUILD_URL=os.environ.get('ROOTFS_BUILD_URL'),
+ STARTUP_NSH=os.environ.get('STARTUP_NSH'),
+ defconfig=os.environ.get('defconfig'),
+ hwpack_type=os.environ.get('hwpack_type'),
+ kernel_config=os.environ.get('kernel_config'),
+ )
+
+ config = json.dumps(yaml.safe_load(lava_template), indent=2)
+ print config
+
+
+if __name__ == '__main__':
+ main()