aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2024-02-03 22:30:15 +0100
committerlonkaars <loek@pipeframe.xyz>2024-02-03 22:30:15 +0100
commit0813b957b906edda15d6582cb31c4a3d6243db51 (patch)
tree4251770c18a0b5f20bd06f630d900fc025cbaf48
parentc801f769dd22361cfc8db43837e817002cb0ea1a (diff)
improve speed in state/gen for large kernel repo
-rwxr-xr-xstate/gen27
1 files changed, 14 insertions, 13 deletions
diff --git a/state/gen b/state/gen
index 6066685..da89125 100755
--- a/state/gen
+++ b/state/gen
@@ -6,23 +6,24 @@ cd "$(dirname "$0")"
# do not run anything if make was run with -n (dry run)
[ "${MAKEFLAGS#*n}" != "$MAKEFLAGS" ] && exit
-touch_rm_exit_code() {
- PREV_EC="$?"
- if [ "$PREV_EC" -eq 0 ] ; then
- ! [ -e "$1" ] && touch "$1"
- else
- rm -f "$1"
- fi
- return "$PREV_EC"
-}
-
# container image (initialized here, updated in makefile)
$CTR image exists "$CTR_IMG_TAG" 1> /dev/null 2> /dev/null
-touch_rm_exit_code container_img
+if [ $? -eq 0 ] ; then
+ ! [ -e container_img ] && touch container_img
+else
+ rm -f container_img
+fi
# check if all the submodules are initialized
-test -z "$(git submodule status | grep '^-')"
-touch_rm_exit_code submodules
+touch submodules
+MODULES="$(git config \
+ --file "$(git rev-parse --show-toplevel)/.gitmodules" \
+ --name-only --get-regexp path |\
+ sed -e 's/^submodule\./modules\//' -e 's/\.path$/\/HEAD/')"
+for git_module in $MODULES ; do
+ git rev-parse "$git_module" 1> /dev/null 2> /dev/null && continue
+ rm -f submodules
+done
rm -f sdcard_part sdcard_fmt
# if no explicit SDCARD_DISK is set, guess which device is the sd card by