diff --git a/ShellB3/sb3bin/thosewhohuntelfs.py b/ShellB3/sb3bin/thosewhohuntelfs.py index 04585f8b8a40100057a7f6cba4d25e0ea4543f08..4d79f0a3351f4702817085843807743cc47eb2b5 100755 --- a/ShellB3/sb3bin/thosewhohuntelfs.py +++ b/ShellB3/sb3bin/thosewhohuntelfs.py @@ -356,7 +356,12 @@ def hunt_elfs(base, exclude_stripped=False, elvish=True): follows OPTS.exclude if it's non-empty, using it as an exclusion regex by default, excludes stripped ELFs since we can't do anything with them """ - exclude = re.compile(OPTS.exclude_re) if OPTS.exclude_re else None + if OPTS.exclude_re is None: + exclude = None + elif len(OPTS.exclude_re)==1: + exclude = re.compile(OPTS.exclude_re[0]) + else: + exclude = re.compile("|".join([("(?:"+x+")") for x in OPTS.exclude_re])) for (path, dirs, files) in os.walk(base): for fn in files: pn = os.path.join(path, fn) @@ -618,7 +623,7 @@ python thosewhohuntelfs.py . common/lib lib --exclude='.*?build/.*' --dry-run -- action="store_true", default=False, help="show what commands would be done") parser.add_option('-v', '--verbose', dest='verbosity', action="count", default=0, help='each occurrence increases verbosity 1 level through ERROR-WARNING-INFO-DEBUG') - parser.add_option('-x', '--exclude', dest='exclude_re', + parser.add_option('-x', '--exclude', dest='exclude_re', action="append", help='regular expression for pathnames to exclude, optional') parser.add_option('-p', '--patchelf', dest='patchelf', default='sb3bin/patchelf', help='location of patchelf (Linux)') diff --git a/ShellB3/shallbethree.sh b/ShellB3/shallbethree.sh index b6ff2e845bbed514098b2cd8a9546646fb297448..54db1d0c68618fef7892027826cf0554c5ade19e 100755 --- a/ShellB3/shallbethree.sh +++ b/ShellB3/shallbethree.sh @@ -2593,16 +2593,16 @@ _forbidden_libraries(){ if buildPortable ; then export IGNORE_PIP=YES IGNORE_REL=YES if isLinux ; then - _find_cots BZ2LIB include/bzlib.h $BASE $COTS_HOME ${SYSROOT}/usr && [ ${BZ2LIB} != "${BASE}" ] && echo "Portability suggests bzlib headers be uninstalled (will build)" && unset BZ2LIB - _find_cots SSLLIB include/openssl/ssl.h $BASE $COTS_HOME ${SYSROOT}/usr && [ ${SSLLIB} != "${BASE}" ] && echo "Portability suggests openssl headers be uninstalled (will build)" && unset SSLLIB + _find_cots BZ2LIB include/bzlib.h $BASE $COTS_HOME ${SYSROOT}/usr >& /dev/null && [ ${BZ2LIB} != "${BASE}" ] && unset BZ2LIB + _find_cots SSLLIB include/openssl/ssl.h $BASE $COTS_HOME ${SYSROOT}/usr >& /dev/null && [ ${SSLLIB} != "${BASE}" ] && unset SSLLIB if isTrue USE_PORTABLE_NCURSES ; then - _find_cots NCURSES include/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr && [ ${NCURSES} != "${BASE}" ] && echo 'Portability suggests ncurses headers be uninstalled (will build)' && unset NCURSES + _find_cots NCURSES include/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr >& /dev/null && [ ${NCURSES} != "${BASE}" ] && unset NCURSES else - _find_cots NCURSES include/ncurses/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr && [ ${NCURSES} != "${BASE}" ] && echo 'Portability suggests ncurses headers be uninstalled (will build)' && unset NCURSES + _find_cots NCURSES include/ncurses/ncurses.h $BASE $COTS_HOME ${SYSROOT}/usr >& /dev/null && [ ${NCURSES} != "${BASE}" ] && unset NCURSES fi [ -z "${NCURSES}" ] && export RET_FORBIDDENLIBS="$RET_FORBIDDENLIBS,libncurses" [ -z "${BZ2LIB}" ] && export RET_FORBIDDENLIBS="$RET_FORBIDDENLIBS,libbz2" - [ -z "${SSLLIB}" ] && export RET_FORBIDDENLIBS="$RET_FORBIDDENLIBS,libssl" + [ -n "${SSLLIB}" ] || [ -e build/.bundled_abi ] || export RET_FORBIDDENLIBS="$RET_FORBIDDENLIBS,libssl" fi fi ${ANYPYTHON} - ${FORBIDDENLIBS},${RET_FORBIDDENLIBS},${SYS_FORBIDDENLIBS} <<SCRIPT @@ -9815,7 +9815,8 @@ bundle_elfs() { _pydling $elf requires done # fix RPATHs on ELF binaries, excluding libstdc++ and libgfortran - ${PYTHON} sb3bin/thosewhohuntelfs.py . lib $( is64Bit && echo lib64 ) "$@" --patchelf=${PATCHELF}/patchelf --exclude='(?:.*?build/.*)|(?:.*?lib/libgfort.*)|(?:.*?lib/libstdc.*)' || oops "could not make binary bundle relocatable" + ${PYTHON} sb3bin/thosewhohuntelfs.py . lib $( is64Bit && echo lib64 ) "$@" --patchelf=${PATCHELF}/patchelf \ + --exclude='(?:.*?build/.*)|(?:.*?lib/libgfort.*)|(?:.*?lib/libstdc.*)' || oops "could not make binary bundle relocatable" return 0 } @@ -9825,7 +9826,7 @@ scan_elfs() { resume_tracker _find_cots PATCHELF patchelf $BASE/bin $BASE/sysbin $COTS_HOME/bin ${SYSROOT}/usr/bin || oops "No patchelf found" ${PYTHON} sb3bin/thosewhohuntelfs.py . --ldd --patchelf=${PATCHELF}/patchelf --exclude='.*?build/.*' \ - $(if [ -e build/.ignore_elf_scan ] ; then for x in "$(cat build/.ignore_elf_scan)" ; do echo "--exclude=.*/$x" ; done; fi) \ + $(if [ -e build/.ignore_elf_scan ] ; then for x in $(cat build/.ignore_elf_scan) ; do echo "--exclude=.*/$x" ; done; fi) \ --forbidden="$(_forbidden_libraries)" || oops "could not make binary bundle relocatable" }