change(esptool): Upgrade esptool to release v5.0.0 (#11563)
This commit is contained in:
parent
1426927c83
commit
ccc0a69ef8
3 changed files with 31 additions and 160 deletions
129
.github/scripts/package_esptool.sh
vendored
129
.github/scripts/package_esptool.sh
vendored
|
|
@ -1,129 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Check version argument
|
||||
if [[ $# -ne 3 ]]; then
|
||||
echo "Usage: $0 <version> <base_folder> <json_path>"
|
||||
echo "Example: $0 5.0.dev1 /tmp/esptool /tmp/esptool-5.0.dev1.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$1
|
||||
BASE_FOLDER=$2
|
||||
JSON_PATH=$3
|
||||
|
||||
export COPYFILE_DISABLE=1
|
||||
|
||||
shopt -s nullglob # So for loop doesn't run if no matches
|
||||
|
||||
# Function to update JSON for a given host
|
||||
function update_json_for_host {
|
||||
local host=$1
|
||||
local archive=$2
|
||||
|
||||
# Extract the old url from the JSON for this host, then replace only the filename
|
||||
old_url=$(jq -r --arg host "$host" '
|
||||
.packages[].tools[] | select(.name == "esptool_py") | .systems[] | select(.host == $host) | .url // empty
|
||||
' "$tmp_json")
|
||||
if [[ -n "$old_url" ]]; then
|
||||
base_url="${old_url%/*}"
|
||||
url="$base_url/$archive"
|
||||
else
|
||||
echo "No old url found for $host"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
archiveFileName="$archive"
|
||||
checksum="SHA-256:$(shasum -a 256 "$archive" | awk '{print $1}')"
|
||||
size=$(stat -f%z "$archive")
|
||||
|
||||
# Use jq to update the JSON
|
||||
jq --arg host "$host" \
|
||||
--arg url "$url" \
|
||||
--arg archiveFileName "$archiveFileName" \
|
||||
--arg checksum "$checksum" \
|
||||
--arg size "$size" \
|
||||
'
|
||||
.packages[].tools[]
|
||||
|= if .name == "esptool_py" then
|
||||
.systems = (
|
||||
((.systems // []) | map(select(.host != $host))) + [{
|
||||
host: $host,
|
||||
url: $url,
|
||||
archiveFileName: $archiveFileName,
|
||||
checksum: $checksum,
|
||||
size: $size
|
||||
}]
|
||||
)
|
||||
else
|
||||
.
|
||||
end
|
||||
' "$tmp_json" > "$tmp_json.new" && mv "$tmp_json.new" "$tmp_json"
|
||||
}
|
||||
|
||||
cd "$BASE_FOLDER"
|
||||
|
||||
# Delete all archives before starting
|
||||
rm -f esptool-*.tar.gz esptool-*.zip
|
||||
|
||||
for dir in esptool-*; do
|
||||
# Check if directory exists and is a directory
|
||||
if [[ ! -d "$dir" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
base="${dir#esptool-}"
|
||||
|
||||
# Add 'linux-' prefix if base doesn't contain linux/macos/win64
|
||||
if [[ "$base" != *linux* && "$base" != *macos* && "$base" != *win64* ]]; then
|
||||
base="linux-${base}"
|
||||
fi
|
||||
|
||||
if [[ "$dir" == esptool-win* ]]; then
|
||||
# Windows zip archive
|
||||
zipfile="esptool-v${VERSION}-${base}.zip"
|
||||
echo "Creating $zipfile from $dir ..."
|
||||
zip -r "$zipfile" "$dir"
|
||||
else
|
||||
# Non-Windows: set permissions and tar.gz archive
|
||||
tarfile="esptool-v${VERSION}-${base}.tar.gz"
|
||||
echo "Setting permissions and creating $tarfile from $dir ..."
|
||||
chmod -R u=rwx,g=rx,o=rx "$dir"
|
||||
tar -cvzf "$tarfile" "$dir"
|
||||
fi
|
||||
done
|
||||
|
||||
# After the for loop, update the JSON for each archive
|
||||
# Create a temporary JSON file to accumulate changes
|
||||
tmp_json="${JSON_PATH}.tmp"
|
||||
cp "$JSON_PATH" "$tmp_json"
|
||||
|
||||
for archive in esptool-v"${VERSION}"-*.tar.gz esptool-v"${VERSION}"-*.zip; do
|
||||
[ -f "$archive" ] || continue
|
||||
|
||||
echo "Updating JSON for $archive"
|
||||
|
||||
# Determine host from archive name
|
||||
case "$archive" in
|
||||
*linux-amd64*) host="x86_64-pc-linux-gnu" ;;
|
||||
*linux-armv7*) host="arm-linux-gnueabihf" ;;
|
||||
*linux-aarch64*) host="aarch64-linux-gnu" ;;
|
||||
*macos-amd64*) host="x86_64-apple-darwin" ;;
|
||||
*macos-arm64*) host="arm64-apple-darwin" ;;
|
||||
*win64*) hosts=("x86_64-mingw32" "i686-mingw32") ;;
|
||||
*) echo "Unknown host for $archive"; continue ;;
|
||||
esac
|
||||
|
||||
# For win64, loop over both hosts; otherwise, use a single host
|
||||
if [[ "$archive" == *win64* ]]; then
|
||||
for host in "${hosts[@]}"; do
|
||||
update_json_for_host "$host" "$archive"
|
||||
done
|
||||
else
|
||||
update_json_for_host "$host" "$archive"
|
||||
fi
|
||||
done
|
||||
|
||||
# After all archives are processed, move the temporary JSON to the final file
|
||||
mv "$tmp_json" "$JSON_PATH"
|
||||
2
.github/scripts/update_esptool.py
vendored
2
.github/scripts/update_esptool.py
vendored
|
|
@ -186,7 +186,7 @@ def update_json_from_release(tmp_json_path, version, release_info):
|
|||
continue
|
||||
|
||||
asset_url = asset.get("browser_download_url")
|
||||
asset_checksum = asset.get("digest")
|
||||
asset_checksum = asset.get("digest").replace("sha256:", "SHA-256:")
|
||||
asset_size = asset.get("size")
|
||||
if asset_checksum is None:
|
||||
asset_checksum = ""
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@
|
|||
{
|
||||
"packager": "esp32",
|
||||
"name": "esptool_py",
|
||||
"version": "5.0.dev1"
|
||||
"version": "5.0.0"
|
||||
},
|
||||
{
|
||||
"packager": "esp32",
|
||||
|
|
@ -469,56 +469,56 @@
|
|||
},
|
||||
{
|
||||
"name": "esptool_py",
|
||||
"version": "5.0.dev1",
|
||||
"version": "5.0.0",
|
||||
"systems": [
|
||||
{
|
||||
"host": "aarch64-linux-gnu",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-linux-aarch64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.dev1-linux-aarch64.tar.gz",
|
||||
"checksum": "SHA-256:bfafa7a7723ebbabfd8b6e3ca5ae00bfead0331de923754aeddb43b2c116a078",
|
||||
"size": "58241736"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-linux-aarch64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.0-linux-aarch64.tar.gz",
|
||||
"checksum": "SHA-256:2bf239f3ed76141a957cadb205b94414ec6da9ace4e85f285e247d20a92b83e3",
|
||||
"size": "58231895"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-pc-linux-gnu",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-linux-amd64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.dev1-linux-amd64.tar.gz",
|
||||
"checksum": "SHA-256:acd0486e96586b99d053a1479acbbbfcae8667227c831cdc53a171f9ccfa27ee",
|
||||
"size": "100740042"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-linux-amd64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.0-linux-amd64.tar.gz",
|
||||
"checksum": "SHA-256:3b3835d266ac61f3242758f2fe34e3b33dbe6ee4b5acde005da793356f9f7043",
|
||||
"size": "100783748"
|
||||
},
|
||||
{
|
||||
"host": "arm-linux-gnueabihf",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-linux-armv7.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.dev1-linux-armv7.tar.gz",
|
||||
"checksum": "SHA-256:ea77a38681506761bbb7b0b39c130811ed565667b67ebbdb4d6dcc6cb6e07368",
|
||||
"size": "53451939"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-linux-armv7.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.0-linux-armv7.tar.gz",
|
||||
"checksum": "SHA-256:e55cd321abecfcf27f72a2bff5d5e19a5365fd400de66d71c5e7218e77556315",
|
||||
"size": "53461760"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-apple-darwin",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-macos-amd64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.dev1-macos-amd64.tar.gz",
|
||||
"checksum": "SHA-256:900a8e90731208bee96647e0e207a43612b9452c2120c4fdc0ff4c6be226257b",
|
||||
"size": "59631998"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-macos-amd64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.0-macos-amd64.tar.gz",
|
||||
"checksum": "SHA-256:424da2bdf0435257ad81bcb7eae6fd8dd7f675ce5b2ee60032f4ecec4d6a5d45",
|
||||
"size": "59629533"
|
||||
},
|
||||
{
|
||||
"host": "arm64-apple-darwin",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-macos-arm64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.dev1-macos-arm64.tar.gz",
|
||||
"checksum": "SHA-256:3653f4de73cb4fc6a25351eaf663708e91c65ae3265d75bd54ca4315a4350bb4",
|
||||
"size": "56349992"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-macos-arm64.tar.gz",
|
||||
"archiveFileName": "esptool-v5.0.0-macos-arm64.tar.gz",
|
||||
"checksum": "SHA-256:b91dfe1da7b0041376683dec10a91dfb266fbda2fb86ed87c4a034ff7182ee56",
|
||||
"size": "56343104"
|
||||
},
|
||||
{
|
||||
"host": "x86_64-mingw32",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-win64.zip",
|
||||
"archiveFileName": "esptool-v5.0.dev1-win64.zip",
|
||||
"checksum": "SHA-256:1e8fd89645daf94f2d4406ec73c9004e617ea921079515f9fd749205eece4d6d",
|
||||
"size": "59102658"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-windows-amd64.zip",
|
||||
"archiveFileName": "esptool-v5.0.0-windows-amd64.zip",
|
||||
"checksum": "SHA-256:2294107f66db6f09b886b337728a981173c9e7eab45a030928a8a5a1370611ca",
|
||||
"size": "59105322"
|
||||
},
|
||||
{
|
||||
"host": "i686-mingw32",
|
||||
"url": "https://github.com/espressif/arduino-esp32/releases/download/3.2.0/esptool-v5.0.dev1-win64.zip",
|
||||
"archiveFileName": "esptool-v5.0.dev1-win64.zip",
|
||||
"checksum": "SHA-256:1e8fd89645daf94f2d4406ec73c9004e617ea921079515f9fd749205eece4d6d",
|
||||
"size": "59102658"
|
||||
"url": "https://github.com/espressif/esptool/releases/download/v5.0.0/esptool-v5.0.0-windows-amd64.zip",
|
||||
"archiveFileName": "esptool-v5.0.0-windows-amd64.zip",
|
||||
"checksum": "SHA-256:2294107f66db6f09b886b337728a981173c9e7eab45a030928a8a5a1370611ca",
|
||||
"size": "59105322"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue