Unverified Commit 797ed936 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Download library index as a combined archive+signature (#1908)

* Download library index as a combined archive+signature

* Fixed integration tests
parent d27ba3dd
...@@ -27,3 +27,6 @@ var LibraryIndexGZURL, _ = url.Parse("https://downloads.arduino.cc/libraries/lib ...@@ -27,3 +27,6 @@ var LibraryIndexGZURL, _ = url.Parse("https://downloads.arduino.cc/libraries/lib
// LibraryIndexSignature is the URL where to get the library index signature. // LibraryIndexSignature is the URL where to get the library index signature.
var LibraryIndexSignature, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json.sig") var LibraryIndexSignature, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json.sig")
// LibraryIndexWithSignatureArchiveURL is the URL where to get the library index.
var LibraryIndexWithSignatureArchiveURL, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.tar.bz2")
...@@ -479,8 +479,7 @@ func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequ ...@@ -479,8 +479,7 @@ func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequ
defer tmp.RemoveAll() defer tmp.RemoveAll()
indexResource := resources.IndexResource{ indexResource := resources.IndexResource{
URL: librariesmanager.LibraryIndexGZURL, URL: librariesmanager.LibraryIndexWithSignatureArchiveURL,
SignatureURL: librariesmanager.LibraryIndexSignature,
} }
if err := indexResource.Download(lm.IndexFile.Parent(), downloadCB); err != nil { if err := indexResource.Download(lm.IndexFile.Parent(), downloadCB); err != nil {
return err return err
......
...@@ -447,8 +447,7 @@ def test_update_index(run_command): ...@@ -447,8 +447,7 @@ def test_update_index(run_command):
result = run_command(["lib", "update-index"]) result = run_command(["lib", "update-index"])
assert result.ok assert result.ok
lines = [l.strip() for l in result.stdout.splitlines()] lines = [l.strip() for l in result.stdout.splitlines()]
assert "Downloading index: library_index.json.gz downloaded" in lines assert "Downloading index: library_index.tar.bz2 downloaded" in lines
assert "Downloading index signature: library_index.json.sig downloaded" in lines
def test_uninstall(run_command): def test_uninstall(run_command):
...@@ -498,8 +497,7 @@ def test_search(run_command): ...@@ -498,8 +497,7 @@ def test_search(run_command):
result = run_command(["lib", "search", "--names"]) result = run_command(["lib", "search", "--names"])
assert result.ok assert result.ok
lines = [l.strip() for l in result.stdout.strip().splitlines()] lines = [l.strip() for l in result.stdout.strip().splitlines()]
assert "Downloading index: library_index.json.gz downloaded" in lines assert "Downloading index: library_index.tar.bz2 downloaded" in lines
assert "Downloading index signature: library_index.json.sig downloaded" in lines
libs = [l[6:].strip('"') for l in lines if "Name:" in l] libs = [l[6:].strip('"') for l in lines if "Name:" in l]
expected = {"WiFi101", "WiFi101OTA", "Firebase Arduino based on WiFi101"} expected = {"WiFi101", "WiFi101OTA", "Firebase Arduino based on WiFi101"}
......
...@@ -22,8 +22,7 @@ def test_update(run_command): ...@@ -22,8 +22,7 @@ def test_update(run_command):
lines = [l.strip() for l in res.stdout.splitlines()] lines = [l.strip() for l in res.stdout.splitlines()]
assert "Downloading index: package_index.tar.bz2 downloaded" in lines assert "Downloading index: package_index.tar.bz2 downloaded" in lines
assert "Downloading index: library_index.json.gz downloaded" in lines assert "Downloading index: library_index.tar.bz2 downloaded" in lines
assert "Downloading index signature: library_index.json.sig downloaded" in lines
def test_update_showing_outdated(run_command): def test_update_showing_outdated(run_command):
...@@ -45,8 +44,7 @@ def test_update_showing_outdated(run_command): ...@@ -45,8 +44,7 @@ def test_update_showing_outdated(run_command):
lines = [l.strip() for l in result.stdout.splitlines()] lines = [l.strip() for l in result.stdout.splitlines()]
assert "Downloading index: package_index.tar.bz2 downloaded" in lines assert "Downloading index: package_index.tar.bz2 downloaded" in lines
assert "Downloading index: library_index.json.gz downloaded" in lines assert "Downloading index: library_index.tar.bz2 downloaded" in lines
assert "Downloading index signature: library_index.json.sig downloaded" in lines
assert lines[-5].startswith("Arduino AVR Boards") assert lines[-5].startswith("Arduino AVR Boards")
assert lines[-2].startswith("USBHost") assert lines[-2].startswith("USBHost")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment