4.10.3-2: add gtktreeviewmodel fixes
[arch-packages.git] / perl / trunk / detect-old-perl-modules.sh
blobcdc8df3a52600880ec542c7ccbe51131a6ea8141
1 #!/bin/bash
3 basedir=/usr/lib/perl5
4 perlver=$(perl -e '$v = $^V->{version}; print $v->[0].".".($v->[1]);')
6 dir_empty() {
7 local dir=$1
8 [[ $(find $dir -maxdepth 0 -empty -exec echo empty \;) = "empty" ]] && return 0 || return 1
11 print_unowned_files() {
12 local dir=$1
13 LC_ALL=C find "$dir" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\1/p'
16 for dir in "$basedir/"*; do
17 if [[ "${dir##*/}" != "$perlver" ]]; then
18 if [[ -d "$dir" ]] && ! dir_empty "$dir"; then
19 pkgcount=$(pacman -Qqo "$dir" | wc -l)
20 if ((pkgcount > 0)); then
21 printf "WARNING: '%s' contains data from at least %d packages which will NOT be used by the installed perl interpreter.\n" "$dir" "$pkgcount"
22 printf " -> Run the following command to get a list of affected packages: pacman -Qqo '%s'\n" "$dir"
25 unowned_count=$(print_unowned_files "$dir" | wc -l)
26 if ((unowned_count > 0)); then
27 printf "WARNING: %d file(s) in %s are not tracked by pacman and need to be rebuilt.\n" "$unowned_count" "$dir"
28 printf " -> These were most likely installed directly by cpan or a similar tool.\n"
29 printf " Run the following command to get a list of these files:\n"
30 printf " LC_ALL=C find \"%s\" -type f -exec pacman -Qqo {} + |& sed -n 's/^error: No package owns \(.*\)$/\\\1/p'\n" "$dir"
34 done