summaryrefslogtreecommitdiff
path: root/dtb-to-device.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 /dtb-to-device.py
parenta5d146ea306b6cf426663adedd41f9b87b8323e3 (diff)
Split yaml to json conversion into its own program
Change-Id: I31bf97795eac4366b4f4352126013c387af1f0e8 Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
Diffstat (limited to 'dtb-to-device.py')
-rw-r--r--dtb-to-device.py55
1 files changed, 23 insertions, 32 deletions
diff --git a/dtb-to-device.py b/dtb-to-device.py
index 20c3791..92486b0 100644
--- a/dtb-to-device.py
+++ b/dtb-to-device.py
@@ -1,12 +1,10 @@
#!/usr/bin/python
import argparse
-import json
import os
import re
-import string
+import subprocess
import xmlrpclib
-import yaml
# mapping device tree blob - device type
device = {
@@ -93,37 +91,30 @@ def main():
lava_server = os.environ.get('LAVA_SERVER',
'validation.linaro.org/RPC2/')
-
- for root, dirs, dtb_files in os.walk(dtbs_path):
- for dtb_file in dtb_files:
- device_type = device.get(dtb_file, None)
+ for root, dirs, files in os.walk('out'):
+ for file in files:
+ if 'Image' in file:
+ kernel = file
+
+ for root, dirs, files in os.walk(dtbs_path):
+ for dtb in files:
+ device_type = device.get(dtb, None)
+ definitions_path = 'configs/linux-kernel-ci/lava-job-definitions'
+ devices = os.listdir(definitions_path)
+ definition = '%s/generic/template.yaml' % definitions_path
+ if device_type in devices:
+ definition = '%s/%s/template.yaml' % (definitions_path, device_type)
if device_type is None:
- print 'INFO: %s is not mapped to a device' % dtb_file
+ print 'INFO: %s is not mapped to a device' % dtb
else:
- with open('custom_lava_job_definition.yaml') as f:
- template = string.Template(f.read())
-
- lava_template = template.safe_substitute(
- DTB_FILE_NAME=dtb_file,
- KERNEL_FILE_NAME=os.environ.get('KERNEL_FILE_NAME'),
- defconfig=os.environ.get('defconfig'),
- kernel_config=os.environ.get('kernel_config'),
- BUILD_NUMBER=os.environ.get('BUILD_NUMBER'),
- STARTUP_NSH=os.environ.get('STARTUP_NSH'),
- HWPACK_BUILD_URL=os.environ.get('HWPACK_BUILD_URL'),
- ROOTFS_BUILD_URL=os.environ.get('ROOTFS_BUILD_URL'),
- hwpack_type=os.environ.get('hwpack_type'),
- ROOTFS_BUILD_NUMBER=os.environ.get('ROOTFS_BUILD_NUMBER'),
- GIT_URL=os.environ.get('GIT_URL'),
- GIT_BRANCH=os.environ.get('GIT_BRANCH'),
- GIT_COMMIT=os.environ.get('GIT_COMMIT'),
- BUNDLE_STREAM_NAME=os.environ.get('BUNDLE_STREAM_NAME'),
- LAVA_SERVER=lava_server,
- DEVICE_TYPE=device_type,
- BUILD_URL=os.environ.get('BUILD_URL')
- )
-
- config = json.dumps(yaml.safe_load(lava_template), indent=2)
+ env = os.environ
+ env['DTB'] = dtb
+ env['KERNEL'] = kernel
+ env['DEVICE_TYPE'] = device_type
+ env['LAVA_SERVER'] = lava_server
+
+ config = subprocess.check_output(['./yaml-to-json.py', definition],
+ env=env)
lava_submit(config, lava_server)