@@ -60,30 +60,45 @@ func runUpgradeCommand(args []string, skipPostInstall bool, skipPreUninstall boo
60
60
func Upgrade (inst * rpc.Instance , args []string , skipPostInstall bool , skipPreUninstall bool ) {
61
61
// if no platform was passed, upgrade allthethings
62
62
if len (args ) == 0 {
63
- targets , err := core .PlatformList (& rpc.PlatformListRequest {
64
- Instance : inst ,
65
- UpdatableOnly : true ,
63
+ platforms , err := core .PlatformSearch (& rpc.PlatformSearchRequest {
64
+ Instance : inst ,
65
+ AllVersions : false ,
66
66
})
67
67
if err != nil {
68
68
feedback .Fatal (tr ("Error retrieving core list: %v" , err ), feedback .ErrGeneric )
69
69
}
70
70
71
- if len (targets .InstalledPlatforms ) == 0 {
71
+ targets := []* rpc.Platform {}
72
+ for _ , platform := range platforms .GetSearchOutput () {
73
+ if platform .InstalledVersion == "" {
74
+ continue
75
+ }
76
+ if platform .InstalledVersion == platform .LatestVersion {
77
+ // if it's not updatable, skip it
78
+ continue
79
+ }
80
+ targets = append (targets , & rpc.Platform {
81
+ Metadata : platform .GetMetadata (),
82
+ Release : platform .GetLatestRelease (),
83
+ })
84
+ }
85
+
86
+ if len (targets ) == 0 {
72
87
feedback .Print (tr ("All the cores are already at the latest version" ))
73
88
return
74
89
}
75
90
76
- for _ , t := range targets . InstalledPlatforms {
77
- args = append (args , t .Id )
91
+ for _ , t := range targets {
92
+ args = append (args , t .GetMetadata (). Id )
78
93
}
79
94
}
80
95
81
96
warningMissingIndex := func (response * rpc.PlatformUpgradeResponse ) {
82
97
if response == nil || response .Platform == nil {
83
98
return
84
99
}
85
- if ! response .Platform .Indexed {
86
- feedback .Warning (tr ("missing package index for %s, future updates cannot be guaranteed" , response .Platform .Id ))
100
+ if ! response .Platform .GetMetadata (). Indexed {
101
+ feedback .Warning (tr ("missing package index for %s, future updates cannot be guaranteed" , response .Platform .GetMetadata (). Id ))
87
102
}
88
103
}
89
104
0 commit comments