0036-build-prevent-race-condition-between-tool-symlink-creation.patch 941 B

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