diff options
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/flx-tools.eclass | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/eclass/flx-tools.eclass b/eclass/flx-tools.eclass new file mode 100644 index 00000000..db6f99a7 --- /dev/null +++ b/eclass/flx-tools.eclass @@ -0,0 +1,115 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# +# Original Author: root +# Purpose: +# + +HOMEPAGE="http://formilux.org" + +function unpack_plist () +{ + [ $# -ne 2 ] \ + && die "unpack_plist <category> <dst>" + + local cat=$1 + local dst="$2" + + [ ! -d "$dst" ] \ + && mkdir -p "$dst" + + local t + [ -e "$PORTAGE_CONFIGROOT/etc/portage/plist/${cat}/transform" ] \ + && t=( + $(< $PORTAGE_CONFIGROOT/etc/portage/plist/${cat}/transform) + ) + + find "$PORTAGE_CONFIGROOT/etc/portage/plist/${cat}" \ + -mindepth 2 -maxdepth 2 \ + -type f -printf '%P\n' | sort \ + | while read ; do + [ "$(best_version ~$REPLY)" != "$REPLY" ] \ + && ewarn "You should update $PORTAGE_CONFIGROOT/etc/portage/plist/${cat}/$REPLY" + + [ ! -e "$PKGDIR/${REPLY}.tbz2" ] \ + && die "Can't find $PKGDIR/${REPLY}.tbz2" + + einfo "Extracting ${REPLY} ..." + qtbz2 --tarbz2 -O "$PKGDIR/${REPLY}.tbz2" \ + | tar xvpj --atime-preserve --show-transformed-names \ + -C "$dst" \ + -T "$PORTAGE_CONFIGROOT/etc/portage/plist/${cat}/${REPLY}" \ + ${t[@]/#/--transform } \ + | while read ; do + einfo " $REPLY" + done + done +} + +function check_symbol () +{ + [ $# -ne 1 ] \ + && die "chk_dep <fs dir>" + + local dir="$1" + [ ! -d "$dir" ] \ + && die "fs dir $dir does not exist" + + mkdir NEEDED SONAME + einfo "Checking NEEDED and SONAME mismatches ..." + + scanelf -RqBn "$dir" \ + | sed -e "s;$dir/;;" \ + | awk '{ + size=split($1,libs,",") + for (i = 1 ; i <= size ; i++) { + print $2 >> "'NEEDED/'"libs[i] + } + }' + + scanelf -RqBS "$dir" \ + | sed -e "s;dir/;;" \ + | awk '{ + size=split($1,libs,",") + for (i = 1 ; i <= size ; i++) { + print $2 >> "'SONAME/'"libs[i] + } + }' + + diff -Nu \ + <(find SONAME -mindepth 1 \ + -printf '%f\n' \ + | sort) \ + <(find NEEDED -mindepth 1 \ + -printf '%f\n' \ + | sort) \ + | egrep '^(\-|\+)[a-zA-Z0-9]' \ + | while read ; do + case ${REPLY:0:1} in + -) ewarn "${REPLY:1} is needed by nothing" ;; + +) ewarn "${REPLY:1} is missing but needed by :" + cat NEEDED/${REPLY:1} + ;; + esac + done + +# | fgrep -v \ +# -f /etc/portage/crossdev/libdl.lst \ +# -f /etc/portage/crossdev/lib-nosoname.lst \ +} + +function big_compress () +{ + [ $# -ne 1 ] \ + && die "big_compress <dir>" + + find ${1} -type d -name bin -or -name sbin \ + | xargs --no-run-if-empty -I {} -- \ + find {} -type f \ + | xargs --no-run-if-empty -- \ + scanelf -mBF '%F' \ + | xargs --no-run-if-empty -- \ + sstrip -z +} |