1
1
# /bin/bash
2
2
3
+ set -e
4
+
3
5
source ./tools/config.sh
4
6
5
7
CAMERA_REPO_URL=" https://github.com/espressif/esp32-camera.git"
@@ -10,142 +12,81 @@ DSP_REPO_URL="https://github.com/espressif/esp-dsp.git"
10
12
LITTLEFS_REPO_URL=" https://github.com/joltwallet/esp_littlefs.git"
11
13
TINYUSB_REPO_URL=" https://github.com/hathach/tinyusb.git"
12
14
15
+ if [ -n " $RECREATE " ]; then
16
+ VERSION=" ./tools/version-$IDF_BRANCH .sh"
17
+ if [ ! -f " $VERSION " ]; then
18
+ echo " $VERSION does not exists"
19
+ exit 1
20
+ fi
21
+ source $VERSION
22
+ fi
23
+
13
24
#
14
25
# CLONE/UPDATE ARDUINO
15
26
#
16
-
17
- if [ ! -d " $AR_COMPS /arduino" ]; then
18
- git clone $AR_REPO_URL " $AR_COMPS /arduino"
19
- fi
20
-
21
- if [ -z $AR_BRANCH ]; then
22
- if [ -z $GITHUB_HEAD_REF ]; then
23
- current_branch=` git branch --show-current`
24
- else
25
- current_branch=" $GITHUB_HEAD_REF "
27
+ if [ -z " AR_REPO_VERSION" ]; then
28
+ if [ ! -d " $AR_COMPS /arduino" ]; then
29
+ git clone $AR_REPO_URL " $AR_COMPS /arduino"
26
30
fi
27
- echo " Current Branch: $current_branch "
28
- if [[ " $current_branch " != " master" && ` git_branch_exists " $AR_COMPS /arduino" " $current_branch " ` == " 1" ]]; then
29
- export AR_BRANCH=" $current_branch "
30
- else
31
- if [ -z " $IDF_COMMIT " ]; then # commit was not specified at build time
32
- AR_BRANCH_NAME=" idf-$IDF_BRANCH "
31
+
32
+ if [ -z $AR_BRANCH ]; then
33
+ if [ -z $GITHUB_HEAD_REF ]; then
34
+ current_branch=` git branch --show-current`
33
35
else
34
- AR_BRANCH_NAME= " idf- $IDF_COMMIT "
36
+ current_branch= " $GITHUB_HEAD_REF "
35
37
fi
36
- has_ar_branch= ` git_branch_exists " $AR_COMPS /arduino " " $AR_BRANCH_NAME " `
37
- if [ " $has_ar_branch " == " 1" ]; then
38
- export AR_BRANCH=" $AR_BRANCH_NAME "
38
+ echo " Current Branch: $current_branch "
39
+ if [[ " $current_branch " != " master " && ` git_branch_exists " $AR_COMPS /arduino " " $current_branch " ` == " 1" ] ]; then
40
+ export AR_BRANCH=" $current_branch "
39
41
else
40
- has_ar_branch=` git_branch_exists " $AR_COMPS /arduino" " $AR_PR_TARGET_BRANCH " `
42
+ if [ -z " $IDF_COMMIT " ]; then # commit was not specified at build time
43
+ AR_BRANCH_NAME=" idf-$IDF_BRANCH "
44
+ else
45
+ AR_BRANCH_NAME=" idf-$IDF_COMMIT "
46
+ fi
47
+ has_ar_branch=` git_branch_exists " $AR_COMPS /arduino" " $AR_BRANCH_NAME " `
41
48
if [ " $has_ar_branch " == " 1" ]; then
42
- export AR_BRANCH=" $AR_PR_TARGET_BRANCH "
49
+ export AR_BRANCH=" $AR_BRANCH_NAME "
50
+ else
51
+ has_ar_branch=` git_branch_exists " $AR_COMPS /arduino" " $AR_PR_TARGET_BRANCH " `
52
+ if [ " $has_ar_branch " == " 1" ]; then
53
+ export AR_BRANCH=" $AR_PR_TARGET_BRANCH "
54
+ fi
43
55
fi
44
56
fi
45
57
fi
46
- fi
47
58
48
- if [ " $AR_BRANCH " ]; then
49
- git -C " $AR_COMPS /arduino" checkout " $AR_BRANCH " && \
50
- git -C " $AR_COMPS /arduino" fetch && \
51
- git -C " $AR_COMPS /arduino" pull --ff-only
59
+ if [ " $AR_BRANCH " ]; then
60
+ git -C " $AR_COMPS /arduino" checkout " $AR_BRANCH "
61
+ git -C " $AR_COMPS /arduino" fetch
62
+ git -C " $AR_COMPS /arduino" pull --ff-only
63
+ fi
64
+ else
65
+ ./tools/git-update.sh " $AR_COMPS /arduino" $AR_REPO_URL $AR_REPO_VERSION
52
66
fi
53
- if [ $? -ne 0 ]; then exit 1; fi
54
67
55
- #
56
68
# CLONE/UPDATE ESP32-CAMERA
57
- #
69
+ ./tools/git-update.sh " $AR_COMPS /esp32-camera " $CAMERA_REPO_URL $CAMERA_REPO_VERSION
58
70
59
- if [ ! -d " $AR_COMPS /esp32-camera" ]; then
60
- git clone $CAMERA_REPO_URL " $AR_COMPS /esp32-camera"
61
- else
62
- git -C " $AR_COMPS /esp32-camera" fetch && \
63
- git -C " $AR_COMPS /esp32-camera" pull --ff-only
64
- fi
65
71
# this is a temp measure to fix build issue in recent IDF master
66
72
if [ -f " $AR_COMPS /esp32-camera/idf_component.yml" ]; then
67
73
rm -rf " $AR_COMPS /esp32-camera/idf_component.yml"
68
74
fi
69
- if [ $? -ne 0 ]; then exit 1; fi
70
75
71
- #
72
76
# CLONE/UPDATE ESP-DL
73
- #
77
+ ./tools/git-update.sh " $AR_COMPS /esp-dl " $DL_REPO_URL $DL_REPO_VERSION
74
78
75
- if [ ! -d " $AR_COMPS /esp-dl" ]; then
76
- git clone $DL_REPO_URL " $AR_COMPS /esp-dl"
77
- else
78
- git -C " $AR_COMPS /esp-dl" fetch && \
79
- git -C " $AR_COMPS /esp-dl" pull --ff-only
80
- fi
81
- if [ $? -ne 0 ]; then exit 1; fi
82
-
83
- #
84
79
# CLONE/UPDATE ESP-SR
85
- #
80
+ ./tools/git-update.sh " $AR_COMPS /esp-sr " $SR_REPO_URL $SR_REPO_VERSION
86
81
87
- if [ ! -d " $AR_COMPS /esp-sr" ]; then
88
- git clone $SR_REPO_URL " $AR_COMPS /esp-sr"
89
- else
90
- git -C " $AR_COMPS /esp-sr" fetch && \
91
- git -C " $AR_COMPS /esp-sr" pull --ff-only
92
- fi
93
- if [ $? -ne 0 ]; then exit 1; fi
94
-
95
- #
96
82
# CLONE/UPDATE ESP-LITTLEFS
97
- #
98
-
99
- if [ ! -d " $AR_COMPS /esp_littlefs" ]; then
100
- git clone $LITTLEFS_REPO_URL " $AR_COMPS /esp_littlefs" && \
101
- git -C " $AR_COMPS /esp_littlefs" submodule update --init --recursive
102
- else
103
- git -C " $AR_COMPS /esp_littlefs" fetch && \
104
- git -C " $AR_COMPS /esp_littlefs" pull --ff-only && \
105
- git -C " $AR_COMPS /esp_littlefs" submodule update --init --recursive
106
- fi
107
- if [ $? -ne 0 ]; then exit 1; fi
83
+ ./tools/git-update.sh -s " $AR_COMPS /esp_littlefs" $LITTLEFS_REPO_URL $LITTLEFS_REPO_VERSION
108
84
109
- #
110
85
# CLONE/UPDATE ESP-RAINMAKER
111
- #
112
-
113
- if [ ! -d " $AR_COMPS /esp-rainmaker" ]; then
114
- git clone $RMAKER_REPO_URL " $AR_COMPS /esp-rainmaker" && \
115
- git -C " $AR_COMPS /esp-rainmaker" submodule update --init --recursive
116
- # git -C "$AR_COMPS/esp-rainmaker" checkout f1b82c71c4536ab816d17df016d8afe106bd60e3
117
- else
118
- git -C " $AR_COMPS /esp-rainmaker" fetch && \
119
- git -C " $AR_COMPS /esp-rainmaker" pull --ff-only && \
120
- git -C " $AR_COMPS /esp-rainmaker" submodule update --init --recursive
121
- fi
122
- if [ $? -ne 0 ]; then exit 1; fi
86
+ ./tools/git-update.sh -s " $AR_COMPS /esp-rainmaker" $RMAKER_REPO_URL $RMAKER_REPO_VERSION
123
87
124
- #
125
88
# CLONE/UPDATE ESP-DSP
126
- #
127
-
128
- if [ ! -d " $AR_COMPS /esp-dsp" ]; then
129
- git clone $DSP_REPO_URL " $AR_COMPS /esp-dsp"
130
- # cml=`cat "$AR_COMPS/esp-dsp/CMakeLists.txt"`
131
- # echo "if(IDF_TARGET STREQUAL \"esp32\" OR IDF_TARGET STREQUAL \"esp32s2\" OR IDF_TARGET STREQUAL \"esp32s3\")" > "$AR_COMPS/esp-dsp/CMakeLists.txt"
132
- # echo "$cml" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
133
- # echo "endif()" >> "$AR_COMPS/esp-dsp/CMakeLists.txt"
134
- else
135
- git -C " $AR_COMPS /esp-dsp" fetch && \
136
- git -C " $AR_COMPS /esp-dsp" pull --ff-only
137
- fi
138
- if [ $? -ne 0 ]; then exit 1; fi
89
+ ./tools/git-update.sh " $AR_COMPS /esp-dsp" $DSP_REPO_URL $DSP_REPO_VERSION
139
90
140
- #
141
91
# CLONE/UPDATE TINYUSB
142
- #
143
-
144
- if [ ! -d " $AR_COMPS /arduino_tinyusb/tinyusb" ]; then
145
- git clone $TINYUSB_REPO_URL " $AR_COMPS /arduino_tinyusb/tinyusb"
146
- else
147
- git -C " $AR_COMPS /arduino_tinyusb/tinyusb" fetch && \
148
- git -C " $AR_COMPS /arduino_tinyusb/tinyusb" pull --ff-only
149
- fi
150
- if [ $? -ne 0 ]; then exit 1; fi
151
-
92
+ ./tools/git-update.sh " $AR_COMPS /arduino_tinyusb/tinyusb" $TINYUSB_REPO_URL $TINYUSB_REPO_VERSION
0 commit comments