0026-rules.mk-make-the-locked-template-available-even-if-flock-has-not-been-built-yet-fall-back-to-unlocked-shell-command.patch 969 B

1234567891011121314151617181920212223242526272829303132
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Sun, 24 Apr 2016 08:45:44 +0200
  3. Subject: rules.mk: make the locked template available even if flock has not been built yet (fall back to unlocked shell command)
  4. Signed-off-by: Felix Fietkau <nbd@openwrt.org>
  5. Backport of r48414
  6. diff --git a/rules.mk b/rules.mk
  7. index 9d0134d2b26a52b74d30546cc3d51f7e71d1bc75..ece502609bd08af21be782a706f0bf6599895568 100644
  8. --- a/rules.mk
  9. +++ b/rules.mk
  10. @@ -310,12 +310,16 @@ endef
  11. # Execute commands under flock
  12. # $(1) => The shell expression.
  13. # $(2) => The lock name. If not given, the global lock will be used.
  14. -define locked
  15. +ifneq ($(wildcard $(STAGING_DIR_HOST)/bin/flock),)
  16. + define locked
  17. SHELL= \
  18. - $(STAGING_DIR_HOST)/bin/flock \
  19. + flock \
  20. $(TMP_DIR)/.$(if $(2),$(strip $(2)),global).flock \
  21. -c '$(subst ','\'',$(1))'
  22. -endef
  23. + endef
  24. +else
  25. + locked=$(1)
  26. +endif
  27. # Recursively copy paths into another directory, purge dangling
  28. # symlinks before.