Commit bd6341b5 authored by Julien Muchembled's avatar Julien Muchembled

re6st: fail if any subprocess fails while fixing paths in ELF files

This replaces a long pipeline that only failed if the last pipe
command fails. But on Arch, we got the following error:

  xargs: file: terminated by signal 31

and the build continued, pretending it was successful whereas the
package was unusable.

This is similar to bash's pipefail.

Note that 'chrpath -k' exit code is ignored
because it is expected to return 2.
parent 6e9114d0
...@@ -45,10 +45,10 @@ $(DESTDIR)/$(TARGET): $(BUILD)/.installed.cfg ...@@ -45,10 +45,10 @@ $(DESTDIR)/$(TARGET): $(BUILD)/.installed.cfg
cd $@ && $(CURDIR)/cleanup && chmod -R u+w . cd $@ && $(CURDIR)/cleanup && chmod -R u+w .
# Fix paths in files, first ELF, then non-binary # Fix paths in files, first ELF, then non-binary
set -e $(CURDIR)/$(BUILD) /$(TARGET); set $$* "s:\\Q$$1\\E:$$2:g"; \ @set -ex $(CURDIR)/$(BUILD) /$(TARGET); set $$* "s:\\Q$$1\\E:$$2:g"; \
x=`find $@ -type f \( -executable -o -name '*.so*' \) | \ x=`find $@ -type f \( -executable -o -name '*.so*' \)`; x=`file $$x`; \
xargs -r file |sed -n 's/:.*ELF.*\(executable\|shared\).*//p' | \ x=`echo "$$x" |sed -n 's/:.*ELF.*\(executable\|shared\).*//p'`; \
xargs -r chrpath -k |perl -ne "$$3"'; \ x=`chrpath -k $$x |perl -ne "$$3"'; \
s/(.*): R(UN)?PATH=(.*)/chrpath -r $$3 $$1/ and print'`; \ s/(.*): R(UN)?PATH=(.*)/chrpath -r $$3 $$1/ and print'`; \
eval "$$x"; \ eval "$$x"; \
if x=`grep -rIlF $$1 $@`; then \ if x=`grep -rIlF $$1 $@`; then \
......
Markdown is supported
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