Changeset 492


Ignore:
Timestamp:
11/11/2009 16:37:02 (2 years ago)
Author:
ccowart
Message:

Apparently doing sed_i_cmd in a variable has quoting issues and
doesn't perform as expected. I have factored the -i "" logic out
by defining a sed_i_cmd function differently on a per-OS basis.

I have also used the new sed_i_cmd idiom to solve the recipe updates on
renames issue.

Fixes #96, #98

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.in

    r491 r492  
    157157    done 
    158158    rm -f "$orig_log" 
    159     ${sed_i_cmd} -e "/${ignoreline}/,\$d" "$logfile" 2>/dev/null 
     159    sed_i_cmd -e "/${ignoreline}/,\$d" "$logfile" 2>/dev/null 
    160160    echo "$logfile" 
    161161    return 0 
  • trunk/confmancommon.sh.in

    r491 r492  
    7676    mktemp_dir="mktemp -d -t confman" 
    7777    sed_cmd="sed -E" 
    78     sed_i_cmd="${sed_cmd} -i \"\"" 
     78    function sed_i_cmd { 
     79        ${sed_cmd} -i '' "$@" 
     80    } 
    7981    stat_cmd="stat -f" 
    8082    stat_opts="mode=%Mp%Lp owner=%Su group=%Sg" 
     
    8688    mktemp_dir="mktemp -t -d confman.XXXXXX" 
    8789    sed_cmd="sed -r" 
    88     sed_i_cmd="${sed_cmd} -i" 
     90    function sed_i_cmd { 
     91        ${sed_cmd} -i "$@" 
     92    } 
    8993    stat_cmd="stat -c" 
    9094    stat_opts="mode=%a owner=%U group=%G" 
     
    96100    mktemp_dir="mktemp -d -t confman" 
    97101    sed_cmd="sed -E" 
    98     sed_i_cmd="${sed_cmd} -i \"\"" 
     102    function sed_i_cmd { 
     103        ${sed_cmd} -i '' "$@" 
     104    } 
    99105    stat_cmd="stat -f" 
    100106    stat_opts="mode=%Mp%Lp owner=%Su group=%Sg" 
  • trunk/confmanlib.sh.in

    r491 r492  
    858858    done 
    859859 
    860     find ${WORK_PATH}/${newmod} -type f -not -path '*/.svn/*' -exec \ 
    861         ${sed_i_cmd} \ 
    862         "s/(Managed under )${oldmod}( module\.)$/\1${newmod}\2/" {} \; \ 
    863         || return 1 
     860    for file in $(find ${WORK_PATH}/${newmod} -type f -not -path '*/.svn/*') 
     861    do 
     862        sed_i_cmd \ 
     863            "s/(Managed under )${oldmod}( module\.)$/\1${newmod}\2/" "$file" \ 
     864            || return 1 
     865    done 
     866 
     867    for file in $(find $(conf_recipe_dir) -maxdepth 1 -type f); do 
     868        sed_i_cmd "s/^([ \t]*)${oldmod}([ \t]*)$/\1${newmod}\2/" "$file" ||  
     869        return 1 
     870    done 
    864871 
    865872    @SVN@ commit -m "Renaming ${oldmod} to ${newmod}" \ 
    866873        ${WORK_PATH}/${oldmod} ${WORK_PATH}/${REPO_CHECKPTS}/${oldmod} \ 
    867874        ${WORK_PATH}/${newmod} ${WORK_PATH}/${REPO_CHECKPTS}/${newmod} \ 
    868         || return 1 
     875        $(conf_recipe_dir) || return 1 
    869876 
    870877    return 0 
Note: See TracChangeset for help on using the changeset viewer.