Skip to content

V5.1 git clone optimize #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ while getopts ":A:I:i:c:t:b:sde" opt; do
;;
b )
b=$OPTARG
if [ "$b" != "build" ] &&
[ "$b" != "menuconfig" ] &&
[ "$b" != "reconfigure" ] &&
[ "$b" != "idf_libs" ] &&
[ "$b" != "copy_bootloader" ] &&
if [ "$b" != "build" ] &&
[ "$b" != "menuconfig" ] &&
[ "$b" != "reconfigure" ] &&
[ "$b" != "idf_libs" ] &&
[ "$b" != "copy_bootloader" ] &&
[ "$b" != "mem_variant" ]; then
print_help
fi
Expand Down Expand Up @@ -114,7 +114,7 @@ if [ "$BUILD_TYPE" != "all" ]; then
print_help
fi
configs="configs/defconfig.common;configs/defconfig.$TARGET"

# Target Features Configs
for target_json in `jq -c '.targets[]' configs/builds.json`; do
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
Expand Down Expand Up @@ -146,13 +146,6 @@ IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "")
AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "")
echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt

# Add release-info
rm -rf release-info.txt
IDF_Commit_short=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "")
AR_Commit_short=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "")
echo "Framework built from $IDF_REPO branch $IDF_BRANCH commit $IDF_Commit_short and $AR_REPO branch $AR_BRANCH commit $AR_Commit_short" >> release-info.txt


#targets_count=`jq -c '.targets[] | length' configs/builds.json`
for target_json in `jq -c '.targets[]' configs/builds.json`; do
target=$(echo "$target_json" | jq -c '.target' | tr -d '"')
Expand Down
1 change: 1 addition & 0 deletions tools/archive-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ cp -f ../components/arduino/pac* arduino-esp32
rm -rf arduino-esp32/idf_component_examples
rm -rf arduino-esp32/docs
rm -rf arduino-esp32/tests
rm -rf arduino-esp32/idf_component_examples
rm -rf arduino-esp32/libraries/RainMaker
rm -rf arduino-esp32/libraries/Insights
rm -rf arduino-esp32/libraries/ESP_I2S
Expand Down
10 changes: 3 additions & 7 deletions tools/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ if [ -z $AR_BRANCH ]; then
AR_BRANCH="main"
fi

if [ -z $AR_PR_TARGET_BRANCH ]; then
# Temporary to get CI working. original is master
AR_PR_TARGET_BRANCH="esp-idf-v5.1-libs"
fi

if [ -z $IDF_TARGET ]; then
if [ -f sdkconfig ]; then
IDF_TARGET=`cat sdkconfig | grep CONFIG_IDF_TARGET= | cut -d'"' -f2`
Expand All @@ -34,7 +29,7 @@ fi
AR_USER="tasmota"

# IDF commit to use
#IDF_COMMIT="ec31b4d09d3da05001648eaa58aa582c5cc923c8"
#IDF_COMMIT=""

# Arduino commit to use
#AR_COMMIT=""
Expand Down Expand Up @@ -176,8 +171,9 @@ function git_create_pr(){ # git_create_pr <branch> <title>
local pr_branch="$1"
local pr_title="$2"
local pr_target="$3"
local pr_body=""
local pr_body="\`\`\`\r\n"
while read -r line; do pr_body+=$line"\r\n"; done < "$AR_TOOLS/esp32-arduino-libs/versions.txt"
pr_body+="\`\`\`\r\n"
local pr_data="{\"title\": \"$pr_title\", \"body\": \"$pr_body\", \"head\": \"$AR_USER:$pr_branch\", \"base\": \"$pr_target\"}"
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"`
local done_pr=`echo "$git_create_pr_res" | jq -r '.title'`
Expand Down
37 changes: 30 additions & 7 deletions tools/install-arduino.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,38 @@ source ./tools/config.sh
#
# CLONE/UPDATE ARDUINO
#
echo "Updating ESP32 Arduino..."
if [ "$AR_BRANCH" ]; then
echo "Installing Arduino from branch '$AR_BRANCH'"
if [ ! -d "$AR_COMPS/arduino" ]; then
# for using a branch we need no full clone
git clone -b "$AR_BRANCH" --recursive --depth 1 --shallow-submodule $AR_REPO_URL "$AR_COMPS/arduino"
else
# update existing branch
cd "$AR_COMPS/arduino"
git pull
git reset --hard $AR_BRANCH
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
fi
fi

if [ ! -d "$AR_COMPS/arduino" ]; then
# we need a full clone since no branch was set
echo "Full cloning of ESP32 Arduino repo '$AR_REPO_URL'"
git clone $AR_REPO_URL "$AR_COMPS/arduino"
else
if [ "$AR_BRANCH" ]; then
echo "ESP32 Arduino is up to date"
else
# update existing branch
echo "Updating ESP32 Arduino"
cd "$AR_COMPS/arduino"
git pull
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
fi
fi

if [ -z $AR_BRANCH ]; then
Expand Down Expand Up @@ -39,12 +68,6 @@ if [ -z $AR_BRANCH ]; then
fi
fi

if [ "$AR_BRANCH" ]; then
echo "AR_BRANCH='$AR_BRANCH'"
git -C "$AR_COMPS/arduino" checkout "$AR_BRANCH" && \
git -C "$AR_COMPS/arduino" fetch && \
git -C "$AR_COMPS/arduino" pull --ff-only
fi
if [ $? -ne 0 ]; then exit 1; fi

#
Expand Down
39 changes: 35 additions & 4 deletions tools/install-esp-idf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,42 @@ fi
#
# CLONE ESP-IDF
#
if [ "$IDF_TAG" ] || [ "$IDF_COMMIT" ]; then
if [ ! -d "$IDF_PATH" ]; then
# full clone needed to check out tag or commit
echo "ESP-IDF is not installed! Installing with full clone from $IDF_REPO_URL branch $IDF_BRANCH"
git clone $IDF_REPO_URL -b $IDF_BRANCH
idf_was_installed="1"
else
# update local clone
echo "ESP-IDF is installed, updating..."
cd $IDF_PATH
git pull
git reset --hard $IDF_BRANCH
git submodule update
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
idf_was_installed="1"
fi
fi

if [ ! -d "$IDF_PATH" ]; then
echo "ESP-IDF is not installed! Installing from $IDF_REPO_URL branch $IDF_BRANCH"
git clone $IDF_REPO_URL -b $IDF_BRANCH
idf_was_installed="1"
# for using a branch we need no full clone
echo "ESP-IDF is not installed! Installing branch $IDF_BRANCH from $IDF_REPO_URL"
git clone -b $IDF_BRANCH --recursive --depth 1 --shallow-submodule $IDF_REPO_URL
idf_was_installed="1"
else
# update existing branch
echo "ESP-IDF is already installed, updating branch '$IDF_BRANCH'"
cd $IDF_PATH
git pull
git reset --hard $IDF_BRANCH
git submodule update --depth 1
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
cd -
idf_was_installed="1"
fi

if [ "$IDF_TAG" ]; then
Expand All @@ -30,7 +61,7 @@ fi
#

if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then
git -C $IDF_PATH submodule update --init --recursive
git submodule update --recursive
$IDF_PATH/install.sh
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD)
Expand Down
2 changes: 1 addition & 1 deletion tools/repository_dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ commit=`echo "$payload" | jq -r '.commit'`
builder=`echo "$payload" | jq -r '.builder'`
arduino=`echo "$payload" | jq -r '.arduino'`

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

if [ ! "$action" == "deploy" ] && [ ! "$action" == "build" ]; then
echo "Bad Action $action"
Expand Down
35 changes: 12 additions & 23 deletions tools/update-components.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
source ./tools/config.sh

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

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

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

#
# CLONE/UPDATE ESP-LITTLEFS v1.10.0 commit 032f9...
#
#echo "Updating ESP-LITTLEFS..."
#if [ ! -d "$AR_COMPS/esp_littlefs" ]; then
# git clone $LITTLEFS_REPO_URL "$AR_COMPS/esp_littlefs"
# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495
# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive
#else
# git -C "$AR_COMPS/esp_littlefs" fetch
# git -C "$AR_COMPS/esp_littlefs" pull --ff-only
# git -C "$AR_COMPS/esp_littlefs" checkout 032f9eb2e291e7c4df63c3e6a3cb3bc766ded495
# git -C "$AR_COMPS/esp_littlefs" submodule update --init --recursive
#fi
#if [ $? -ne 0 ]; then exit 1; fi

#
# CLONE/UPDATE TINYUSB
#
echo "Updating TinyUSB..."
if [ ! -d "$TINYUSB_REPO_DIR" ]; then
git clone "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR"
git clone -b master --depth 1 "$TINYUSB_REPO_URL" "$TINYUSB_REPO_DIR"
else
git -C "$TINYUSB_REPO_DIR" fetch && \
git -C "$TINYUSB_REPO_DIR" pull --ff-only
cd $TINYUSB_REPO_DIR
git pull
# -ff is for cleaning untracked files as well as submodules
git clean -ffdx
fi
if [ $? -ne 0 ]; then exit 1; fi