summaryrefslogtreecommitdiffstatshomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ci.sh2
-rw-r--r--tools/mpremote/mpremote/mip.py16
2 files changed, 15 insertions, 3 deletions
diff --git a/tools/ci.sh b/tools/ci.sh
index 6f8d1cb80c..a4bd43567c 100755
--- a/tools/ci.sh
+++ b/tools/ci.sh
@@ -209,7 +209,7 @@ function ci_esp32_build_s3_c3 {
function ci_esp8266_setup {
sudo pip3 install pyserial esptool==3.3.1 pyelftools ar
- wget https://github.com/jepler/esp-open-sdk/releases/download/2018-06-10/xtensa-lx106-elf-standalone.tar.gz
+ wget https://micropython.org/resources/xtensa-lx106-elf-standalone.tar.gz
zcat xtensa-lx106-elf-standalone.tar.gz | tar x
# Remove this esptool.py so pip version is used instead
rm xtensa-lx106-elf/bin/esptool.py
diff --git a/tools/mpremote/mpremote/mip.py b/tools/mpremote/mpremote/mip.py
index 26ae8bec5e..fa7974053f 100644
--- a/tools/mpremote/mpremote/mip.py
+++ b/tools/mpremote/mpremote/mip.py
@@ -34,6 +34,15 @@ def _ensure_path_exists(transport, path):
prefix += "/"
+# Check if the specified path exists and matches the hash.
+def _check_exists(transport, path, short_hash):
+ try:
+ remote_hash = transport.fs_hashfile(path, "sha256")
+ except FileNotFoundError:
+ return False
+ return remote_hash.hex()[: len(short_hash)] == short_hash
+
+
def _rewrite_url(url, branch=None):
if not branch:
branch = "HEAD"
@@ -115,8 +124,11 @@ def _install_json(transport, package_json_url, index, target, version, mpy):
raise CommandError(f"Invalid url for package: {package_json_url}")
for target_path, short_hash in package_json.get("hashes", ()):
fs_target_path = target + "/" + target_path
- file_url = f"{index}/file/{short_hash[:2]}/{short_hash}"
- _download_file(transport, file_url, fs_target_path)
+ if _check_exists(transport, fs_target_path, short_hash):
+ print("Exists:", fs_target_path)
+ else:
+ file_url = f"{index}/file/{short_hash[:2]}/{short_hash}"
+ _download_file(transport, file_url, fs_target_path)
for target_path, url in package_json.get("urls", ()):
fs_target_path = target + "/" + target_path
if base_url and not url.startswith(allowed_mip_url_prefixes):