Created
March 14, 2012 16:40
-
-
Save bluegraybox/2037760 to your computer and use it in GitHub Desktop.
Find cpanm modules that failed to install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Report on modules that failed to install. | |
# | |
# Look for various "FAIL" messages in the cpanm build.log files. | |
# (FIXME: Explain the difference, and what they mean.) | |
# Parse out the module names and report any that are not installed. | |
logs=$HOME/.cpanm/work/*/build.log | |
function missing () { | |
mod=${2:-$1} | |
missing=$(perl -e "use $mod;" 2>&1) | |
test -z "$missing" || echo " missing $mod" | |
} | |
function get_mods () { | |
grep -h "$1" $logs | sort | uniq | cut -d ' ' -f $2 | uniq | |
} | |
# -> FAIL Installing CPAN::Meta failed. See /home/colin/.cpanm/build.log for details. | |
msg="FAIL Installing" | |
echo "$msg:" | |
failed=$(get_mods "$msg" 4) | |
for x in $failed ; do | |
file=${x//::/\/} | |
missing $file $x | |
done | |
# -> FAIL Bailing out the installation for XML-XPath-1.13. Retry with --prompt or --force. | |
msg="FAIL Bailing out the installation" | |
echo "$msg:" | |
failed=$(get_mods "$msg" 8 | sed 's/-[0-9].*$//;') | |
for x in $failed ; do | |
file=${x//-/\/} | |
module=${x//-/::} | |
missing $file $module | |
done | |
# -> FAIL Configure failed for XML-LibXML-1.95. See /home/colin/.cpanm/build.log for details. | |
msg="FAIL Configure failed" | |
echo "$msg:" | |
failed=$(get_mods "$msg" 6 | sed 's/-[0-9].*$//;') | |
for x in $failed ; do | |
file=${x//-/\/} | |
module=${x//-/::} | |
missing $file $module | |
done | |
# -> FAIL Finding Jifty::Filter::JSON on search.cpan.org failed. | |
msg="FAIL Finding" | |
echo "$msg:" | |
failed=$(get_mods "$msg" 4) | |
for x in $failed ; do | |
file=${x//::/\/} | |
missing $file $x | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment