summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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}"