osmith has uploaded this change for review.
buildsystem/gen_links: catch file not found errors
Tweak gen_links() to sequentially iterate over the files for which
symlinks shall be created, and verify that each symlink target exists.
If the target does not exist, abort with an error:
ERROR in bsc/gen_links.sh: file not found
File (from FILES):
SDP_EncDec.cc
DIR:
../deps/titan.Libraries.TCCUsefulFunctions/src
This is slightly slower than the parallel approach from before, but it
prevents adding subtle bugs that don't trigger every time so IMHO the
trade-off is worth it.
Adjust the Makefile to ensure dependencies are fetched before running
gen_links.sh, so the targets are not missing when running this from a
fresh git clone without deps.
Change-Id: I0da0ec30e5eaf65d0348e22900a5ee006dee9e44
---
M Makefile
M _buildsystem/gen_links.inc.sh
2 files changed, 16 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/43/41143/1
diff --git a/Makefile b/Makefile
index 2724dec..1ad357b 100644
--- a/Makefile
+++ b/Makefile
@@ -95,13 +95,13 @@
all: $(foreach dir,$(SUBDIRS),$(dir)/all)
define DIR_Makefile_template
-$(BUILDDIR)/$(1)/Makefile: $(1)/gen_links.sh $(1)/regen_makefile.sh
+$(BUILDDIR)/$(1)/Makefile: $(1)/gen_links.sh $(1)/regen_makefile.sh .make.deps
(cd $(1) && ./gen_links.sh && ./regen_makefile.sh)
endef
define DIR_compile_template
.PHONY: $(1)/compile
-$(1)/compile: deps $(BUILDDIR)/$(1)/Makefile
+$(1)/compile: $(BUILDDIR)/$(1)/Makefile
$(MAKE) -C $(BUILDDIR)/$(1) compile
endef
diff --git a/_buildsystem/gen_links.inc.sh b/_buildsystem/gen_links.inc.sh
index 161754c..b7272e2 100644
--- a/_buildsystem/gen_links.inc.sh
+++ b/_buildsystem/gen_links.inc.sh
@@ -27,9 +27,20 @@
local files="$*"
for f in $files; do
- (ln -sf \
- "$(realpath "$TOPDIR/$PROJECTDIR/$dir/$f")" \
- "$BUILDDIR/$PROJECTDIR/$f") &
+ local target="$(realpath "$TOPDIR/$PROJECTDIR/$dir/$f")"
+ if ! [ -e "$target" ]; then
+ echo
+ echo "ERROR in $PROJECTDIR/gen_links.sh: file not found"
+ echo " File (from FILES):"
+ echo " $f"
+ echo " DIR:"
+ echo " $dir"
+ echo
+ exit 1
+ fi
+ ln -sf \
+ "$target" \
+ "$BUILDDIR/$PROJECTDIR/$f"
done
}
To view, visit change 41143. To unsubscribe, or for help writing mail filters, visit settings.