From 9726797027faa90ebc02fcc1b1f32e71158e11b0 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Thu, 17 Nov 2011 23:31:50 +0100 Subject: find-lib* moved to devtools Signed-off-by: Florian Pritz --- find-libdeps.sh | 67 ----------------------------------------------------- find-libprovides.sh | 63 ------------------------------------------------- 2 files changed, 130 deletions(-) delete mode 100755 find-libdeps.sh delete mode 100755 find-libprovides.sh diff --git a/find-libdeps.sh b/find-libdeps.sh deleted file mode 100755 index 4122c2b..0000000 --- a/find-libdeps.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash - -set -e - -IGNORE_INTERNAL=0 - -if [[ $1 = "--ignore-internal" ]]; then - IGNORE_INTERNAL=1 - shift -fi - -if [[ -z $1 ]]; then - echo "$(basename "$0") [options] " - echo "Options:" - echo " --ignore-internal ignore internal libraries" - exit 1 -fi - - -cleanup() { - if [[ $tmpdir ]]; then - rm -rf $tmpdir; - fi -} - -if [[ -d $1 ]]; then - cd $1 -else - tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX) - trap "cleanup" EXIT INT TERM - - bsdtar -C $tmpdir -xf "$1" - - cd $tmpdir -fi - -in_array() { - local needle=$1; shift - [[ -z $1 ]] && return 1 # Not Found - local item - for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found - done - return 1 # Not Found -} - -find . -type f -perm -u+x | while read filename; do - # get architecture of the file; if soarch is empty it's not an ELF binary - soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') - [ -n "$soarch" ] || continue - # process all libraries needed by the binary - for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p') - do - # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" - # extract the major version: 1 - soversion="${sofile##*\.so\.}" - if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then - continue - fi - if ! in_array "${soname}=${soversion}-${soarch}" ${sodepends[@]}; then - # libfoo.so=1-64 - echo "${soname}=${soversion}-${soarch}" - sodepends=(${sodepends[@]} "${soname}=${soversion}-${soarch}") - fi - done -done diff --git a/find-libprovides.sh b/find-libprovides.sh deleted file mode 100755 index cfd6f6c..0000000 --- a/find-libprovides.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/bash - -set -e - -IGNORE_INTERNAL=0 - -if [[ $1 = "--ignore-internal" ]]; then - IGNORE_INTERNAL=1 - shift -fi - -if [[ -z $1 ]]; then - echo "$(basename "$0") [options] " - echo "Options:" - echo " --ignore-internal ignore internal libraries" - exit 1 -fi - -if [[ -d $1 ]]; then - cd $1 -else - tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX) - trap "rm -rf '$tmpdir'" EXIT INT TERM - - bsdtar -C $tmpdir -xf "$1" --include="*.so*" - - cd $tmpdir -fi - -in_array() { - local needle=$1; shift - [[ -z $1 ]] && return 1 # Not Found - local item - for item in "$@"; do - [[ $item = $needle ]] && return 0 # Found - done - return 1 # Not Found -} -find . -type f -name \*.so\* | while read filename -do - # check if we really have a shared object - if LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then - # 64 - soarch=$(LC_ALL=C readelf -h "$filename" | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') - # get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1 - sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') - [ -z "$sofile" ] && sofile="${filename##*/}" - - # extract the library name: libfoo.so - soname="${sofile%%\.so\.*}.so" - # extract the major version: 1 - soversion="${sofile##*\.so\.}" - if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then - continue - fi - if ! in_array "${soname}=${soversion}-${soarch}" ${soprovides[@]}; then - # libfoo.so=1-64 - echo "${soname}=${soversion}-${soarch}" - soprovides=(${soprovides[@]} "${soname}=${soversion}-${soarch}") - fi - fi -done - -- cgit v1.2.3-24-g4f1b