This repository has been archived on 2024-05-11. You can view files and clone it, but cannot push or open issues or pull requests.
gluon-firmware/patches/openwrt/0036-build-prevent-race-con...

21 lines
941 B
Diff

From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Thu, 28 May 2015 03:48:14 +0200
Subject: build: prevent race condition between tool symlink creation
Filter out STAGING_DIR_HOST binary path to prevent picking up grep from this
path.
diff --git a/tools/Makefile b/tools/Makefile
index 137ad61..c24bca1 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -120,7 +120,7 @@ $(STAGING_DIR_HOST)/.prepared: $(TMP_DIR)/.build
define PrepareCommand
$(STAGING_DIR_HOST)/bin/$(1): $(STAGING_DIR_HOST)/.prepared
@mkdir -p "$$(dir $$@)"; rm -f "$$@"
- @export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \
+ @export PATH="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))"; export FILE="$$$$(which $(2) 2>/dev/null | grep -v 'not found' | head -n1)"; [ -n "$$$$FILE" ] || { \
echo "Command $(1) not found."; false; \
}; ln -s "$$$$FILE" "$$@"