perl-packages.sh 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. perllibpath="/usr/lib/perl5/vendor_perl/auto/"
  3. tmpdir=$(mktemp -d /tmp/find-broken-perl-package.XXXXXXXX)
  4. touch $tmpdir/{raw,perl-modules}.txt
  5. find "$perllibpath" -name "*.so" |
  6. while read file; do
  7. module=$(echo $file | sed \
  8. -e "s|$perllibpath||" \
  9. -e 's|/|::|g' \
  10. -e 's|.so$||' \
  11. -e 's|\(.*\)::.*$|\1|')
  12. output=$(perl -M$module -e1 2>&1)
  13. ret=$?
  14. if (($ret != 0)); then
  15. echo $file >> $tmpdir/raw.txt
  16. echo "$module" >> "$tmpdir/perl-modules.txt"
  17. elif grep -q "perl: symbol lookup error:" <<< $output; then
  18. sed -n 's|perl: symbol lookup error: \(.*\): undefined symbol: .*|\1|p' <<< $output >> $tmpdir/raw.txt
  19. echo "$module" >> "$tmpdir/perl-modules.txt"
  20. elif grep -q "Perl API version .* of .* does not match .*" <<< $output; then
  21. echo $file >> $tmpdir/raw.txt
  22. echo "$module" >> "$tmpdir/perl-modules.txt"
  23. fi
  24. done
  25. pacman -Qqo $(<$tmpdir/raw.txt) | sort -u >$tmpdir/pacman.txt
  26. module-to-dist.pl <$tmpdir/perl-modules.txt >$tmpdir/perl-dists.txt
  27. echo "results are in \"$tmpdir\""