summaryrefslogtreecommitdiffstats
path: root/find-broken-perl-packages.sh
blob: d0aac570cd02515172066364a1a2abe007846b1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
perllibpath="/usr/lib/perl5/vendor_perl/auto/"

tmpdir=$(mktemp -d /tmp/find-broken-perl-package.XXXXXXXX)
touch $tmpdir/{raw,perl-modules}.txt
find "$perllibpath" -name "*.so" |
 sed \
 -e "s|$perllibpath||" \
 -e 's|/|::|g' \
 -e 's|.so$||' \
 -e 's|\(.*\)::.*$|\1|' |
	while read module; do
		output=$(perl -M$module -e1 2>&1)
		if 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
		fi
	done

pacman -Qqo $(<$tmpdir/raw.txt) &> $tmpdir/pacman.txt

echo "tempdir is \"$tmpdir\""