Skip to content

Commit c324a83

Browse files
committed
Makefile: make sure coreboot forks do the right thing when there is no .canary file but coreboot fork directory exists
Improves collaboration with Makefile real.remove_canary_files-extract_patch_rebuild_what_changed helper: - if canary is not found but coreboot fork directory exists: do not attempt to git clone; git reset instead and reuse previous logic - if canary is not found and coreboot dir doesn't exist: git clone Signed-off-by: Thierry Laurion <[email protected]>
1 parent 20c1064 commit c324a83

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,15 +416,15 @@ define define_module =
416416
# XXX: "git clean -dffx" is a hack for coreboot during commit switching, need
417417
# module-specific cleanup action to get rid of it.
418418
$(build)/$($1_base_dir)/.canary: FORCE
419-
if [ ! -e "$$@" ]; then \
420-
echo "INFO: .canary file not found. Cloning repository $($1_repo) into $(build)/$($1_base_dir)" && \
419+
if [ ! -e "$$@" ] && [ ! -d "$(build)/$($1_base_dir)" ]; then \
420+
echo "INFO: .canary file and directory not found. Cloning repository $($1_repo) into $(build)/$($1_base_dir)" && \
421421
git clone $($1_repo) "$(build)/$($1_base_dir)" && \
422422
echo "INFO: Resetting repository to commit $($1_commit_hash)" && \
423423
git -C "$(build)/$($1_base_dir)" reset --hard $($1_commit_hash) && \
424424
echo "INFO: Creating .canary file with repo and commit hash" && \
425425
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@" ; \
426-
elif [ "$$$$(cat "$$@")" != '$($1_repo)|$($1_commit_hash)' ]; then \
427-
echo "INFO: Canary file differs. Switching $1 to $($1_repo) at $($1_commit_hash)" && \
426+
elif [ ! -e "$$@" ] || [ "$$$$(cat "$$@")" != '$($1_repo)|$($1_commit_hash)' ]; then \
427+
echo "INFO: .canary file missing or differs. Resetting $1 to $($1_repo) at $($1_commit_hash)" && \
428428
git -C "$(build)/$($1_base_dir)" reset --hard HEAD^ && \
429429
echo "INFO: Fetching commit $($1_commit_hash) from $($1_repo) (without recursing submodules)" && \
430430
git -C "$(build)/$($1_base_dir)" fetch $($1_repo) $($1_commit_hash) --recurse-submodules=no && \

0 commit comments

Comments
 (0)