@@ -39,7 +39,7 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse
39
39
res := []* cores.Platform {}
40
40
if isUsb , _ := regexp .MatchString ("[0-9a-f]{4}:[0-9a-f]{4}" , req .SearchArgs ); isUsb {
41
41
vid , pid := req .SearchArgs [:4 ], req .SearchArgs [5 :]
42
- res = pme .FindPlatformReleaseProvidingBoardsWithVidPid (vid , pid , req . AllVersions )
42
+ res = pme .FindPlatformReleaseProvidingBoardsWithVidPid (vid , pid )
43
43
} else {
44
44
searchArgs := utils .SearchTermsFromQueryString (req .SearchArgs )
45
45
for _ , targetPackage := range pme .GetPackages () {
@@ -53,14 +53,8 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse
53
53
continue
54
54
}
55
55
56
- // In case we ask for all versions we also show incompatible ones
57
- var latestRelease * cores.PlatformRelease
58
- if req .AllVersions {
59
- latestRelease = platform .GetLatestRelease ()
60
- } else {
61
- latestRelease = platform .GetLatestCompatibleRelease ()
62
- }
63
56
// Discard platforms with no releases
57
+ latestRelease := platform .GetLatestRelease ()
64
58
if latestRelease == nil || latestRelease .Name == "" {
65
59
continue
66
60
}
@@ -94,24 +88,20 @@ func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse
94
88
}
95
89
if installed := pme .GetInstalledPlatformRelease (platform ); installed != nil {
96
90
rpcPlatformSummary .InstalledVersion = installed .Version .String ()
97
- rpcPlatformSummary .Releases [installed .Version .String ()] = commands .PlatformReleaseToRPC (installed )
98
91
}
99
92
if latestCompatible := platform .GetLatestCompatibleRelease (); latestCompatible != nil {
100
93
rpcPlatformSummary .LatestVersion = latestCompatible .Version .String ()
101
- rpcPlatformSummary .Releases [latestCompatible .Version .String ()] = commands .PlatformReleaseToRPC (latestCompatible )
102
94
}
103
- if req .AllVersions {
104
- for _ , platformRelease := range platform .GetAllReleases () {
105
- rpcPlatformRelease := commands .PlatformReleaseToRPC (platformRelease )
106
- rpcPlatformSummary .Releases [rpcPlatformRelease .Version ] = rpcPlatformRelease
107
- }
95
+ for _ , platformRelease := range platform .GetAllReleases () {
96
+ rpcPlatformRelease := commands .PlatformReleaseToRPC (platformRelease )
97
+ rpcPlatformSummary .Releases [rpcPlatformRelease .Version ] = rpcPlatformRelease
108
98
}
109
99
out = append (out , rpcPlatformSummary )
110
100
}
111
101
112
102
// Sort result alphabetically and put deprecated platforms at the bottom
113
103
sort .Slice (out , func (i , j int ) bool {
114
- return strings .ToLower (out [i ].GetLatestRelease ().GetName ()) < strings .ToLower (out [j ].GetLatestRelease ().GetName ())
104
+ return strings .ToLower (out [i ].GetMetadata ().GetId ()) < strings .ToLower (out [j ].GetMetadata ().GetId ())
115
105
})
116
106
sort .SliceStable (out , func (i , j int ) bool {
117
107
return ! out [i ].GetMetadata ().Deprecated && out [j ].GetMetadata ().Deprecated
0 commit comments