Explorar el Código

build: prevent race condition between tool symlink creation

Matthias Schiffer hace 9 años
padre
commit
bdd0dbda1b

+ 20 - 0
patches/openwrt/0036-build-prevent-race-condition-between-tool-symlink-creation.patch

@@ -0,0 +1,20 @@
+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" "$$@"
+