Skip to content

Makefile: make sure coreboot forks do the right thing when there is no .canary file but coreboot fork directory exists #1968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -416,15 +416,15 @@ define define_module =
# 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 \
echo "INFO: .canary file not found. Cloning repository $($1_repo) into $(build)/$($1_base_dir)" && \
if [ ! -e "$$@" ] && [ ! -d "$(build)/$($1_base_dir)" ]; then \
echo "INFO: .canary file and directory not found. Cloning repository $($1_repo) into $(build)/$($1_base_dir)" && \
git clone $($1_repo) "$(build)/$($1_base_dir)" && \
echo "INFO: Resetting repository to commit $($1_commit_hash)" && \
git -C "$(build)/$($1_base_dir)" reset --hard $($1_commit_hash) && \
echo "INFO: Creating .canary file with repo and commit hash" && \
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@" ; \
elif [ "$$$$(cat "$$@")" != '$($1_repo)|$($1_commit_hash)' ]; then \
echo "INFO: Canary file differs. Switching $1 to $($1_repo) at $($1_commit_hash)" && \
elif [ ! -e "$$@" ] || [ "$$$$(cat "$$@")" != '$($1_repo)|$($1_commit_hash)' ]; then \
echo "INFO: .canary file missing or differs. Resetting $1 to $($1_repo) at $($1_commit_hash)" && \
git -C "$(build)/$($1_base_dir)" reset --hard HEAD^ && \
echo "INFO: Fetching commit $($1_commit_hash) from $($1_repo) (without recursing submodules)" && \
git -C "$(build)/$($1_base_dir)" fetch $($1_repo) $($1_commit_hash) --recurse-submodules=no && \
Expand Down