mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-20 05:28:08 +00:00
Makefile: autoupdate and checkout git clones of modules
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This commit is contained in:
parent
abd99a0f28
commit
0a1e47f585
41
Makefile
41
Makefile
@ -264,17 +264,41 @@ define define_module =
|
|||||||
|
|
||||||
ifneq ("$($1_repo)","")
|
ifneq ("$($1_repo)","")
|
||||||
$(eval $1_patch_name = $1$(if $($1_patch_version),-$($1_patch_version),))
|
$(eval $1_patch_name = $1$(if $($1_patch_version),-$($1_patch_version),))
|
||||||
# Checkout the tree instead and touch the canary file so that we know
|
# First time:
|
||||||
# that the files are all present. No signature hashes are checked in
|
# Checkout the tree instead and create the canary file with repo and
|
||||||
# this case, since we don't have a stable version to compare against.
|
# revision so that we know that the files are all present and their
|
||||||
$(build)/$($1_base_dir)/.canary:
|
# version.
|
||||||
git clone $($1_repo) "$(build)/$($1_base_dir)"
|
#
|
||||||
cd $(build)/$($1_base_dir) && git reset --hard $($1_commit_hash) && git submodule update --init --checkout
|
# Other times:
|
||||||
|
# If .canary contains the same repo and revision combination, do nothing.
|
||||||
|
# Otherwise, pull a new revision and checkout with update of submodules
|
||||||
|
#
|
||||||
|
# No signature hashes are checked in this case, since we don't have a
|
||||||
|
# stable version to compare against.
|
||||||
|
#
|
||||||
|
# XXX: "git clean -dffx" is a hack for coreboot during commit switching, need
|
||||||
|
# module-specific cleanup action to get rid of it.
|
||||||
|
$(build)/$($1_base_dir)/.canary: FORCE
|
||||||
|
if [ ! -e "$$@" ]; then \
|
||||||
|
git clone $($1_repo) "$(build)/$($1_base_dir)"; \
|
||||||
|
git -C "$(build)/$($1_base_dir)" reset --hard $($1_commit_hash) && git submodule update --init --checkout; \
|
||||||
|
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@"; \
|
||||||
|
elif [ "$$$$(cat "$$@")" != '$($1_repo)|$($1_commit_hash)' ]; then \
|
||||||
|
echo "Switching $1 to $($1_repo) at $($1_commit_hash)" && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" fetch $($1_repo) $($1_commit_hash) && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" reset --hard $($1_commit_hash) && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" clean -df && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" clean -dffx payloads util/cbmem && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" submodule sync && \
|
||||||
|
git -C "$(build)/$($1_base_dir)" submodule update --init --checkout && \
|
||||||
|
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@"; \
|
||||||
|
fi
|
||||||
|
if [ ! -e "$(build)/$($1_base_dir)/.patched" ]; then \
|
||||||
if [ -r patches/$($1_patch_name).patch ]; then \
|
if [ -r patches/$($1_patch_name).patch ]; then \
|
||||||
( git apply --verbose --reject --binary --directory build/$(CONFIG_TARGET_ARCH)/$($1_base_dir) ) \
|
( git apply --verbose --reject --binary --directory build/$(CONFIG_TARGET_ARCH)/$($1_base_dir) ) \
|
||||||
< patches/$($1_patch_name).patch \
|
< patches/$($1_patch_name).patch \
|
||||||
|| exit 1 ; \
|
|| exit 1 ; \
|
||||||
fi
|
fi && \
|
||||||
if [ -d patches/$($1_patch_name) ] && \
|
if [ -d patches/$($1_patch_name) ] && \
|
||||||
[ -r patches/$($1_patch_name) ] ; then \
|
[ -r patches/$($1_patch_name) ] ; then \
|
||||||
for patch in patches/$($1_patch_name)/*.patch ; do \
|
for patch in patches/$($1_patch_name)/*.patch ; do \
|
||||||
@ -283,8 +307,9 @@ define define_module =
|
|||||||
< $$$$patch \
|
< $$$$patch \
|
||||||
|| exit 1 ; \
|
|| exit 1 ; \
|
||||||
done ; \
|
done ; \
|
||||||
|
fi && \
|
||||||
|
touch "$(build)/$($1_base_dir)/.patched"; \
|
||||||
fi
|
fi
|
||||||
@touch "$$@"
|
|
||||||
else
|
else
|
||||||
$(eval $1_patch_version ?= $($1_version))
|
$(eval $1_patch_version ?= $($1_version))
|
||||||
$(eval $1_patch_name = $1-$($1_patch_version))
|
$(eval $1_patch_name = $1-$($1_patch_version))
|
||||||
|
Loading…
Reference in New Issue
Block a user