@@ -17,6 +17,7 @@ package packagemanager
1717
1818import (
1919 "bytes"
20+ "context"
2021 "encoding/json"
2122 "errors"
2223 "fmt"
@@ -33,6 +34,7 @@ import (
3334// This method takes care of downloading missing archives, upgrading platforms and tools, and
3435// removing the previously installed platform/tools that are no longer needed after the upgrade.
3536func (pme * Explorer ) DownloadAndInstallPlatformUpgrades (
37+ ctx context.Context ,
3638 platformRef * PlatformReference ,
3739 downloadCB rpc.DownloadProgressCB ,
3840 taskCB rpc.TaskProgressCB ,
@@ -62,7 +64,7 @@ func (pme *Explorer) DownloadAndInstallPlatformUpgrades(
6264 if err != nil {
6365 return nil , & cmderrors.PlatformNotFoundError {Platform : platformRef .String ()}
6466 }
65- if err := pme .DownloadAndInstallPlatformAndTools (platformRelease , tools , downloadCB , taskCB , skipPostInstall , skipPreUninstall ); err != nil {
67+ if err := pme .DownloadAndInstallPlatformAndTools (ctx , platformRelease , tools , downloadCB , taskCB , skipPostInstall , skipPreUninstall ); err != nil {
6668 return nil , err
6769 }
6870
@@ -73,6 +75,7 @@ func (pme *Explorer) DownloadAndInstallPlatformUpgrades(
7375// This method takes care of downloading missing archives, installing/upgrading platforms and tools, and
7476// removing the previously installed platform/tools that are no longer needed after the upgrade.
7577func (pme * Explorer ) DownloadAndInstallPlatformAndTools (
78+ ctx context.Context ,
7679 platformRelease * cores.PlatformRelease , requiredTools []* cores.ToolRelease ,
7780 downloadCB rpc.DownloadProgressCB , taskCB rpc.TaskProgressCB ,
7881 skipPostInstall bool , skipPreUninstall bool ) error {
@@ -92,11 +95,11 @@ func (pme *Explorer) DownloadAndInstallPlatformAndTools(
9295 // Package download
9396 taskCB (& rpc.TaskProgress {Name : tr ("Downloading packages" )})
9497 for _ , tool := range toolsToInstall {
95- if err := pme .DownloadToolRelease (tool , downloadCB ); err != nil {
98+ if err := pme .DownloadToolRelease (ctx , tool , downloadCB ); err != nil {
9699 return err
97100 }
98101 }
99- if err := pme .DownloadPlatformRelease (platformRelease , downloadCB ); err != nil {
102+ if err := pme .DownloadPlatformRelease (ctx , platformRelease , downloadCB ); err != nil {
100103 return err
101104 }
102105 taskCB (& rpc.TaskProgress {Completed : true })
0 commit comments