Skip to content

Commit e4d45a8

Browse files
committed
fix
1 parent e127049 commit e4d45a8

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/push-to-arduino.sh

+8-5
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ if [ $LIBS_HAS_ASSET == "0" ] && [ $AR_HAS_COMMIT == "0" ]; then
4646
fi
4747
fi
4848

49+
# Calculate the local file checksum and size
4950
local_checksum=$(sha256sum "dist/$LIBS_ZIP_FILENAME" | awk '{print $1}')
50-
size=$(stat -c%s "dist/$LIBS_ZIP_FILENAME")
51+
local_size=$(stat -c%s "dist/$LIBS_ZIP_FILENAME")
5152
IDF_LIBS_DL_URL="https://github.com/$AR_LIBS_REPO/releases/download/$LIBS_RELEASE_TAG/$LIBS_ZIP_FILENAME"
5253

5354
# Download the file
@@ -65,8 +66,12 @@ if [ $LIBS_HAS_ASSET == "0" ] && [ $AR_HAS_COMMIT == "0" ]; then
6566
fi
6667
fi
6768

68-
# Calculate the SHA-256 sum
69+
# Calculate the remote file checksum and size
6970
remote_checksum=$(sha256sum "$remote_file" | awk '{print $1}')
71+
remote_size=$(stat -c%s "$remote_file")
72+
73+
echo "Local: $local_size bytes, $local_checksum"
74+
echo "Remote: $remote_size bytes, $remote_checksum"
7075

7176
# Check if the checksums match
7277
if [ "$local_checksum" != "$remote_checksum" ]; then
@@ -82,8 +87,6 @@ if [ $LIBS_HAS_ASSET == "0" ] && [ $AR_HAS_COMMIT == "0" ]; then
8287
remote_checksum=$(sha256sum "$remote_file" | awk '{print $1}')
8388
if [ "$local_checksum" != "$remote_checksum" ]; then
8489
echo "Checksum mismatch for downloaded file after retry"
85-
echo "Local: $local_checksum"
86-
echo "Remote: $remote_checksum"
8790
echo "Deleting asset and exiting..."
8891
if [ `github_release_asset_delete "$AR_LIBS_REPO" "$LIBS_ASSET_ID"` == "0" ]; then
8992
echo "ERROR: Failed to delete asset '$LIBS_ZIP_FILENAME'"
@@ -104,7 +107,7 @@ if [ $LIBS_HAS_ASSET == "0" ] && [ $AR_HAS_COMMIT == "0" ]; then
104107
echo "SHA-256: $sha256sum"
105108
echo "JSON: $AR_OUT/package_esp32_index.template.json"
106109
cd "$AR_ROOT"
107-
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$LIBS_ZIP_FILENAME" -s "$size" -c "$sha256sum"
110+
python3 tools/add_sdk_json.py -j "$AR_OUT/package_esp32_index.template.json" -n "esp32-arduino-libs" -v "$LIBS_VERSION" -u "$IDF_LIBS_DL_URL" -f "$LIBS_ZIP_FILENAME" -s "$size" -c "$remote_checksum"
108111
if [ $? -ne 0 ]; then exit 1; fi
109112

110113
if [ `github_release_asset_upload "$AR_LIBS_REPO" "$LIBS_RELEASE_ID" "$LIBS_JSON_FILENAME" "$AR_OUT/package_esp32_index.template.json"` == ""]; then

0 commit comments

Comments
 (0)