if spell_ok $SPELL; then . "$GRIMOIRE/find_depends.function" local OLD_SPELL_VERSION="$(installed_version $SPELL)" && if [[ "${VERSION%.*}" != "${OLD_SPELL_VERSION%.*}" ]]; then message message "${MESSAGE_COLOR}This is an ABI incompatible update of ${SPELL_COLOR}${SPELL}${MESSAGE_COLOR}..." && message "Determining which spells need to be recast, this may take a while." && local recast_list && local libtool_names="$(find_spell_libtool_archives -L "$SPELL" | xargs basename -a)" local so_names="$(find_spell_shared_objects "$SPELL" | xargs readelf -d | sed -n -e '/SONAME/s/^.*\[\([^]]*\).*/\1/p')" find_libtool_so_dependencies recast_list "$libtool_names" "$so_names" "$SPELL" if [[ -n "${recast_list}" ]]; then message " ${SPELL_COLOR}${PROBLEM_COLOR}You are about to upgrade (downgrade) ${SPELL_COLOR}${SPELL}${PROBLEM_COLOR} to a different major version. All spells that depend on ${SPELL_COLOR}${SPELL}${PROBLEM_COLOR} will need to be recast. To prevent cast failures due to circular dependencies these spells will be dispelled now and recast after ${SPELL_COLOR}${SPELL}${PROBLEM_COLOR} has finished casting. Note that if you abort the cast, or if the cast fails some of these spells may be left dispelled. It is highly recommended to upgrade (downgrade) ${SPELL_COLOR}${SPELL}${PROBLEM_COLOR} in a separate cast." && message "${MESSAGE_COLOR}The following spells will be dispelled and recast:" && message $(fold -s -w 72 <<< "${SPELL_COLOR}${recast_list}") && query "${QUERY_COLOR}Do you wish to upgrade (downgrade) ${SPELL_COLOR}${SPELL}${QUERY_COLOR} now?" n && local other_spell && for other_spell in $recast_list; do dispel $other_spell && up_trigger $other_spell cast_self done fi fi fi