Skip to content

Commit 2766ee3

Browse files
authored
V5.1 git clone optimize
1 parent 7742cdc commit 2766ee3

6 files changed

+87
-48
lines changed

build.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
6363
;;
6464
b )
6565
b=$OPTARG
66-
if [ "$b" != "build" ] &&
67-
[ "$b" != "menuconfig" ] &&
68-
[ "$b" != "reconfigure" ] &&
69-
[ "$b" != "idf_libs" ] &&
70-
[ "$b" != "copy_bootloader" ] &&
66+
if [ "$b" != "build" ] &&
67+
[ "$b" != "menuconfig" ] &&
68+
[ "$b" != "reconfigure" ] &&
69+
[ "$b" != "idf_libs" ] &&
70+
[ "$b" != "copy_bootloader" ] &&
7171
[ "$b" != "mem_variant" ]; then
7272
print_help
7373
fi
@@ -114,7 +114,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
114114
print_help
115115
fi
116116
configs="configs/defconfig.common;configs/defconfig.$TARGET"
117-
117+
118118
# Target Features Configs
119119
for target_json in `jq -c '.targets[]' configs/builds.json`; do
120120
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')

tools/config.sh

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ if [ -z $AR_BRANCH ]; then
1414
AR_BRANCH="main"
1515
fi
1616

17-
if [ -z $AR_PR_TARGET_BRANCH ]; then
18-
# Temporary to get CI working. original is master
19-
AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs"
20-
fi
21-
2217
if [ -z $IDF_TARGET ]; then
2318
if [ -f sdkconfig ]; then
2419
IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2`
@@ -34,7 +29,7 @@ fi
3429
AR_USER="tasmota"
3530

3631
# IDF commit to use
37-
#IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8"
32+
#IDF_COMMIT=""
3833

3934
# Arduino commit to use
4035
#AR_COMMIT=""
@@ -176,8 +171,9 @@ function git_create_pr(){ # git_create_pr <branch> <title>
176171
local pr_branch="$1"
177172
local pr_title="$2"
178173
local pr_target="$3"
179-
local pr_body=""
174+
local pr_body="\`\`\`\r\n"
180175
while read -r line; do pr_body+=$line"\r\n"; done < "$AR_TOOLS/esp32-arduino-libs/versions.txt"
176+
pr_body+="\`\`\`\r\n"
181177
local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}"
182178
git_create_pr_res=`echo "$pr_data" | curl -k -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3.raw+json" --data @- "https://api.github.com/repos/$AR_REPO/pulls"`
183179
local done_pr=`echo "$git_create_pr_res" | jq -r '.title'`

tools/install-arduino.sh

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,38 @@ source ./tools/config.sh
55
#
66
# CLONE/UPDATE ARDUINO
77
#
8-
echo "Updating ESP32 Arduino..."
8+
if [ "$AR_BRANCH" ]; then
9+
echo "Installing Arduino from branch '$AR_BRANCH'"
10+
if [ ! -d "$AR_COMPS/arduino" ]; then
11+
# for using a branch we need no full clone
12+
git clone -b "$AR_BRANCH" --recursive --depth 1 --shallow-submodule $AR_REPO_URL "$AR_COMPS/arduino"
13+
else
14+
# update existing branch
15+
cd "$AR_COMPS/arduino"
16+
git pull
17+
git reset --hard $AR_BRANCH
18+
# -ff is for cleaning untracked files as well as submodules
19+
git clean -ffdx
20+
cd -
21+
fi
22+
fi
23+
924
if [ ! -d "$AR_COMPS/arduino" ]; then
25+
# we need a full clone since no branch was set
26+
echo "Full cloning of ESP32 Arduino repo '$AR_REPO_URL'"
1027
git clone $AR_REPO_URL "$AR_COMPS/arduino"
28+
else
29+
if [ "$AR_BRANCH" ]; then
30+
echo "ESP32 Arduino is up to date"
31+
else
32+
# update existing branch
33+
echo "Updating ESP32 Arduino"
34+
cd "$AR_COMPS/arduino"
35+
git pull
36+
# -ff is for cleaning untracked files as well as submodules
37+
git clean -ffdx
38+
cd -
39+
fi
1140
fi
1241

1342
if [ -z $AR_BRANCH ]; then
@@ -39,12 +68,6 @@ if [ -z $AR_BRANCH ]; then
3968
fi
4069
fi
4170

42-
if [ "$AR_BRANCH" ]; then
43-
echo "AR_BRANCH='$AR_BRANCH'"
44-
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \
45-
git -C "$AR_COMPS/arduino" fetch && \
46-
git -C "$AR_COMPS/arduino" pull --ff-only
47-
fi
4871
if [ $? -ne 0 ]; then exit 1; fi
4972

5073
#

tools/install-esp-idf.sh

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,42 @@ fi
1010
#
1111
# CLONE ESP-IDF
1212
#
13+
if [ "$IDF_TAG" ] || [ "$IDF_COMMIT" ]; then
14+
if [ ! -d "$IDF_PATH" ]; then
15+
# full clone needed to check out tag or commit
16+
echo "ESP-IDF is not installed! Installing with full clone from $IDF_REPO_URL branch $IDF_BRANCH"
17+
git clone $IDF_REPO_URL -b $IDF_BRANCH
18+
idf_was_installed="1"
19+
else
20+
# update local clone
21+
echo "ESP-IDF is installed, updating..."
22+
cd $IDF_PATH
23+
git pull
24+
git reset --hard $IDF_BRANCH
25+
git submodule update
26+
# -ff is for cleaning untracked files as well as submodules
27+
git clean -ffdx
28+
cd -
29+
idf_was_installed="1"
30+
fi
31+
fi
1332

1433
if [ ! -d "$IDF_PATH" ]; then
15-
echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH"
16-
git clone $IDF_REPO_URL -b $IDF_BRANCH
17-
idf_was_installed="1"
34+
# for using a branch we need no full clone
35+
echo "ESP-IDF is not installed! Installing branch $IDF_BRANCH from $IDF_REPO_URL"
36+
git clone -b $IDF_BRANCH --recursive --depth 1 --shallow-submodule $IDF_REPO_URL
37+
idf_was_installed="1"
38+
else
39+
# update existing branch
40+
echo "ESP-IDF is already installed, updating branch '$IDF_BRANCH'"
41+
cd $IDF_PATH
42+
git pull
43+
git reset --hard $IDF_BRANCH
44+
git submodule update --depth 1
45+
# -ff is for cleaning untracked files as well as submodules
46+
git clean -ffdx
47+
cd -
48+
idf_was_installed="1"
1849
fi
1950

2051
if [ "$IDF_TAG" ]; then
@@ -30,7 +61,7 @@ fi
3061
#
3162

3263
if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then
33-
git -C $IDF_PATH submodule update --init --recursive
64+
git submodule update --recursive
3465
$IDF_PATH/install.sh
3566
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
3667
export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD)

tools/repository_dispatch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ commit=`echo "$payload" | jq -r '.commit'`
1414
builder=`echo "$payload" | jq -r '.builder'`
1515
arduino=`echo "$payload" | jq -r '.arduino'`
1616

17-
echo "Action: $action, Branch: $branch, Tag: $tag, Commit: $commit, Builder: $builder, Arduino: $arduino, Actor: $GITHUB_ACTOR"
17+
echo "Action: $action, IDF Branch: $branch, IDF Tag: $tag, IDF Commit: $commit, Builder Branch: $builder, Arduino Branch: $arduino, Actor: $GITHUB_ACTOR"
1818

1919
if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then
2020
echo "Bad Action $action"

tools/update-components.sh

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
source ./tools/config.sh
44

55
CAMERA_REPO_URL="https://github.com/espressif/esp32-camera.git"
6-
LITTLEFS_REPO_URL="https://github.com/joltwallet/esp_littlefs.git"
76
TINYUSB_REPO_URL="https://github.com/hathach/tinyusb.git"
87
TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb"
98

@@ -12,10 +11,14 @@ TINYUSB_REPO_DIR="$AR_COMPS/arduino_tinyusb/tinyusb"
1211
#
1312
echo "Updating ESP32 Camera..."
1413
if [ ! -d "$AR_COMPS/esp32-camera" ]; then
15-
git clone $CAMERA_REPO_URL "$AR_COMPS/esp32-camera"
14+
git clone -b master --recursive --depth 1 --shallow-submodule $CAMERA_REPO_URL "$AR_COMPS/esp32-camera"
1615
else
17-
git -C "$AR_COMPS/esp32-camera" fetch && \
18-
git -C "$AR_COMPS/esp32-camera" pull --ff-only
16+
cd "$AR_COMPS/esp32-camera"
17+
git pull
18+
git submodule update --depth 1
19+
# -ff is for cleaning untracked files as well as submodules
20+
git clean -ffdx
21+
cd -
1922
fi
2023
if [ $? -ne 0 ]; then exit 1; fi
2124

@@ -24,30 +27,16 @@ if [ $? -ne 0 ]; then exit 1; fi
2427
#
2528
cp "$AR_COMPS/esp32-camera/driver/private_include/cam_hal.h" "$AR_COMPS/esp32-camera/driver/include/"
2629

27-
#
28-
# CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9...
29-
#
30-
#echo "Updating ESP-LITTLEFS..."
31-
#if [ ! -d "$AR_COMPS/esp_littlefs" ]; then
32-
# git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs"
33-
# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495
34-
# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive
35-
#else
36-
# git -C "$AR_COMPS/esp_littlefs" fetch
37-
# git -C "$AR_COMPS/esp_littlefs" pull --ff-only
38-
# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495
39-
# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive
40-
#fi
41-
#if [ $? -ne 0 ]; then exit 1; fi
42-
4330
#
4431
# CLONE/UPDATE TINYUSB
4532
#
4633
echo "Updating TinyUSB..."
4734
if [ ! -d "$TINYUSB_REPO_DIR" ]; then
48-
git clone "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR"
35+
git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR"
4936
else
50-
git -C "$TINYUSB_REPO_DIR" fetch && \
51-
git -C "$TINYUSB_REPO_DIR" pull --ff-only
37+
cd $TINYUSB_REPO_DIR
38+
git pull
39+
# -ff is for cleaning untracked files as well as submodules
40+
git clean -ffdx
5241
fi
5342
if [ $? -ne 0 ]; then exit 1; fi

0 commit comments

Comments
 (0)