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 736d161

Browse filesBrowse files
[skip-changelog] Add remediation path when tool is not available for an OS (#2092)
* Add instructions on how to contact the package manager to error message * Add TestCoreBrokenDependency to core_test.go
1 parent 5f73378 commit 736d161
Copy full SHA for 736d161

File tree

Expand file treeCollapse file tree

4 files changed

+58
-8
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+58
-8
lines changed

‎arduino/cores/packagemanager/download.go

Copy file name to clipboardExpand all lines: arduino/cores/packagemanager/download.go
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func (pme *Explorer) DownloadToolRelease(tool *cores.ToolRelease, config *downlo
125125
if resource == nil {
126126
return &arduino.FailedDownloadError{
127127
Message: tr("Error downloading tool %s", tool),
128-
Cause: errors.New(tr("no versions available for the current OS"))}
128+
Cause: errors.New(tr("no versions available for the current OS, try contacting %s", tool.Tool.Package.Email))}
129129
}
130130
return resource.Download(pme.DownloadDir, config, tool.String(), progressCB, "")
131131
}

‎arduino/cores/packagemanager/install_uninstall.go

Copy file name to clipboardExpand all lines: arduino/cores/packagemanager/install_uninstall.go
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.Task
313313

314314
toolResource := toolRelease.GetCompatibleFlavour()
315315
if toolResource == nil {
316-
return fmt.Errorf(tr("no compatible version of %s tools found for the current os"), toolRelease.Tool.Name)
316+
return fmt.Errorf(tr("no compatible version of %s tools found for the current os, try contacting %s"),
317+
toolRelease.Tool.Name, toolRelease.Tool.Package.Email)
317318
}
318319
destDir := pme.PackagesDir.Join(
319320
toolRelease.Tool.Package.Name,

‎internal/integrationtest/core/core_test.go

Copy file name to clipboardExpand all lines: internal/integrationtest/core/core_test.go
+23-5Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestCoreSearch(t *testing.T) {
8080
// show all versions
8181
out, _, err = cli.Run("core", "search", "test_core", "--all", "--format", "json", "--additional-urls="+url.String())
8282
require.NoError(t, err)
83-
requirejson.Len(t, out, 2)
83+
requirejson.Len(t, out, 3)
8484

8585
checkPlatformIsInJSONOutput := func(stdout []byte, id, version string) {
8686
jqquery := fmt.Sprintf(`[{id:"%s", latest:"%s"}]`, id, version)
@@ -150,7 +150,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
150150
// update custom index and install test core (installed cores affect `core search`)
151151
_, _, err := cli.Run("core", "update-index", "--additional-urls="+url.String())
152152
require.NoError(t, err)
153-
_, _, err = cli.Run("core", "install", "test:x86", "--additional-urls="+url.String())
153+
_, _, err = cli.Run("core", "install", "test:x86@2.0.0", "--additional-urls="+url.String())
154154
require.NoError(t, err)
155155

156156
// list all with no additional urls, ensure the test core won't show up
@@ -161,7 +161,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
161161
lines = append(lines, strings.Fields(strings.TrimSpace(v)))
162162
}
163163
// The header is printed on the first lines
164-
require.Equal(t, []string{"test:x86", "2.0.0", "test_core"}, lines[20])
164+
require.Equal(t, []string{"test:x86", "2.0.0", "test_core"}, lines[21])
165165
numPlatforms := len(lines) - 1
166166

167167
// same thing in JSON format, also check the number of platforms found is the same
@@ -178,7 +178,7 @@ func TestCoreSearchNoArgs(t *testing.T) {
178178
lines = append(lines, strings.Fields(strings.TrimSpace(v)))
179179
}
180180
// The header is printed on the first lines
181-
require.Equal(t, []string{"test:x86", "2.0.0", "test_core"}, lines[21])
181+
require.Equal(t, []string{"test:x86", "3.0.0", "test_core"}, lines[22])
182182
numPlatforms = len(lines) - 1
183183

184184
// same thing in JSON format, also check the number of platforms found is the same
@@ -725,7 +725,7 @@ func TestCoreListSortedResults(t *testing.T) {
725725
require.NoError(t, err)
726726

727727
// install some core for testing
728-
_, _, err = cli.Run("core", "install", "test:x86", "Retrokits-RK002:arm", "Package:x86", "--additional-urls="+url.String())
728+
_, _, err = cli.Run("core", "install", "test:x86@2.0.0", "Retrokits-RK002:arm", "Package:x86", "--additional-urls="+url.String())
729729
require.NoError(t, err)
730730

731731
// list all with additional url specified
@@ -1006,3 +1006,21 @@ func TestCoreInstallRunsToolPostInstallScript(t *testing.T) {
10061006
require.NoError(t, err)
10071007
require.Contains(t, string(stdout), "Skipping tool configuration.")
10081008
}
1009+
1010+
func TestCoreBrokenDependency(t *testing.T) {
1011+
env, cli := integrationtest.CreateArduinoCLIWithEnvironment(t)
1012+
defer env.CleanUp()
1013+
1014+
// Set up an http server to serve our custom index file
1015+
test_index := paths.New("..", "testdata", "test_index.json")
1016+
url := env.HTTPServeFile(8000, test_index)
1017+
1018+
// Run update-index with our test index
1019+
_, _, err := cli.Run("core", "update-index", "--additional-urls="+url.String())
1020+
require.NoError(t, err)
1021+
1022+
// Check that the download fails and the correct message is displayed
1023+
_, stderr, err := cli.Run("core", "install", "test:x86@3.0.0", "--additional-urls="+url.String())
1024+
require.Error(t, err)
1025+
require.Contains(t, string(stderr), "try contacting test@example.com")
1026+
}

‎internal/integrationtest/testdata/test_index.json

Copy file name to clipboardExpand all lines: internal/integrationtest/testdata/test_index.json
+32-1Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,40 @@
4444
"name": "Test Board"
4545
}
4646
]
47+
},
48+
{
49+
"category": "Test Category",
50+
"help": {
51+
"online": "https://github.com/Arduino/arduino-cli"
52+
},
53+
"url": "https://raw.githubusercontent.com/arduino/arduino-cli/master/internal/integrationtest/testdata/core.zip",
54+
"checksum": "SHA-256:6a338cf4d6d501176a2d352c87a8d72ac7488b8c5b82cdf2a4e2cef630391092",
55+
"name": "test_core",
56+
"version": "3.0.0",
57+
"architecture": "x86",
58+
"archiveFileName": "core.zip",
59+
"size": "486",
60+
"toolsDependencies": [
61+
{
62+
"packager": "test",
63+
"version": "1.0.6",
64+
"name": "rp2040tools"
65+
}
66+
],
67+
"boards": [
68+
{
69+
"name": "Test Board"
70+
}
71+
]
72+
}
73+
],
74+
"tools": [
75+
{
76+
"name": "rp2040tools",
77+
"version": "1.0.6",
78+
"systems": []
4779
}
4880
],
49-
"tools": [],
5081
"email": "test@example.com",
5182
"name": "test"
5283
},

0 commit comments

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