tazpkg diff modules/find-depends @ rev 830
Module "info": fix packages.info absence; check available upgrades for installed packages.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Wed Aug 12 13:49:16 2015 +0300 (2015-08-12) |
parents | f7e9a5b8477b |
children | a02e36d44d06 |
line diff
1.1 --- a/modules/find-depends Sat Jul 25 16:50:18 2015 +0300 1.2 +++ b/modules/find-depends Wed Aug 12 13:49:16 2015 +0300 1.3 @@ -1,7 +1,7 @@ 1.4 #!/bin/sh 1.5 -# /usr/lib/tazpkg/tazpkg-find-depends: this program is a part of TazPkg. 1.6 -# This file contains the functions that are common to tazpkg and tazpkg-convert, 1.7 -# and sourced by them. 1.8 +# TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg 1.9 +# find-depends - TazPkg module 1.10 +# Functions that are common to tazpkg and tazpkg-convert, and sourced by them. 1.11 1.12 1.13 # Need by check_depends 1.14 @@ -10,40 +10,37 @@ 1.15 1.16 # Check for ELF file 1.17 1.18 -is_elf() 1.19 -{ 1.20 - [ "$(dd if="$1" bs=1 skip=1 count=3 2>/dev/null)" == "ELF" ] 1.21 +is_elf() { 1.22 + [ "$(dd if="$1" bs=1 skip=1 count=3 2>/dev/null)" == 'ELF' ] 1.23 } 1.24 1.25 1.26 # Print shared library dependencies 1.27 1.28 -ldd() 1.29 -{ 1.30 +ldd() { 1.31 LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so "$1" 2>/dev/null 1.32 } 1.33 1.34 1.35 # search dependencies for files in $TMP_DIR/$file/fs 1.36 1.37 -find_depends() 1.38 -{ 1.39 - DEFAULT_DEPENDS="glibc-base gcc-lib-base" 1.40 +find_depends() { 1.41 + DEFAULT_DEPENDS='glibc-base gcc-lib-base' 1.42 1.43 - [ -n "$TMPLOCALSTATE" ] || TMPLOCALSTATE=$PKGS_DB 1.44 - [ -f $TMPLOCALSTATE/files.list.lzma ] || tazpkg recharge >/dev/null 1.45 + [ -z "$TMPLOCALSTATE" ] && TMPLOCALSTATE="$PKGS_DB" 1.46 + [ ! -f "$TMPLOCALSTATE/files.list.lzma" ] && tazpkg recharge >/dev/null 1.47 for i in $TMPLOCALSTATE/files.list.lzma \ 1.48 $TMPLOCALSTATE/undigest/*/files.list.lzma ; do 1.49 - [ -f $i ] && lzma d $i -so >> $TMP_DIR/files.list 1.50 + [ -f "$i" ] && lzma d $i -so >> $TMP_DIR/files.list 1.51 done 1.52 1.53 - echo "Find depends..." 1>&2 1.54 - libs_found="" 1.55 + _ 'Find depends...' 1>&2 1.56 + libs_found='' 1.57 find ${1:-$TMP_DIR/$file/fs} -type f | \ 1.58 while read chkfile ; do 1.59 is_elf "$chkfile" || continue 1.60 case "$chkfile" in 1.61 - *.o|*.ko|*.ko.gz) continue;; 1.62 + *.o|*.ko|*.ko.gz|*.ko.xz) continue;; 1.63 esac 1.64 1.65 for lib in $(ldd "$chkfile" | sed '/=>/!d;s/ =>.*//') ; do 1.66 @@ -56,7 +53,9 @@ 1.67 esac 1.68 find ${1:-$TMP_DIR/$file/fs} | grep -q /$lib$ && continue 1.69 1.70 - echo -ne "for $lib \r" 1>&2 1.71 + _n 'for %s' "$lib" 1>&2 1.72 + echo -ne " \r" 1>&2 1.73 + 1.74 for dep in $(fgrep $lib files.list | cut -d: -f1); do 1.75 case " $DEFAULT_DEPENDS " in 1.76 *\ $dep\ *) continue 2;; 1.77 @@ -73,12 +72,12 @@ 1.78 done 1.79 done 1.80 1.81 - spc="" 1.82 - [ -s $TMP_DIR/depends ] && 1.83 + spc='' 1.84 + [ -s "$TMP_DIR/depends" ] && 1.85 sort < $TMP_DIR/depends 2>/dev/null | uniq | \ 1.86 while read file; do 1.87 echo -n "$spc$file" 1.88 - spc=" " 1.89 + spc=' ' 1.90 done 1.91 } 1.92