summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-06-27 15:52:14 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-06-27 15:52:14 +0200
commita93832c2e3058c55e183c487dde595bd42238bb0 (patch)
treefa91d706217327210db4aadc1a8d9f3973f8a5e0 /lib
parent7f3c55f02aa6b35b3530883a6c1f71ddd1f92eb4 (diff)
Fixed sdk from local file installation
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/xdsserver/sdk.go7
-rw-r--r--lib/xdsserver/sdks.go4
-rw-r--r--lib/xsapiv1/sdks.go1
3 files changed, 8 insertions, 4 deletions
diff --git a/lib/xdsserver/sdk.go b/lib/xdsserver/sdk.go
index 7c912c4..68c92b4 100644
--- a/lib/xdsserver/sdk.go
+++ b/lib/xdsserver/sdk.go
@@ -92,7 +92,7 @@ func ListCrossSDK(scriptDir string, update bool, log *logrus.Logger) ([]xsapiv1.
}
// 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{}
@@ -106,6 +106,9 @@ func GetSDKInfo(scriptDir, url, filename, md5sum string, log *logrus.Logger) (xs
} 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()
@@ -327,7 +330,7 @@ func (s *CrossSDK) Install(file string, force bool, timeout int, args []string,
// (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
diff --git a/lib/xdsserver/sdks.go b/lib/xdsserver/sdks.go
index 4a7ba84..ee6a269 100644
--- a/lib/xdsserver/sdks.go
+++ b/lib/xdsserver/sdks.go
@@ -340,7 +340,7 @@ func (s *SDKs) Install(id, filepath string, force bool, timeout int, args []stri
// 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)
}
@@ -356,7 +356,7 @@ func (s *SDKs) Install(id, filepath string, force bool, timeout int, args []stri
}
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
diff --git a/lib/xsapiv1/sdks.go b/lib/xsapiv1/sdks.go
index abb5d4a..54b941b 100644
--- a/lib/xsapiv1/sdks.go
+++ b/lib/xsapiv1/sdks.go
@@ -30,6 +30,7 @@ const (
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"`