2008-07-23 19:36:25 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
#
|
|
|
|
# Author: Isaac Freeman
|
|
|
|
#
|
|
|
|
# Make some wild guesses about what debian perl modules a package requires.
|
|
|
|
# Seems to work so far for xCAT.
|
|
|
|
#
|
|
|
|
# Scans the current directory.
|
|
|
|
#
|
2008-05-05 21:04:10 +00:00
|
|
|
|
|
|
|
found=""
|
|
|
|
|
2008-07-23 19:36:25 +00:00
|
|
|
# Warning: voodoo ahead
|
|
|
|
|
2008-05-05 21:04:10 +00:00
|
|
|
find . -name .svn -prune -o -type f \
|
|
|
|
| xargs grep -l '^#!.*perl' \
|
|
|
|
| xargs grep -hE '^\s*(use|require) ' \
|
|
|
|
| while read mod; do
|
|
|
|
pkg=$( awk '{ sub(";", "", $2);
|
2008-05-08 20:54:15 +00:00
|
|
|
gsub("::", "-", $2);
|
2008-05-05 21:04:10 +00:00
|
|
|
print $2 }' <<<"$mod" \
|
|
|
|
| tr '[:upper:]' '[:lower:]' )
|
|
|
|
|
2008-07-23 19:36:25 +00:00
|
|
|
pkgname="lib${pkg}-perl"
|
2008-05-05 21:04:10 +00:00
|
|
|
|
2008-07-23 19:36:25 +00:00
|
|
|
if apt-cache show $pkgname >/dev/null 2>&1; then
|
2008-05-05 21:04:10 +00:00
|
|
|
|
|
|
|
case "$found" in
|
|
|
|
*$pkgname*) continue ;;
|
|
|
|
*)
|
|
|
|
[ -n "$found" ] && echo -n ", "
|
|
|
|
echo -n "$pkgname"
|
|
|
|
found="$found $pkgname"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
elif perl <<<"$mod" >/dev/null 2>&1; then
|
2008-07-23 19:36:25 +00:00
|
|
|
# Blindly assume that if perl doesn't complain about this, that its
|
|
|
|
# built-in to or ships with perl.
|
2008-05-05 21:04:10 +00:00
|
|
|
continue
|
|
|
|
elif [ "$1" == "-w" ]; then
|
|
|
|
echo
|
|
|
|
echo "warning: $pkg not found and perl doesn't like \"$mod\"" >&2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
|
|
|
|
# vim: set sts=2 sw=2 et:
|