aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Pratt <mcpratt@pm.me>2023-05-29 05:38:33 -0400
committerPetr Štetiar <ynezz@true.cz>2023-06-05 08:31:52 +0200
commitb890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a (patch)
treeec17758b9a5eb9972c50eb2ec260bcaa4a5b9b4e
parent729909c07fae4201591e51895833112cb88485e1 (diff)
downloadupstream-b890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a.tar.gz
upstream-b890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a.tar.bz2
upstream-b890e2fbf9211648ad4a74f3e8b47bbf04a3cc7a.zip
prereq-build: replace relative symlinks only if broken
Some programs installed to staging_dir/host/bin also install some symlinks to itself for an alternative name. Some of those new symlinks are overwriting symlinks that were installed by prereq stage. If prereq stage were to somehow be run again, it should not be overwriting symlinks that point to programs that are already built. To filter that out, catch all symlinks after first catching all symlinks that have an absolute target after all other cases in the case statement, make sure it is not broken, and if so exit successfully. Suggested-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> Signed-off-by: Michael Pratt <mcpratt@pm.me>
-rw-r--r--include/prereq.mk5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/prereq.mk b/include/prereq.mk
index c888268d852..546f36b8e3e 100644
--- a/include/prereq.mk
+++ b/include/prereq.mk
@@ -114,6 +114,11 @@ define SetupHostCommand
find "$(STAGING_DIR_HOST)/stamp" | grep $(strip $(1)) && \
[ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
;; \
+ *" -> /"*) \
+ ;; \
+ *" -> "*) \
+ [ -x "$(STAGING_DIR_HOST)/bin/$(strip $(1))" ] && exit 0 \
+ ;; \
esac; \
ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST)/bin/$(strip $(1))"; \
exit 1; \