laforge submitted this change.

View Change

Approvals: Jenkins Builder: Verified laforge: Looks good to me, approved fixeria: Looks good to me, but someone else must approve
buildsystem/gen_links: catch broken symlinks

Tweak gen_links() to verify that each symlink target exists. If the
target does not exist, abort with an error:

ERROR in msc/gen_links.sh:

File not found:
../deps/titan.Libraries.TCCUsefulFunctions/src/TCCOpenSecurity_Functions.hh

Section:
DIR=../deps/titan.Libraries.TCCUsefulFunctions/src
FILES="…TCCOpenSecurity_Functions.hh…"
gen_links $DIR $FILES

This is slightly slower than the previous approach (which did not check
if the symlink target exists). But this prevents adding subtle bugs
that may not trigger every time (see 520ac3ab ("*/gen_links.sh: fix
wrong SDP_EncDec.cc symlink")).

Change-Id: I0da0ec30e5eaf65d0348e22900a5ee006dee9e44
---
M _buildsystem/gen_links.inc.sh
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/_buildsystem/gen_links.inc.sh b/_buildsystem/gen_links.inc.sh
index 161754c..42f01b1 100644
--- a/_buildsystem/gen_links.inc.sh
+++ b/_buildsystem/gen_links.inc.sh
@@ -27,9 +27,24 @@
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:"
+ echo
+ echo " File not found:"
+ echo " $dir/$f"
+ echo
+ echo " Section:"
+ echo " DIR=$dir"
+ echo " FILES=\"…$f…\""
+ echo " gen_links \$DIR \$FILES"
+ 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.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I0da0ec30e5eaf65d0348e22900a5ee006dee9e44
Gerrit-Change-Number: 41143
Gerrit-PatchSet: 2
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: laforge <laforge@osmocom.org>