From d9c388a460d9ad3a34b167c05dd54d6fa1c1cc25 Mon Sep 17 00:00:00 2001 From: leigh capili Date: Mon, 29 Mar 2021 12:20:52 -0600 Subject: [PATCH] Cache versioned shallow clones for kernel config patching --- images/kernel/upgrade-config.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/images/kernel/upgrade-config.sh b/images/kernel/upgrade-config.sh index 22508305f..0a340bcf0 100755 --- a/images/kernel/upgrade-config.sh +++ b/images/kernel/upgrade-config.sh @@ -24,12 +24,18 @@ if [[ ${FROM} != ${TO} ]]; then cp ${FROM} ${TO} fi +CACHE="$(pwd)/../../bin/cache" +mkdir -p "${CACHE}/linux/" docker run --rm -i ${DOCKER_TTY} \ + -u "$(id -u):$(id -g)" \ ${ARCH_PARAMETER} \ - -v $(pwd)/${TO}:/tmp/.config \ - ${KERNEL_BUILDER_IMAGE} /bin/bash -c "\ - git clone --depth 1 --branch v${VERSION} ${LINUX_REPO_URL} linux && \ - cd linux && - make clean && make mrproper && cp /tmp/.config . && \ - make EXTRAVERSION="" LOCALVERSION= olddefconfig && \ + -v "$(pwd)/${TO}":/tmp/.config \ + -v "${CACHE}/linux/":/linux/ \ + -w /linux \ + ${KERNEL_BUILDER_IMAGE} /bin/bash -c " + set -xe + test -d ./${VERSION} || git clone --depth 1 --branch v${VERSION} ${LINUX_REPO_URL} ./${VERSION} + cd ./${VERSION} + make clean && make mrproper && cp /tmp/.config . + make EXTRAVERSION="" LOCALVERSION= olddefconfig cp .config /tmp/.config"