From a48b5b90cd0d93fabb655d5d1490ce169cc06e24 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 14 Jun 2015 19:36:17 +0200 Subject: find-broken-perl-packages.sh: detect site_perl and better output Signed-off-by: Florian Pritz --- find-broken-perl-packages.sh | 50 +++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 12 deletions(-) (limited to 'find-broken-perl-packages.sh') diff --git a/find-broken-perl-packages.sh b/find-broken-perl-packages.sh index 09c53fa..739cd2f 100755 --- a/find-broken-perl-packages.sh +++ b/find-broken-perl-packages.sh @@ -1,30 +1,56 @@ #!/bin/bash -perllibpath="/usr/lib/perl5/vendor_perl/auto/" + +perllibpath="/usr/lib/perl5/vendor_perl/" +perllocallibpath="/usr/lib/perl5/site_perl/" + +getmodule() { + local path=$1 + local file=$2 + echo $file | sed \ + -e "s|^${path}auto/||" \ + -e "s|^$path||" \ + -e 's|/|::|g' \ + -e 's|.so$||' \ + -e 's|\(.*\)::.*$|\1|' +} tmpdir=$(mktemp -d /tmp/find-broken-perl-package.XXXXXXXX) -touch $tmpdir/{raw,perl-modules}.txt +touch $tmpdir/{local-,}{raw,perl-modules}.txt find "$perllibpath" -name "*.so" | while read file; do - module=$(echo $file | sed \ - -e "s|$perllibpath||" \ - -e 's|/|::|g' \ - -e 's|.so$||' \ - -e 's|\(.*\)::.*$|\1|') - output=$(perl -M$module -e1 2>&1) + module=$(getmodule "$perllibpath" "$file") + output=$(perl -M"$module" -e1 2>&1) ret=$? if (($ret != 0)); then - echo $file >> $tmpdir/raw.txt + 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 $file >> "$tmpdir/raw.txt" echo "$module" >> "$tmpdir/perl-modules.txt" fi done -pacman -Qqo $(<$tmpdir/raw.txt) | sort -u >$tmpdir/pacman.txt -module-to-dist.pl <$tmpdir/perl-modules.txt >$tmpdir/perl-dists.txt +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" + 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" echo "results are in \"$tmpdir\"" +echo " - {local-,}raw.txt is a list of files that caused errors" +echo " - pacman.txt is a list of packages that need to be rebuilt. Those are likely AUR packages" +echo " - local-perl-dists.txt is a list of cpan distributions installed to site_perl. Use cpan to rebuild them" +echo "" +echo "additional files:" +echo " - {local-,}perl-modules.txt is a list of cpan modules that caused errors" +echo " - perl-dists.txt is a list of cpan distributions that caused errors" -- cgit v1.2.3-24-g4f1b