summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-08-08 16:23:00 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-08-08 16:23:00 +0200
commit259a313c819fef564bf0518a91285e2215cbefdb (patch)
tree99e73b714da7c9a6782545a25534a91894feb8a0
parente50f2a53d718bc3a55162745ffb20464f16601b2 (diff)
downloadbin-259a313c819fef564bf0518a91285e2215cbefdb.tar.gz
bin-259a313c819fef564bf0518a91285e2215cbefdb.tar.xz
improve libdeps scripts a bit
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-xfind-libdeps.sh37
-rwxr-xr-xfind-libprovides.sh32
2 files changed, 56 insertions, 13 deletions
diff --git a/find-libdeps.sh b/find-libdeps.sh
index bfad7c0..e93459a 100755
--- a/find-libdeps.sh
+++ b/find-libdeps.sh
@@ -1,16 +1,38 @@
#!/bin/bash
+set -e
+
+IGNORE_INTERNAL=0
+
+if [[ $1 = "--ignore-internal" ]]; then
+ IGNORE_INTERNAL=1
+ shift
+fi
+
if [[ -z $1 ]]; then
- echo "$(basename "$0") <package file>"
- exit 1
+ echo "$(basename "$0") [options] <package file|extraced package dir>"
+ echo "Options:"
+ echo " --ignore-internal ignore internal libraries"
+ exit 1
fi
-tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX)
-trap "rm -rf '$tmpdir'" EXIT INT TERM
-tar -C $tmpdir -xf "$1"
+cleanup() {
+ if [[ $tmpdir ]]; then
+ rm -rf $tmpdir;
+ fi
+}
-cd $tmpdir
+if [[ -d $1 ]]; then
+ cd $1
+else
+ tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX)
+ trap "cleanup" EXIT INT TERM
+
+ tar -C $tmpdir -xf "$1"
+
+ cd $tmpdir
+fi
in_array() {
local needle=$1; shift
@@ -33,6 +55,9 @@ find . -type f -perm -u+x | while read filename; do
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}"
diff --git a/find-libprovides.sh b/find-libprovides.sh
index 2d9bd52..2005080 100755
--- a/find-libprovides.sh
+++ b/find-libprovides.sh
@@ -1,16 +1,31 @@
-#!/bin/sh
+#!/bin/bash
+
+set -e
+
+IGNORE_INTERNAL=0
+
+if [[ $1 = "--ignore-internal" ]]; then
+ IGNORE_INTERNAL=1
+ shift
+fi
if [[ -z $1 ]]; then
- echo "$(basename "$0") <package file>"
- exit 1
+ echo "$(basename "$0") [options] <package file|extracted package dir>"
+ echo "Options:"
+ echo " --ignore-internal ignore internal libraries"
+ exit 1
fi
-tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX)
-trap "rm -rf '$tmpdir'" EXIT INT TERM
+if [[ -d $1 ]]; then
+ cd $1
+else
+ tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX)
+ trap "rm -rf '$tmpdir'" EXIT INT TERM
-tar -C $tmpdir -xf "$1"
+ tar -C $tmpdir -xf "$1"
-cd $tmpdir
+ cd $tmpdir
+fi
in_array() {
local needle=$1; shift
@@ -35,6 +50,9 @@ do
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}"