summaryrefslogtreecommitdiffstats
path: root/la_remove_up_trigger.function
blob: fe80805124cb0242a0094a950eba1b0d0b681c77 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#---------------------------------------------------------------------
## @param check all spells (1) or only direct dependees (0)
##
## Check any usage of .la files from this spell by others and
## trigger re-cast to facilitate removal of libtool archives from
## a spell.
#---------------------------------------------------------------------

la_remove_up_trigger()
{
  local force_all=$1
  local la_match=$( gaze install "$SPELL" | grep '\.la$' \
  | while read f; do printf " -e /%s" "$(basename "$f")"; done )

  message "This is an upgrade which removes libtool archives."
  message "Determining affected spells and triggering them ..."

  local check_spells
  if [[ $force_all -gt 0 ]]; then
    check_spells=$(gaze installed | cut -d: -f1)
  else
    check_spells=$(show_up_depends $SPELL)
  fi
  for other_spell in $check_spells
  do
    [[ $SPELL != $other_spell ]] || continue
    match_count=$( gaze install "$other_spell" | grep '\.la$' \
      | xargs -r grep $la_match | wc -l )
    [[ "$match_count" -gt 0 ]] &&  up_trigger "$other_spell" cast_self
  done
  true
}