Commit c9d47b49 authored by Cristian Maglie's avatar Cristian Maglie Committed by Cristian Maglie

Fixed wrong tool selection if many packagers provides it

Fix #73
parent 22e49adc
...@@ -355,8 +355,9 @@ func (pm *PackageManager) GetAllInstalledToolsReleases() []*cores.ToolRelease { ...@@ -355,8 +355,9 @@ func (pm *PackageManager) GetAllInstalledToolsReleases() []*cores.ToolRelease {
} }
func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*cores.ToolRelease, error) { func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*cores.ToolRelease, error) {
// core := board.Properties["build.core"] pm.Log.Infof("Searching tools required for board %s", board)
// core := board.Properties["build.core"]
platform := board.PlatformRelease platform := board.PlatformRelease
// maps "PACKAGER:TOOL" => ToolRelease // maps "PACKAGER:TOOL" => ToolRelease
...@@ -368,18 +369,19 @@ func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*core ...@@ -368,18 +369,19 @@ func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*core
for _, tool := range targetPackage.Tools { for _, tool := range targetPackage.Tools {
rel := tool.GetLatestInstalled() rel := tool.GetLatestInstalled()
if rel != nil { if rel != nil {
foundTools[rel.Tool.String()] = rel foundTools[rel.Tool.Name] = rel
} }
} }
} }
// replace the default tools above with the specific required by the current platform // replace the default tools above with the specific required by the current platform
for _, toolDep := range platform.Dependencies { for _, toolDep := range platform.Dependencies {
pm.Log.WithField("tool", toolDep).Infof("Required tool")
tool := pm.FindToolDependency(toolDep) tool := pm.FindToolDependency(toolDep)
if tool == nil { if tool == nil {
return nil, fmt.Errorf("tool release not found: %s", toolDep) return nil, fmt.Errorf("tool release not found: %s", toolDep)
} }
foundTools[tool.Tool.String()] = tool foundTools[tool.Tool.Name] = tool
} }
requiredTools := []*cores.ToolRelease{} requiredTools := []*cores.ToolRelease{}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment