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

Sign up
Appearance settings

Commit b1e25f3

Browse files
committed
Allow .tar.bz2 package index URL
1 parent 1583929 commit b1e25f3

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

‎arduino/cores/packagemanager/package_manager.go‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ func (pm *PackageManager) ResolveFQBN(fqbn *cores.FQBN) (
237237

238238
// LoadPackageIndex loads a package index by looking up the local cached file from the specified URL
239239
func (pm *PackageManager) LoadPackageIndex(URL *url.URL) error {
240-
indexPath := pm.IndexDir.Join(path.Base(URL.Path))
240+
indexFileName := path.Base(URL.Path)
241+
if strings.HasSuffix(indexFileName, ".tar.bz2") {
242+
indexFileName = strings.TrimSuffix(indexFileName, ".tar.bz2") + ".json"
243+
}
244+
indexPath := pm.IndexDir.Join(indexFileName)
241245
index, err := packageindex.LoadIndex(indexPath)
242246
if err != nil {
243247
return fmt.Errorf(tr("loading json index file %[1]s: %[2]s"), indexPath, err)

‎cli/globals/globals.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ var (
2626
// VersionInfo contains all info injected during build
2727
VersionInfo = version.NewInfo(filepath.Base(os.Args[0]))
2828
// DefaultIndexURL is the default index url
29-
DefaultIndexURL = "https://downloads.arduino.cc/packages/package_index.json"
29+
DefaultIndexURL = "https://downloads.arduino.cc/packages/package_index.tar.bz2"
3030
)

‎commands/instances.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rp
434434
indexResource := resources.IndexResource{
435435
URL: URL,
436436
}
437-
if strings.HasSuffix(URL.Host, "arduino.cc") {
437+
if strings.HasSuffix(URL.Host, "arduino.cc") &&strings.HasSuffix(URL.Path, ".json") {
438438
indexResource.SignatureURL, _ = url.Parse(u) // should not fail because we already parsed it
439439
indexResource.SignatureURL.Path += ".sig"
440440
}

‎test/test_core.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def test_core_install_without_updateindex(run_command):
201201
# Download samd core pinned to 1.8.6
202202
result = run_command(["core", "install", "arduino:samd@1.8.6"])
203203
assert result.ok
204-
assert "Downloading index: package_index.json downloaded" in result.stdout
204+
assert "Downloading index: package_index.tar.bz2 downloaded" in result.stdout
205205

206206

207207
@pytest.mark.skipif(

‎test/test_update.py‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ def test_update(run_command):
2121
assert res.ok
2222
lines = [l.strip() for l in res.stdout.splitlines()]
2323

24-
assert "Downloading index: package_index.json downloaded" in lines
25-
assert "Downloading index signature: package_index.json.sig downloaded" in lines
24+
assert "Downloading index: package_index.tar.bz2 downloaded" in lines
2625
assert "Downloading index: library_index.json.gz downloaded" in lines
2726
assert "Downloading index signature: library_index.json.sig downloaded" in lines
2827

@@ -45,8 +44,7 @@ def test_update_showing_outdated(run_command):
4544
assert result.ok
4645
lines = [l.strip() for l in result.stdout.splitlines()]
4746

48-
assert "Downloading index: package_index.json downloaded" in lines
49-
assert "Downloading index signature: package_index.json.sig downloaded" in lines
47+
assert "Downloading index: package_index.tar.bz2 downloaded" in lines
5048
assert "Downloading index: library_index.json.gz downloaded" in lines
5149
assert "Downloading index signature: library_index.json.sig downloaded" in lines
5250
assert lines[-5].startswith("Arduino AVR Boards")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /