Skip to content

Commit 6f63d23

Browse files
authored
Merge branch 'master' into idf-release/v5.4
2 parents 2be81fa + 01e4d5d commit 6f63d23

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2331
-487
lines changed

.github/scripts/on-release.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,14 @@ jq_arg=".packages[0].platforms[0].version = \"$RELEASE_TAG\" | \
342342
echo "Generating $PACKAGE_JSON_DEV ..."
343343
cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV"
344344
# On MacOS the sed command won't skip the first match. Use gsed instead.
345-
sed '0,/github\.com\/espressif\//!s|github\.com/espressif/|dl.espressif.cn/github_assets/espressif/|g' "$OUTPUT_DIR/$PACKAGE_JSON_DEV" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
345+
sed '0,/github\.com\//!s|github\.com/|dl.espressif.cn/github_assets/|g' "$OUTPUT_DIR/$PACKAGE_JSON_DEV" > "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
346+
python "$SCRIPTS_DIR/release_append_cn.py" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN"
346347
if [ "$RELEASE_PRE" == "false" ]; then
347348
echo "Generating $PACKAGE_JSON_REL ..."
348349
cat "$PACKAGE_JSON_TEMPLATE" | jq "$jq_arg" > "$OUTPUT_DIR/$PACKAGE_JSON_REL"
349350
# On MacOS the sed command won't skip the first match. Use gsed instead.
350-
sed '0,/github\.com\/espressif\//!s|github\.com/espressif/|dl.espressif.cn/github_assets/espressif/|g' "$OUTPUT_DIR/$PACKAGE_JSON_REL" > "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
351+
sed '0,/github\.com\//!s|github\.com/|dl.espressif.cn/github_assets/|g' "$OUTPUT_DIR/$PACKAGE_JSON_REL" > "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
352+
python "$SCRIPTS_DIR/release_append_cn.py" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN"
351353
fi
352354

353355
# Figure out the last release or pre-release
@@ -456,14 +458,14 @@ echo "Uploading $PACKAGE_JSON_DEV ..."
456458
echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV")"
457459
echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV")"
458460
echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")"
459-
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")"
461+
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_DEV_CN" "$OUTPUT_DIR/$PACKAGE_JSON_DEV_CN")"
460462
echo
461463
if [ "$RELEASE_PRE" == "false" ]; then
462464
echo "Uploading $PACKAGE_JSON_REL ..."
463465
echo "Download URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL")"
464466
echo "Pages URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL")"
465467
echo "Download CN URL: $(git_safe_upload_asset "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")"
466-
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")"
468+
echo "Pages CN URL: $(git_safe_upload_to_pages "$PACKAGE_JSON_REL_CN" "$OUTPUT_DIR/$PACKAGE_JSON_REL_CN")"
467469
echo
468470
fi
469471

.github/scripts/package_esptool.sh

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Check version argument
6+
if [[ $# -ne 3 ]]; then
7+
echo "Usage: $0 <version> <base_folder> <json_path>"
8+
echo "Example: $0 5.0.dev1 /tmp/esptool /tmp/esptool-5.0.dev1.json"
9+
exit 1
10+
fi
11+
12+
VERSION=$1
13+
BASE_FOLDER=$2
14+
JSON_PATH=$3
15+
16+
export COPYFILE_DISABLE=1
17+
18+
shopt -s nullglob # So for loop doesn't run if no matches
19+
20+
# Function to update JSON for a given host
21+
function update_json_for_host {
22+
local host=$1
23+
local archive=$2
24+
25+
# Extract the old url from the JSON for this host, then replace only the filename
26+
old_url=$(jq -r --arg host "$host" '
27+
.packages[].tools[] | select(.name == "esptool_py") | .systems[] | select(.host == $host) | .url // empty
28+
' "$tmp_json")
29+
if [[ -n "$old_url" ]]; then
30+
base_url="${old_url%/*}"
31+
url="$base_url/$archive"
32+
else
33+
echo "No old url found for $host"
34+
exit 1
35+
fi
36+
37+
archiveFileName="$archive"
38+
checksum="SHA-256:$(shasum -a 256 "$archive" | awk '{print $1}')"
39+
size=$(stat -f%z "$archive")
40+
41+
# Use jq to update the JSON
42+
jq --arg host "$host" \
43+
--arg url "$url" \
44+
--arg archiveFileName "$archiveFileName" \
45+
--arg checksum "$checksum" \
46+
--arg size "$size" \
47+
'
48+
.packages[].tools[]
49+
|= if .name == "esptool_py" then
50+
.systems = (
51+
((.systems // []) | map(select(.host != $host))) + [{
52+
host: $host,
53+
url: $url,
54+
archiveFileName: $archiveFileName,
55+
checksum: $checksum,
56+
size: $size
57+
}]
58+
)
59+
else
60+
.
61+
end
62+
' "$tmp_json" > "$tmp_json.new" && mv "$tmp_json.new" "$tmp_json"
63+
}
64+
65+
cd "$BASE_FOLDER"
66+
67+
# Delete all archives before starting
68+
rm -f esptool-*.tar.gz esptool-*.zip
69+
70+
for dir in esptool-*; do
71+
# Check if directory exists and is a directory
72+
if [[ ! -d "$dir" ]]; then
73+
continue
74+
fi
75+
76+
base="${dir#esptool-}"
77+
78+
# Add 'linux-' prefix if base doesn't contain linux/macos/win64
79+
if [[ "$base" != *linux* && "$base" != *macos* && "$base" != *win64* ]]; then
80+
base="linux-${base}"
81+
fi
82+
83+
if [[ "$dir" == esptool-win* ]]; then
84+
# Windows zip archive
85+
zipfile="esptool-v${VERSION}-${base}.zip"
86+
echo "Creating $zipfile from $dir ..."
87+
zip -r "$zipfile" "$dir"
88+
else
89+
# Non-Windows: set permissions and tar.gz archive
90+
tarfile="esptool-v${VERSION}-${base}.tar.gz"
91+
echo "Setting permissions and creating $tarfile from $dir ..."
92+
chmod -R u=rwx,g=rx,o=rx "$dir"
93+
tar -cvzf "$tarfile" "$dir"
94+
fi
95+
done
96+
97+
# After the for loop, update the JSON for each archive
98+
# Create a temporary JSON file to accumulate changes
99+
tmp_json="${JSON_PATH}.tmp"
100+
cp "$JSON_PATH" "$tmp_json"
101+
102+
for archive in esptool-v"${VERSION}"-*.tar.gz esptool-v"${VERSION}"-*.zip; do
103+
[ -f "$archive" ] || continue
104+
105+
echo "Updating JSON for $archive"
106+
107+
# Determine host from archive name
108+
case "$archive" in
109+
*linux-amd64*) host="x86_64-pc-linux-gnu" ;;
110+
*linux-armv7*) host="arm-linux-gnueabihf" ;;
111+
*linux-aarch64*) host="aarch64-linux-gnu" ;;
112+
*macos-amd64*) host="x86_64-apple-darwin" ;;
113+
*macos-arm64*) host="arm64-apple-darwin" ;;
114+
*win64*) hosts=("x86_64-mingw32" "i686-mingw32") ;;
115+
*) echo "Unknown host for $archive"; continue ;;
116+
esac
117+
118+
# For win64, loop over both hosts; otherwise, use a single host
119+
if [[ "$archive" == *win64* ]]; then
120+
for host in "${hosts[@]}"; do
121+
update_json_for_host "$host" "$archive"
122+
done
123+
else
124+
update_json_for_host "$host" "$archive"
125+
fi
126+
done
127+
128+
# After all archives are processed, move the temporary JSON to the final file
129+
mv "$tmp_json" "$JSON_PATH"

.github/scripts/release_append_cn.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
#!/usr/bin/env python3
3+
4+
# Arduino IDE provides by default a package file for the ESP32. This causes version conflicts
5+
# when the user tries to use the JSON file with the Chinese mirrors.
6+
#
7+
# The downside is that the Arduino IDE will always warn the user that updates are available as it
8+
# will consider the version from the Chinese mirrors as a pre-release version.
9+
#
10+
# This script is used to append "-cn" to all versions in the package_esp32_index_cn.json file so that
11+
# the user can select the Chinese mirrors without conflicts.
12+
#
13+
# If Arduino ever stops providing the package_esp32_index.json file by default,
14+
# this script can be removed and the tags reverted.
15+
16+
import json
17+
18+
def append_cn_to_versions(obj):
19+
if isinstance(obj, dict):
20+
# dfu-util comes from arduino.cc and not from the Chinese mirrors, so we skip it
21+
if obj.get("name") == "dfu-util":
22+
return
23+
24+
for key, value in obj.items():
25+
if key == "version" and isinstance(value, str):
26+
if not value.endswith("-cn"):
27+
obj[key] = value + "-cn"
28+
else:
29+
append_cn_to_versions(value)
30+
31+
elif isinstance(obj, list):
32+
for item in obj:
33+
append_cn_to_versions(item)
34+
35+
def process_json_file(input_path, output_path=None):
36+
with open(input_path, "r", encoding="utf-8") as f:
37+
data = json.load(f)
38+
39+
append_cn_to_versions(data)
40+
41+
if output_path is None:
42+
output_path = input_path
43+
44+
with open(output_path, "w", encoding="utf-8") as f:
45+
json.dump(data, f, indent=2)
46+
47+
print(f"Updated JSON written to {output_path}")
48+
49+
if __name__ == "__main__":
50+
import sys
51+
if len(sys.argv) < 2:
52+
print("Usage: python release_append_cn.py input.json [output.json]")
53+
else:
54+
input_file = sys.argv[1]
55+
output_file = sys.argv[2] if len(sys.argv) > 2 else None
56+
process_json_file(input_file, output_file)

.github/workflows/publishsizes.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,17 @@ jobs:
4444
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
4545
do
4646
IFS=$'\t' read name url <<< "$artifact"
47-
gh api $url > "$name.zip"
48-
unzip -j "$name.zip" -d "temp_$name"
49-
if [[ "$name" == "pr_number" ]]; then
50-
mv "temp_$name"/* sizes-report
51-
elif [[ "$name" == "pr_cli"* ]]; then
52-
mv "temp_$name"/* sizes-report/pr
53-
else
54-
mv "temp_$name"/* sizes-report
47+
# Only process pr_number and pr_cli_compile artifacts
48+
if [[ "$name" == "pr_number" || "$name" =~ ^pr_cli_compile_[0-9]+$ ]]; then
49+
gh api $url > "$name.zip"
50+
unzip -o -j "$name.zip" -d "temp_$name"
51+
if [[ "$name" == "pr_number" ]]; then
52+
mv "temp_$name"/* sizes-report
53+
elif [[ "$name" =~ ^pr_cli_compile_[0-9]+$ ]]; then
54+
mv "temp_$name"/* sizes-report/pr
55+
fi
56+
rm -r "temp_$name"
5557
fi
56-
rm -r "temp_$name"
5758
done
5859
echo "Contents of parent directory:"
5960
ls -R ..

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ set(ARDUINO_LIBRARY_LittleFS_SRCS libraries/LittleFS/src/LittleFS.cpp)
165165
set(ARDUINO_LIBRARY_NetBIOS_SRCS libraries/NetBIOS/src/NetBIOS.cpp)
166166

167167
set(ARDUINO_LIBRARY_OpenThread_SRCS
168+
libraries/OpenThread/src/OThread.cpp
168169
libraries/OpenThread/src/OThreadCLI.cpp
169170
libraries/OpenThread/src/OThreadCLI_Util.cpp)
170171

0 commit comments

Comments
 (0)