summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFathi Boudra <fathi.boudra@linaro.org>2014-06-22 12:29:33 +0300
committerFathi Boudra <fathi.boudra@linaro.org>2014-06-22 12:29:33 +0300
commit1085dc08b479b49a92ab9e90373800d31999550d (patch)
tree113fc98296efb3ce00920241ee9fb21efb28e845
parentd94d5f3b5f10a5aa8270159fb2e9213c759d6763 (diff)
Add a generic function to get the hwpack type
Signed-off-by: Fathi Boudra <fathi.boudra@linaro.org>
-rwxr-xr-xpost-build-lava.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/post-build-lava.py b/post-build-lava.py
index 0bf93fb..d9d229f 100755
--- a/post-build-lava.py
+++ b/post-build-lava.py
@@ -58,6 +58,17 @@ def auth_headers(username, password):
return 'Basic ' + base64.encodestring('%s:%s' % (username, password))[:-1]
+def get_hwpack_type(job_name, hwpack_file_name="Undefined"):
+ hwpack_type = job_name.replace('/', ',')
+ ret_split = dict(
+ token.split('=') for token in hwpack_type.split(',') if '=' in token)
+ try:
+ return ret_split['hwpack']
+ except KeyError, e:
+ # If hwpack key is not found, fallback to hwpack file name
+ return hwpack_file_name.split('_')[1].split('-')[1]
+
+
def get_rootfs_url(distribution, architecture, rootfs_type):
# Rootfs last successful build number
ci_url = '%s%s-%s-%s%s%s%s' % \
@@ -241,15 +252,12 @@ def main():
ret_split = hwpack_job_name.split('-', 3)
hwpack_type = ret_split[3]
elif hwpack_job_name.startswith('linux'):
- hwpack_type = hwpack_job_name.split('/')[1]
- ret_split = dict(
- token.split('=') for token in hwpack_type.split(','))
- hwpack_type = ret_split['hwpack']
+ hwpack_type = get_hwpack_type(hwpack_job_name)
else:
ret_split = hwpack_job_name.split('-', 2)
(distribution, architecture, hwpack_type) = \
ret_split[0], ret_split[1], ret_split[2]
- hwpack_type = hwpack_file_name.split('_')[1].split('-')[1]
+ hwpack_type = get_hwpack_type(hwpack_job_name, hwpack_file_name)
# Rootfs type, default is nano-lava
rootfs_type = os.getenv('ROOTFS_TYPE', 'nano-lava')