# HG changeset patch # User Pascal Bellard # Date 1236769250 0 # Node ID e453ccdea454a9996697d82ac17d8c7d957366f8 # Parent b3780d73c463e6864716f6d29510b736b7079e75 Add check-depends diff -r b3780d73c463 -r e453ccdea454 tazwok --- a/tazwok Fri Feb 13 00:10:08 2009 +0100 +++ b/tazwok Wed Mar 11 11:00:50 2009 +0000 @@ -93,6 +93,7 @@ info Get information about a package in the wok. check Check every receipt for common errors. check-log Check the process log file of a package. + check-depends Check every receipt for DEPENDS misses scanning ELF files search Search for a package in the wok by pattern or name. compile Configure and build a package using the receipt rules. genpkg Generate a suitable package for Tazpkg with the rules. @@ -694,6 +695,76 @@ done done ;; + check-depends) + # Check package depends + echo "" + echo -e "\033[1mCheck every receipt for DEPENDS misses scanning ELF files\033[0m +================================================================================" + TMPDIR=/tmp/tazwok$$ + DEFAULT_DEPENDS="glibc-base gcc-lib-base" + + # Build ALL_DEPENDS variable + scan_dep() + { + local i + ALL_DEPENDS="$ALL_DEPENDS$PACKAGE " + for i in $DEPENDS ; do + case " $ALL_DEPENDS " in + *\ $i\ *) continue;; + esac + [ -d $WOK/$i ] || continue + . $WOK/$i/receipt + scan_dep + done + } + + # Check for ELF file + is_elf() + { + [ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" \ + = "ELF" ] + } + + # Print shared library dependencies + ldd() + { + LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $1 + } + + mkdir $TMPDIR + cd $TMPDIR + for i in /var/lib/tazpkg/files.list.lzma \ + /var/lib/tazpkg/undigest/*/files.list.lzma ; do + [ -f $i ] && lzma d $i -so >> files.list + done + for pkg in $PACKAGES_REPOSITORY/*.tazpkg ; do + tazpkg extract $pkg > /dev/null 2>&1 + . */receipt + ALL_DEPENDS="$DEFAULT_DEPENDS " + scan_dep + find */fs -type f | while read file ; do + is_elf $file || continue + case "$file" in + *.o|*.ko|*.ko.gz) continue;; + esac + ldd $file | while read lib rem; do + case "$lib" in + linux-gate.so*|ld-*.so|*/ld-*.so) + continue;; + esac + for dep in $(grep $lib files.list | cut -d: -f1); do + case " $ALL_DEPENDS " in + *\ $dep\ *) continue 2;; + esac + done + echo "$(basename $pkg): ${file#*fs} depends on package $dep for the shared library $lib" + done + done + rm -rf */ + done + cd /tmp + rm -rf $TMPDIR + ;; check) # Check wok consistancy echo ""