summaryrefslogtreecommitdiffstats
path: root/scripts/sdks
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sdks')
-rw-r--r--scripts/sdks/README.md2
-rwxr-xr-xscripts/sdks/agl/add2
-rwxr-xr-xscripts/sdks/agl/db-dump9
-rwxr-xr-xscripts/sdks/agl/get-sdk-info3
4 files changed, 14 insertions, 2 deletions
diff --git a/scripts/sdks/README.md b/scripts/sdks/README.md
index 97bae21..c887293 100644
--- a/scripts/sdks/README.md
+++ b/scripts/sdks/README.md
@@ -35,6 +35,7 @@ Returned the list all SDKs (available and installed) using JSON format.
[
{
"name": "My SDK name",
+ "uuid": "a-unique-id",
"description": "A description",
"profile": "profile",
"version": "version",
@@ -102,6 +103,7 @@ returned the following JSON structure:
```json
{
"name": "My SDK name",
+ "uuid": "a-unique-id",
"description": "A description",
"profile": "profile",
"version": "version",
diff --git a/scripts/sdks/agl/add b/scripts/sdks/agl/add
index 839d647..f602fa9 100755
--- a/scripts/sdks/agl/add
+++ b/scripts/sdks/agl/add
@@ -93,6 +93,8 @@ fi
# Compute uuid when needed
if [ "$UUID" = "" ] && [ "$URL" != "" ]; then
UUID=$(echo "$URL" | md5sum |cut -d' ' -f1)
+elif [ "$SDK_FILE" != "" ]; then
+ UUID=$(echo $(basename $SDK_FILE) | md5sum |cut -d' ' -f1)
else
echo "UUID value must be specify using --uuid option."
exit 1
diff --git a/scripts/sdks/agl/db-dump b/scripts/sdks/agl/db-dump
index 027fdcf..ec2b1d8 100755
--- a/scripts/sdks/agl/db-dump
+++ b/scripts/sdks/agl/db-dump
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-#/**************************************************************************
+# /**************************************************************************
# * Copyright 2017-2018 IoT.bzh
# *
# * author: Romain Forlot <romain.forlot@iot.bzh>
@@ -46,7 +46,7 @@ SCRIPT_PATH = os.path.dirname(os.path.abspath(
ENV = subprocess.check_output(
[os.path.join(SCRIPT_PATH, './_env-init.sh'), '-print']).splitlines()
-SDK_ROOT_DIR=None
+SDK_ROOT_DIR = None
for elt in ENV:
k, v = elt.decode().split('=', 1)
if k == 'SDK_ROOT_DIR':
@@ -71,6 +71,7 @@ SDK_DB_JSON = json.load(open(SDK_DB_FILEPATH, 'r'))
for one_sdk in SDK_DB_JSON:
one_sdk['status'] = 'Not Installed'
+ one_sdk['uuid'] = ''
INSTALLED_SDK = []
for root, dirs, files in os.walk(SDK_ROOT_DIR):
@@ -106,6 +107,8 @@ for one_sdk in INSTALLED_SDK:
logging.debug('Path not compliant, skipping')
continue
+ UUID = os.path.basename(os.path.normpath(DIR))
+
SDK_DATE = ''
for line in open(one_sdk['VERSION_FILE']).readlines():
if line.startswith('Timestamp'):
@@ -126,6 +129,7 @@ for one_sdk in INSTALLED_SDK:
sdk['date'] = SDK_DATE
sdk['setupFile'] = one_sdk['ENV_FILE']
sdk['path'] = DIR
+ sdk['uuid'] = UUID
break
if not found:
@@ -133,6 +137,7 @@ for one_sdk in INSTALLED_SDK:
PROFILE + '-' + ARCH + '-' + VERSION)
NEW_SDK = {
'name': PROFILE + '-' + ARCH + '-' + VERSION,
+ 'uuid': UUID,
'description': 'AGL SDK ' + ARCH + ' (version ' + VERSION + ')',
'profile': PROFILE,
'version': VERSION,
diff --git a/scripts/sdks/agl/get-sdk-info b/scripts/sdks/agl/get-sdk-info
index c28f2e4..485d5fe 100755
--- a/scripts/sdks/agl/get-sdk-info
+++ b/scripts/sdks/agl/get-sdk-info
@@ -131,6 +131,8 @@ if [ "${UUID}" = "" ]; then
UUID="basename ${curInstDir}"
elif [ "$URL" != "" ]; then
UUID=$(echo "$URL" | md5sum |cut -d' ' -f1)
+ elif [ "$filename" != "" ]; then
+ UUID=$(echo $(basename $filename) | md5sum |cut -d' ' -f1)
else
echo "UUID value must be specify using --uuid option."
exit 1
@@ -147,6 +149,7 @@ fi
read -r -d '' res <<- EndOfMessage
{
"name": "${profile}_${arch}_${version}",
+ "uuid": "${UUID}",
"description": "AGL SDK ${arch} (version ${version})",
"profile": "${profile}",
"version": "${version}",