From e979442cd6c98b9f757d672dcd363a385182397d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20Niew=C3=B6hner?= Date: Sat, 26 Oct 2019 00:06:42 +0200 Subject: payloads/external/GRUB2: fix constantly rebuilding due to git checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Multiple git checkouts cause GRUB2 to constantly rebuild even if there were no changes to code or config. This is due to changing timestamps. Fix this by not creating or switching branches but instead rely on `git checkout -f` which does not touch existing unchanged files. To be sure to not break anyones workflow checkout is skipped and a warning gets printed if the tree/index is unclean. Change-Id: I7cf66f63268de973a654146a0a47c3d5ca516d4d Signed-off-by: Michael Niewöhner Reviewed-on: https://review.coreboot.org/c/coreboot/+/36343 Reviewed-by: Nico Huber Tested-by: build bot (Jenkins) --- payloads/external/GRUB2/Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'payloads/external/GRUB2') diff --git a/payloads/external/GRUB2/Makefile b/payloads/external/GRUB2/Makefile index b433bc09b3..20afdc36c4 100644 --- a/payloads/external/GRUB2/Makefile +++ b/payloads/external/GRUB2/Makefile @@ -1,4 +1,4 @@ -TAG-$(CONFIG_GRUB2_MASTER)= +TAG-$(CONFIG_GRUB2_MASTER)=origin/HEAD TAG-$(CONFIG_GRUB2_REVISION)=$(CONFIG_GRUB2_REVISION_ID) TAG-$(CONFIG_GRUB2_STABLE)=grub-2.04 NAME-$(CONFIG_GRUB2_MASTER)=HEAD @@ -15,14 +15,14 @@ all: grub2 checkout: echo " GIT GRUB2 $(NAME-y)" - test -d grub2 || \ - git clone $(project_git_repo) $(project_dir) - cd grub2 && \ - git checkout master && \ - git pull; \ - test -n "$(TAG-y)" && \ - git branch -f $(NAME-y) $(TAG-y) && \ - git checkout $(NAME-y) || true + test -d $(project_dir) || git clone $(project_git_repo) $(project_dir) + git -C $(project_dir) fetch +ifeq ("$(shell git -C $(project_dir) status --ignored=no --untracked-files=no --porcelain)",) + git -C $(project_dir) checkout -f $(TAG-y) +else + echo "WARNING: index/tree not clean, skipping update / force checkout." + echo " Checkout manually with `git -C $(project_dir) checkout -f`." +endif grub2/build/config.h: $(CONFIG_DEP) | checkout echo " CONFIG GRUB2 $(NAME-y)" -- cgit v1.2.3