Skip to content

Commit 0b86c2e

Browse files
cli: core upgrade handles compatible version
1 parent e6290c5 commit 0b86c2e

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

internal/cli/core/upgrade.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ func Upgrade(inst *rpc.Instance, args []string, skipPostInstall bool, skipPreUni
7373
if platform.InstalledVersion == "" {
7474
continue
7575
}
76-
if platform.InstalledVersion == platform.LatestVersion {
76+
if platform.InstalledVersion == platform.LatestCompatibleVersion {
7777
// if it's not updatable, skip it
7878
continue
7979
}
8080
targets = append(targets, &rpc.Platform{
8181
Metadata: platform.GetMetadata(),
82-
Release: platform.GetLatestRelease(),
82+
Release: platform.GetLatestCompatibleRelease(),
8383
})
8484
}
8585

rpc/cc/arduino/cli/commands/v1/common.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,15 @@ func (s *PlatformSummary) GetLatestRelease() *PlatformRelease {
7878
return s.Releases[s.LatestVersion]
7979
}
8080

81+
// GetLatestCompatibleRelease returns the latest compatible release in this PlatformSummary,
82+
// or nil if not available.
83+
func (s *PlatformSummary) GetLatestCompatibleRelease() *PlatformRelease {
84+
if s.LatestCompatibleVersion == "" {
85+
return nil
86+
}
87+
return s.Releases[s.LatestCompatibleVersion]
88+
}
89+
8190
// GetInstalledRelease returns the latest release in this PlatformSummary,
8291
// or nil if not available.
8392
func (s *PlatformSummary) GetInstalledRelease() *PlatformRelease {

0 commit comments

Comments
 (0)