Skip to content

Commit

Permalink
modify the PlatformUpgrade func to allow only upgrade to compatible p…
Browse files Browse the repository at this point in the history
…latform version
  • Loading branch information
alessio-perugini committed Aug 24, 2023
1 parent 7b421a1 commit d0629b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arduino/cores/packagemanager/install_uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (pme *Explorer) DownloadAndInstallPlatformUpgrades(
if installed == nil {
return nil, &arduino.PlatformNotFoundError{Platform: platformRef.String()}
}
latest := platform.GetLatestRelease()
latest := platform.GetLatestCompatibleRelease()
if !latest.Version.GreaterThan(installed.Version) {
return installed, &arduino.PlatformAlreadyAtTheLatestVersionError{Platform: platformRef.String()}
}
Expand Down
3 changes: 3 additions & 0 deletions commands/core/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ func PlatformUpgrade(ctx context.Context, req *rpc.PlatformUpgradeRequest, downl
platformRelease, err := upgrade()
if platformRelease != nil {
rpcPlatform = commands.PlatformReleaseToRPC(platformRelease)
// An upgrade is performed only if a compatible version exists. In case of success or already at the latest
// compatible version, the `LatestCompatible` field will be always equal to `Latest` one.
rpcPlatform.LatestCompatible = rpcPlatform.Latest
}
if err != nil {
return &rpc.PlatformUpgradeResponse{Platform: rpcPlatform}, err
Expand Down

0 comments on commit d0629b2

Please sign in to comment.