diff options
-rw-r--r-- | custom_lava_job_definition.yaml | 20 | ||||
-rw-r--r-- | dtb-to-device.py | 55 | ||||
-rwxr-xr-x | yaml-to-json.py | 41 |
3 files changed, 64 insertions, 52 deletions
diff --git a/custom_lava_job_definition.yaml b/custom_lava_job_definition.yaml deleted file mode 100644 index e86a24a..0000000 --- a/custom_lava_job_definition.yaml +++ /dev/null @@ -1,20 +0,0 @@ -actions: - - command: deploy_linaro_kernel - parameters: - dtb: 'http://snapshots.linaro.org/kernel-hwpack/linux-next/${defconfig}/${BUILD_NUMBER}/dtb/${DTB_FILE_NAME}' - kernel: 'http://snapshots.linaro.org/kernel-hwpack/linux-next/${defconfig}/${BUILD_NUMBER}/${KERNEL_FILE_NAME}' - nfsrootfs: 'http://snapshots.linaro.org/openembedded/images/minimal-armv7a-gcc-4.9/293/linaro-image-minimal-genericarmv7a-20140901-293.rootfs.tar.gz' - metadata: - build id: '${BUILD_NUMBER}' - defconfig: '${kernel_config}' - git URL: '${GIT_URL}' - git branch: '${GIT_BRANCH}' - git commit: '${GIT_COMMIT}' - - command: boot_linaro_image - - command: submit_results - parameters: - server: 'http://validation.linaro.org/RPC2/' - stream: '${BUNDLE_STREAM_NAME}' -device_type: ${DEVICE_TYPE} -job_name: ${BUILD_URL} -timeout: 3600 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) 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() |