tazpkg diff modules/find-depends @ rev 846

Remove "busybox" "prefixes" (thanks llev)
We used "busybox wget", etc. to be sure we called Busybox's "wget", not any other "wget". Workaround already done in "getenv" module.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Oct 09 13:14:01 2015 +0300 (2015-10-09)
parents a02e36d44d06
children 3af642cd5e69
line diff
     1.1 --- a/modules/find-depends	Fri Aug 28 16:10:34 2015 +0300
     1.2 +++ b/modules/find-depends	Fri Oct 09 13:14:01 2015 +0300
     1.3 @@ -4,48 +4,31 @@
     1.4  # Functions that are common to tazpkg and tazpkg-convert, and sourced by them.
     1.5  
     1.6  
     1.7 -# Need by check_depends
     1.8 -unset TMPLOCALSTATE
     1.9 -
    1.10 -
    1.11 -# Check for ELF file
    1.12 -
    1.13 -is_elf() {
    1.14 -	[ "$(dd if="$1" bs=1 skip=1 count=3 2>/dev/null)" == 'ELF' ]
    1.15 -}
    1.16 -
    1.17 -
    1.18 -# Print shared library dependencies
    1.19 -
    1.20 -ldd() {
    1.21 -	LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so "$1" 2>/dev/null
    1.22 -}
    1.23 -
    1.24 -
    1.25  # search dependencies for files in $TMP_DIR/$file/fs
    1.26  
    1.27  find_depends() {
    1.28  	DEFAULT_DEPENDS='glibc-base gcc-lib-base'
    1.29  
    1.30 -	[ -z "$TMPLOCALSTATE" ] && TMPLOCALSTATE="$PKGS_DB"
    1.31 -	[ ! -f "$TMPLOCALSTATE/files.list.lzma" ] && tazpkg recharge >/dev/null
    1.32 -	for i in "$TMPLOCALSTATE/files.list.lzma" \
    1.33 -		"$TMPLOCALSTATE/undigest/"*"/files.list.lzma"; do
    1.34 +	[ ! -f "$PKGS_DB/files.list.lzma" ] && tazpkg recharge >/dev/null
    1.35 +
    1.36 +	for i in "$PKGS_DB/files.list.lzma" \
    1.37 +		"$PKGS_DB/undigest/"*"/files.list.lzma"; do
    1.38  		[ -f "$i" ] && lzma d "$i" -so >> "$TMP_DIR/files.list"
    1.39  	done
    1.40  
    1.41  	_ 'Find depends...' 1>&2
    1.42  	libs_found=''
    1.43 -	find "${1:-$TMP_DIR/$file/fs}" -type f | \
    1.44 +	find "$1" -type f | \
    1.45  	while read chkfile; do
    1.46 -		is_elf "$chkfile" || continue
    1.47 +		[ "$(dd bs=1 skip=1 count=3 < "$chkfile" 2>/dev/null)" != 'ELF' ] && continue
    1.48 +
    1.49  		case "$chkfile" in
    1.50  			*.o|*.ko|*.ko.gz|*.ko.xz) continue;;
    1.51  		esac
    1.52  
    1.53 -		for lib in $(ldd "$chkfile" | sed '/=>/!d;s/ =>.*//'); do
    1.54 +		for lib in $(LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so "$chkfile" 2>/dev/null | sed '/=>/!d;s/ =>.*//'); do
    1.55  			case " $libs_found " in
    1.56 -				*\ $lib\ *) continue
    1.57 +				*\ $lib\ *) continue;;
    1.58  			esac
    1.59  			libs_found="$libs_found $lib"
    1.60  			case "$lib" in
    1.61 @@ -54,9 +37,9 @@
    1.62  			find "${1:-$TMP_DIR/$file/fs}" | grep -q /$lib$ && continue
    1.63  
    1.64  			_n 'for %s' "$lib" 1>&2
    1.65 -			echo -ne "                   \r" 1>&2
    1.66 +			echo -ne '                   \r' 1>&2
    1.67  
    1.68 -			for dep in $(fgrep $lib files.list | cut -d: -f1); do
    1.69 +			for dep in $(fgrep "$lib" "$TMP_DIR/files.list" | cut -d: -f1); do
    1.70  				case " $DEFAULT_DEPENDS " in
    1.71  					*\ $dep\ *) continue 2;;
    1.72  				esac