# up_trigger everything on branch updates

if spell_ok $SPELL; then
  local NEW_SPELL_BRANCH="$(echo $VERSION | cut -d. -f1,2)" &&
  local OLD_SPELL_BRANCH="$(installed_version $SPELL | cut -d. -f1,2)" &&

  if test "${NEW_SPELL_BRANCH}" != "${OLD_SPELL_BRANCH}"; then
    message "${MESSAGE_COLOR}This is a possibly incompatible update of $SPELL..." &&
    message "Figuring out what spells need to be recast, this may take a while.${DEFAULT_COLOR}" &&

    for each in $(show_up_depends $SPELL 1); do
      if gaze -q install $each | xargs readelf -d 2> /dev/null |
         grep -q "NEEDED.*libaubio\.so"; then
           up_trigger $each cast_self
      fi
    done
  fi
fi
