Changeset 454


Ignore:
Timestamp:
10/05/2009 00:18:50 (3 years ago)
Author:
blee
Message:

Implement bulk operations for confman recipe remove.

See #72

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.in

    r452 r454  
    917917 
    918918function recipe_remove { 
    919     if [ -z "$1" ] ; then print_usage 1 ; fi 
    920     local recipe="$1" 
    921     conf_remove_recipe "$recipe" 
     919    if [ -z "$*" ] ; then print_usage 1 ; fi 
     920    conf_remove_recipes "$@" || exit 1 
    922921} 
    923922 
  • trunk/confmanlib.sh.in

    r452 r454  
    964964} 
    965965 
     966function conf_remove_recipes { 
     967    local recipe 
     968    local oldrecipes 
     969    local rc=0 
     970 
     971    for recipe in "$@"; do 
     972        if conf_remove_recipe "$recipe"; then 
     973            # Keep track of the recipes that were successfully removed 
     974            # to avoid inadvertent commits 
     975            if [ -z "$oldrecipes" ]; then 
     976                oldrecipes="$recipe" 
     977            else 
     978                oldrecipes="$oldrecipes,$recipe" 
     979            fi 
     980        else 
     981            rc=1 
     982        fi 
     983    done 
     984 
     985    # $oldrecipes is in the form foo,bar,baz. This eval trick forces 
     986    # curly brace expansion. 
     987    if echo "$oldrecipes" | grep -q ','; then 
     988        @SVN@ commit $(eval echo $(conf_recipe_dir)/{$oldrecipes})  
     989    else 
     990        @SVN@ commit "$(conf_recipe_dir)/$oldrecipes" 
     991    fi 
     992 
     993    return $rc 
     994} 
     995 
    966996function conf_remove_recipe { 
    967997    local recipe="$1" 
     
    9711001        return 1 
    9721002    fi 
    973     @SVN@ rm "${recipe_file}" 
    974     @SVN@ commit "${recipe_file}" 
     1003    @SVN@ rm "${recipe_file}" || return 1 
     1004    return 0 
    9751005} 
    9761006 
Note: See TracChangeset for help on using the changeset viewer.