Skip to content
Snippets Groups Projects
Verified Commit b529f1aa authored by Petr Špaček's avatar Petr Špaček
Browse files

kres-gen: improve debugability in case of missing files or symbols

parent c3a754dd
Branches
Tags
1 merge request!830Nitpicks in Lua binding generation + pkt DO read operation
......@@ -7,15 +7,24 @@ CDEFS="../../scripts/gen-cdefs.sh"
LIBKRES="${MESON_BUILD_ROOT}/lib/libkres.so"
KRESD="${MESON_BUILD_ROOT}/daemon/kresd"
for REQFILE in "$CDEFS" "$LIBKRES" "$KRESD"
do
test '!' -s "$REQFILE" -a -r "$REQFILE" \
&& echo "Required file $REQFILE cannot be read, did you build binaries and shared libraries?" \
&& exit 1
done
# Write to kres-gen.lua instead of stdout
mv kres-gen.lua{,.bak} ||:
exec 1>&-
exec 1<>kres-gen.lua
exec 5<&1- # move stdout into FD 5
exec 1<>kres-gen.lua # replace stdout with file
restore() {
exec 1>&-
mv kres-gen.lua{.bak,} ||:
(>&2 echo "Failed to re-generate kres-gen.lua! Missing debugsymbols?")
exec 1>&- # close stdout redirected into kres-gen.lua
exec 1<&5- # restore original stdout
mv -v kres-gen.lua{,.fail} ||:
mv -v kres-gen.lua{.bak,} ||:
(>&2 echo "Failed to re-generate kres-gen.lua! Missing debugsymbols? Missing shared library?")
}
trap restore ERR INT TERM
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment