Rework sdk uuid management because previous code prevented to install
local sdk using following command:
xds-cli sdks install --file $HOME/xds-workspace/my_local_sdk.sh
Change-Id: I20bac8a76d32b005a6775e936756c96048651766
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
}
// GetSDKInfo Used get-sdk-info script to extract SDK get info from a SDK file/tarball
}
// GetSDKInfo Used get-sdk-info script to extract SDK get info from a SDK file/tarball
-func GetSDKInfo(scriptDir, url, filename, md5sum string, log *logrus.Logger) (xsapiv1.SDK, error) {
+func GetSDKInfo(scriptDir, url, filename, md5sum, uuid string, log *logrus.Logger) (xsapiv1.SDK, error) {
sdk := xsapiv1.SDK{}
args := []string{}
sdk := xsapiv1.SDK{}
args := []string{}
} else {
return sdk, fmt.Errorf("url of filename must be set")
}
} else {
return sdk, fmt.Errorf("url of filename must be set")
}
+ if uuid != "" {
+ args = append(args, "--uuid", uuid)
+ }
cmd := exec.Command(path.Join(scriptDir, scriptGetSdkInfo), args...)
stdout, err := cmd.CombinedOutput()
cmd := exec.Command(path.Join(scriptDir, scriptGetSdkInfo), args...)
stdout, err := cmd.CombinedOutput()
// (see sdks.go / monitorSDKInstallation )
// Update SetupFile when n
if s.sdk.SetupFile == "" {
// (see sdks.go / monitorSDKInstallation )
// Update SetupFile when n
if s.sdk.SetupFile == "" {
- sdkDef, err := GetSDKInfo(s.sdk.FamilyConf.ScriptsDir, s.sdk.URL, "", "", s.Log)
+ sdkDef, err := GetSDKInfo(s.sdk.FamilyConf.ScriptsDir, s.sdk.URL, "", "", s.sdk.UUID, s.Log)
if err != nil || sdkDef.SetupFile == "" {
s.Log.Errorf("GetSDKInfo error: %v", err)
code = 1
if err != nil || sdkDef.SetupFile == "" {
s.Log.Errorf("GetSDKInfo error: %v", err)
code = 1
// Update path when not set
if sdk.Path == "" {
// Update path when not set
if sdk.Path == "" {
- sdkDef, err := GetSDKInfo(scriptDir, sdk.URL, "", "", s.Log)
+ sdkDef, err := GetSDKInfo(scriptDir, sdk.URL, "", "", sdk.UUID, s.Log)
if err != nil || sdkDef.Path == "" {
return nil, fmt.Errorf("cannot retrieve sdk path %v", err)
}
if err != nil || sdkDef.Path == "" {
return nil, fmt.Errorf("cannot retrieve sdk path %v", err)
}
}
for _, sf := range s.SdksFamilies {
}
for _, sf := range s.SdksFamilies {
- sdkDef, err := GetSDKInfo(sf.ScriptsDir, "", sdkFilename, "", s.Log)
+ sdkDef, err := GetSDKInfo(sf.ScriptsDir, "", sdkFilename, "", "", s.Log)
if err == nil {
// OK, sdk found
sdk = &sdkDef
if err == nil {
// OK, sdk found
sdk = &sdkDef
type SDK struct {
ID string `json:"id" binding:"required"`
Name string `json:"name"`
type SDK struct {
ID string `json:"id" binding:"required"`
Name string `json:"name"`
+ UUID string `json:"uuid"`
Description string `json:"description"`
Profile string `json:"profile"`
Version string `json:"version"`
Description string `json:"description"`
Profile string `json:"profile"`
Version string `json:"version"`
[
{
"name": "My SDK name",
[
{
"name": "My SDK name",
"description": "A description",
"profile": "profile",
"version": "version",
"description": "A description",
"profile": "profile",
"version": "version",
```json
{
"name": "My SDK name",
```json
{
"name": "My SDK name",
"description": "A description",
"profile": "profile",
"version": "version",
"description": "A description",
"profile": "profile",
"version": "version",
# Compute uuid when needed
if [ "$UUID" = "" ] && [ "$URL" != "" ]; then
UUID=$(echo "$URL" | md5sum |cut -d' ' -f1)
# 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
else
echo "UUID value must be specify using --uuid option."
exit 1
-#/**************************************************************************
+# /**************************************************************************
# * Copyright 2017-2018 IoT.bzh
# *
# * author: Romain Forlot <romain.forlot@iot.bzh>
# * Copyright 2017-2018 IoT.bzh
# *
# * author: Romain Forlot <romain.forlot@iot.bzh>
ENV = subprocess.check_output(
[os.path.join(SCRIPT_PATH, './_env-init.sh'), '-print']).splitlines()
ENV = subprocess.check_output(
[os.path.join(SCRIPT_PATH, './_env-init.sh'), '-print']).splitlines()
for elt in ENV:
k, v = elt.decode().split('=', 1)
if k == 'SDK_ROOT_DIR':
for elt in ENV:
k, v = elt.decode().split('=', 1)
if k == 'SDK_ROOT_DIR':
for one_sdk in SDK_DB_JSON:
one_sdk['status'] = 'Not Installed'
for one_sdk in SDK_DB_JSON:
one_sdk['status'] = 'Not Installed'
INSTALLED_SDK = []
for root, dirs, files in os.walk(SDK_ROOT_DIR):
INSTALLED_SDK = []
for root, dirs, files in os.walk(SDK_ROOT_DIR):
logging.debug('Path not compliant, skipping')
continue
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'):
SDK_DATE = ''
for line in open(one_sdk['VERSION_FILE']).readlines():
if line.startswith('Timestamp'):
sdk['date'] = SDK_DATE
sdk['setupFile'] = one_sdk['ENV_FILE']
sdk['path'] = DIR
sdk['date'] = SDK_DATE
sdk['setupFile'] = one_sdk['ENV_FILE']
sdk['path'] = DIR
PROFILE + '-' + ARCH + '-' + VERSION)
NEW_SDK = {
'name': PROFILE + '-' + ARCH + '-' + VERSION,
PROFILE + '-' + ARCH + '-' + VERSION)
NEW_SDK = {
'name': PROFILE + '-' + ARCH + '-' + VERSION,
'description': 'AGL SDK ' + ARCH + ' (version ' + VERSION + ')',
'profile': PROFILE,
'version': VERSION,
'description': 'AGL SDK ' + ARCH + ' (version ' + VERSION + ')',
'profile': PROFILE,
'version': VERSION,
UUID="basename ${curInstDir}"
elif [ "$URL" != "" ]; then
UUID=$(echo "$URL" | md5sum |cut -d' ' -f1)
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
else
echo "UUID value must be specify using --uuid option."
exit 1
read -r -d '' res <<- EndOfMessage
{
"name": "${profile}_${arch}_${version}",
read -r -d '' res <<- EndOfMessage
{
"name": "${profile}_${arch}_${version}",
"description": "AGL SDK ${arch} (version ${version})",
"profile": "${profile}",
"version": "${version}",
"description": "AGL SDK ${arch} (version ${version})",
"profile": "${profile}",
"version": "${version}",