lib/pvl/apply.sh
changeset 718 f1c352644c2a
parent 714 e0a651547bd2
equal deleted inserted replaced
717:e37b0a857a5d 718:f1c352644c2a
    43 # Returns true if the output file needs to be updated.
    43 # Returns true if the output file needs to be updated.
    44 function apply_check {
    44 function apply_check {
    45     local update=
    45     local update=
    46     local out="$1"
    46     local out="$1"
    47 
    47 
    48     debug "$out"
    48     log_debug           "$out"
    49 
    49 
    50     if [ ${#@} -eq 1 ]; then
    50     if [ ${#@} -eq 1 ]; then
    51         debug "  update: empty deps"
    51         log_changed     "  update: empty deps"
    52         return 2
    52         return 2
    53 
    53 
    54     elif [ ! -e "$out" ]; then
    54     elif [ ! -e "$out" ]; then
    55         debug "  update: dest missing"
    55         log_changed     "  update: dest missing"
    56         return 2
    56         return 2
    57         
    57         
    58     elif [ "$APPLY_FORCE" = 1 ]; then
    58     elif [ "$APPLY_FORCE" = 1 ]; then
    59         debug "  update: forced"
    59         log_changed     "  update: forced"
    60         return 2
    60         return 2
    61     fi
    61     fi
    62 
    62 
    63     # check deps
    63     # check deps
    64     for dep in "${@:2}"; do
    64     for dep in "${@:2}"; do
    65         # check
    65         # check
    66         if [ ! -e "$dep" ]; then
    66         if [ ! -e "$dep" ]; then
    67             warn "$out: Missing source: $dep"
    67             warn        "$out: Missing source: $dep"
    68 
    68 
    69         elif [ "$out" -ot "$dep" ]; then
    69         elif [ "$out" -ot "$dep" ]; then
    70             debug "  update: $dep"
    70             log_changed "   changed: $dep"
    71             return 1
    71             return 1
    72         else
    72         else
    73             debug "  check: $dep"
    73             log_debug   "  check: $dep"
    74         fi
    74         fi
    75     done
    75     done
    76 
    76 
    77     debug "  up-to-date"
    77     log_debug           "  up-to-date"
    78     return 0
    78     return 0
    79 }
    79 }