Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8430ccd

Browse filesBrowse files
Remove query parameter where it is not needed
1 parent 271d241 commit 8430ccd
Copy full SHA for 8430ccd

File tree

Expand file treeCollapse file tree

7 files changed

+16
-21
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+16
-21
lines changed

‎commands/daemon/daemon.go

Copy file name to clipboardExpand all lines: commands/daemon/daemon.go
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ func (s *ArduinoCoreServerImpl) LibraryDownload(req *rpc.LibraryDownloadRequest,
343343
resp, err := lib.LibraryDownload(
344344
stream.Context(), req,
345345
func(p *rpc.DownloadProgress) { stream.Send(&rpc.LibraryDownloadResponse{Progress: p}) },
346-
"",
347346
)
348347
if err != nil {
349348
return convertErrorToRPCStatus(err)
@@ -357,7 +356,6 @@ func (s *ArduinoCoreServerImpl) LibraryInstall(req *rpc.LibraryInstallRequest, s
357356
stream.Context(), req,
358357
func(p *rpc.DownloadProgress) { stream.Send(&rpc.LibraryInstallResponse{Progress: p}) },
359358
func(p *rpc.TaskProgress) { stream.Send(&rpc.LibraryInstallResponse{TaskProgress: p}) },
360-
"",
361359
)
362360
if err != nil {
363361
return convertErrorToRPCStatus(err)

‎commands/lib/download.go

Copy file name to clipboardExpand all lines: commands/lib/download.go
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var tr = i18n.Tr
3333
// LibraryDownload executes the download of the library.
3434
// A DownloadProgressCB callback function must be passed to monitor download progress.
3535
// queryParameter is passed for analysis purposes.
36-
func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downloadCB rpc.DownloadProgressCB, queryParameter string) (*rpc.LibraryDownloadResponse, error) {
36+
func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downloadCB rpc.DownloadProgressCB) (*rpc.LibraryDownloadResponse, error) {
3737
logrus.Info("Executing `arduino-cli lib download`")
3838

3939
lm := commands.GetLibraryManager(req)
@@ -48,7 +48,7 @@ func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downl
4848
return nil, err
4949
}
5050

51-
if err := downloadLibrary(lm, lib, downloadCB, func(*rpc.TaskProgress) {}, queryParameter); err != nil {
51+
if err := downloadLibrary(lm, lib, downloadCB, func(*rpc.TaskProgress) {}, "download"); err != nil {
5252
return nil, err
5353
}
5454

‎commands/lib/install.go

Copy file name to clipboardExpand all lines: commands/lib/install.go
+11-13Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import (
3232

3333
// LibraryInstall resolves the library dependencies, then downloads and installs the libraries into the install location.
3434
// queryParameter is passed for analysis purposes and forwarded to the called functions. It is set to "depends" when a dependency is installed
35-
func LibraryInstall(ctx context.Context, req *rpc.LibraryInstallRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB, queryParameter string) error {
35+
func LibraryInstall(ctx context.Context, req *rpc.LibraryInstallRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error {
3636
lm := commands.GetLibraryManager(req)
3737
if lm == nil {
3838
return &arduino.InvalidInstanceError{}
@@ -98,21 +98,19 @@ func LibraryInstall(ctx context.Context, req *rpc.LibraryInstallRequest, downloa
9898

9999
for libRelease, installTask := range libReleasesToInstall {
100100
// Checks if libRelease is the requested library and not a dependency
101+
downloadReason := "depends"
101102
if libRelease.GetName() == req.Name {
102-
if err := downloadLibrary(lm, libRelease, downloadCB, taskCB, queryParameter); err != nil {
103-
return err
104-
}
105-
if err := installLibrary(lm, libRelease, installTask, taskCB); err != nil {
106-
return err
107-
}
108-
} else {
109-
if err := downloadLibrary(lm, libRelease, downloadCB, taskCB, "depends"); err != nil {
110-
return err
111-
}
112-
if err := installLibrary(lm, libRelease, installTask, taskCB); err != nil {
113-
return err
103+
downloadReason = "install"
104+
if installTask.ReplacedLib != nil {
105+
downloadReason = "upgrade"
114106
}
115107
}
108+
if err := downloadLibrary(lm, libRelease, downloadCB, taskCB, downloadReason); err != nil {
109+
return err
110+
}
111+
if err := installLibrary(lm, libRelease, installTask, taskCB); err != nil {
112+
return err
113+
}
116114
}
117115

118116
if err := commands.Init(&rpc.InitRequest{Instance: req.Instance}, nil); err != nil {

‎commands/lib/upgrade.go

Copy file name to clipboardExpand all lines: commands/lib/upgrade.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func upgrade(instance *rpc.Instance, libs []*installedLib, downloadCB rpc.Downlo
7373
NoDeps: false,
7474
NoOverwrite: false,
7575
}
76-
err := LibraryInstall(context.Background(), libInstallReq, downloadCB, taskCB, "upgrade")
76+
err := LibraryInstall(context.Background(), libInstallReq, downloadCB, taskCB)
7777
if err != nil {
7878
return err
7979
}

‎internal/cli/lib/download.go

Copy file name to clipboardExpand all lines: internal/cli/lib/download.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func runDownloadCommand(cmd *cobra.Command, args []string) {
6060
Name: library.Name,
6161
Version: library.Version,
6262
}
63-
_, err := lib.LibraryDownload(context.Background(), libraryDownloadRequest, feedback.ProgressBar(), "download")
63+
_, err := lib.LibraryDownload(context.Background(), libraryDownloadRequest, feedback.ProgressBar())
6464
if err != nil {
6565
feedback.Fatal(tr("Error downloading %[1]s: %[2]v", library, err), feedback.ErrNetwork)
6666
}

‎internal/cli/lib/install.go

Copy file name to clipboardExpand all lines: internal/cli/lib/install.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
130130
NoDeps: noDeps,
131131
NoOverwrite: noOverwrite,
132132
}
133-
err := lib.LibraryInstall(context.Background(), libraryInstallRequest, feedback.ProgressBar(), feedback.TaskProgress(), "install")
133+
err := lib.LibraryInstall(context.Background(), libraryInstallRequest, feedback.ProgressBar(), feedback.TaskProgress())
134134
if err != nil {
135135
feedback.Fatal(tr("Error installing %s: %v", libRef.Name, err), feedback.ErrGeneric)
136136
}

‎internal/integrationtest/lib/lib_test.go

Copy file name to clipboardExpand all lines: internal/integrationtest/lib/lib_test.go
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,5 +1518,4 @@ func TestLibQueryParameters(t *testing.T) {
15181518
require.NoError(t, err)
15191519
require.Contains(t, string(stdout),
15201520
"Starting download \x1b[36murl\x1b[0m=\"https://downloads.arduino.cc/libraries/github.com/arduino-libraries/WiFi101-0.16.1.zip?query=download\"\n")
1521-
15221521
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.