diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-06-15 09:37:55 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-06-15 09:37:55 +0200 |
commit | 1721bd7db1775fe7df3de1837af53f5689c35ab4 (patch) | |
tree | b45ce7bd985f3f4853aeb3b86a6d7eca4e53e463 /find-broken-perl-packages.sh | |
parent | a48b5b90cd0d93fabb655d5d1490ce169cc06e24 (diff) | |
download | bin-1721bd7db1775fe7df3de1837af53f5689c35ab4.tar.gz bin-1721bd7db1775fe7df3de1837af53f5689c35ab4.tar.xz |
find-broken-perl-packages.sh: Check local modules for failures
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'find-broken-perl-packages.sh')
-rwxr-xr-x | find-broken-perl-packages.sh | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/find-broken-perl-packages.sh b/find-broken-perl-packages.sh index 739cd2f..c6ff501 100755 --- a/find-broken-perl-packages.sh +++ b/find-broken-perl-packages.sh @@ -14,37 +14,43 @@ getmodule() { -e 's|\(.*\)::.*$|\1|' } +testmodule() { + local module=$1 + local prefix=$2 + local output=$(perl -M"$module" -e1 2>&1) + local ret=$? + if (($ret != 0)); then + echo $file >> "$tmpdir/${prefix}raw.txt" + echo "$module" >> "$tmpdir/${prefix}perl-modules.txt" + elif grep -q "perl: symbol lookup error:" <<< $output; then + sed -n 's|perl: symbol lookup error: \(.*\): undefined symbol: .*|\1|p' <<< $output >> "$tmpdir/${prefix}raw.txt" + echo "$module" >> "$tmpdir/${prefix}perl-modules.txt" + elif grep -q "Perl API version .* of .* does not match .*" <<< $output; then + echo $file >> "$tmpdir/${prefix}raw.txt" + echo "$module" >> "$tmpdir/${prefix}perl-modules.txt" + fi +} + tmpdir=$(mktemp -d /tmp/find-broken-perl-package.XXXXXXXX) touch $tmpdir/{local-,}{raw,perl-modules}.txt + find "$perllibpath" -name "*.so" | while read file; do module=$(getmodule "$perllibpath" "$file") - output=$(perl -M"$module" -e1 2>&1) - ret=$? - if (($ret != 0)); then - echo $file >> "$tmpdir/raw.txt" - echo "$module" >> "$tmpdir/perl-modules.txt" - elif grep -q "perl: symbol lookup error:" <<< $output; then - sed -n 's|perl: symbol lookup error: \(.*\): undefined symbol: .*|\1|p' <<< $output >> $tmpdir/raw.txt - echo "$module" >> "$tmpdir/perl-modules.txt" - elif grep -q "Perl API version .* of .* does not match .*" <<< $output; then - echo $file >> "$tmpdir/raw.txt" - echo "$module" >> "$tmpdir/perl-modules.txt" - fi + testmodule "$module" "" done if [[ -d $perllocallibpath ]]; then find "$perllocallibpath" -name "*.so" | while read file; do - module=$(getmodule "$perllibpath" "$file") - echo "$file" >"$tmpdir/local-raw.txt" - echo "$module" >"$tmpdir/local-perl-dists.txt" + module=$(getmodule "$perllocallibpath" "$file") + testmodule "$module" "local-" done -module-to-dist.pl <"$tmpdir/local-perl-modules.txt" >"$tmpdir/local-perl-dists.txt" fi pacman -Qqo $(<"$tmpdir/raw.txt") | sort -u >"$tmpdir/pacman.txt" module-to-dist.pl <"$tmpdir/perl-modules.txt" >"$tmpdir/perl-dists.txt" +module-to-dist.pl <"$tmpdir/local-perl-modules.txt" >"$tmpdir/local-perl-dists.txt" echo "results are in \"$tmpdir\"" echo " - {local-,}raw.txt is a list of files that caused errors" |