Changeset 512 for trunk


Ignore:
Timestamp:
12/07/2010 10:29:39 (18 months ago)
Author:
joshu
Message:

Changed 'confman update' so that it no longer has the (undocumented) feature of
passing any arguments on to 'svn up' wholesale. After discussion with ccowart,
we determined that -r is really the only argument that needs to be passed to
'svn update'.

'confman update' now takes an optional argument of a recipe name; if no recipe
name is supplied, the default behavior is to update the entire repository. If
$UPDATE_RELEVANT_ONLY is set to true, however, the default behavior is the
equivalent of 'confman update $RECIPE_NAME', and a full repo update can be
achieved with 'confman update -a'. I also updated the documentation and manpages
to reflect these changes.

See #10

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/confman.8.in

    r503 r512  
    145145.Nm . 
    146146It will check out your working copy. setup takes no additional arguments. 
    147 .It Cm update [ Ar options ] 
    148 The update command will update all the modules in your working copy. This 
    149 Any options specified will be passed directly to  
    150 .Xr svn 1 . This can be used 
    151 for updating your working copy to an older revision.  
     147.It Cm update [ -a ] [ -r Ar revision_string ] [ Ar recipe ] 
     148The update command will update all the modules in your working copy by default, 
     149or, if given a Ar recipe, update all the files relevant to the given recipe. 
    152150 
    153 For example, you could use `confman update -r '{20090801}' www` to look at the 
    154 state of the module named `www' as of 1 August 2009. This will re-add any 
    155 deleted files and delete any added files from your working copy (This is 
    156 simplest if you have commited any outstanding changes, but subversion is good 
    157 about not deleting work-in-progress -- the errors can just be confusing).  
     151If the UPDATE_RELEVANT_ONLY flag has been set in  
     152.Xr confman.conf 5 , 
     153the default behavior  
     154of Cm update is to update only the files relevant to the host's recipe.   
     155The  
     156.Fl a  
     157flag will override this behavior and update the entire working copy. 
     158 
     159.Fl r Ar revision_string 
     160can be used, as in  
     161.Xr svn 1 , 
     162to retrieve an older copy of the working copy, e.g.  
     163.Cm update -r PREV 
     164to retrieve the previous commit of the working copy. 
    158165 
    159166Note that before any install or commit operation, there is an implicit update 
    160167that will cause the latest repository revision to be reflected in your working 
    161 copy. command does not alter the repository or the system. 
     168copy. This command does not alter the repository or the system. 
    162169.It Cm commit Oo log_flags Oc 
    163170The commit command causes your changes to take effect.  
  • trunk/confman.conf.5.in

    r509 r512  
    189189.It LIVE_ROOT 
    190190This option causes  
    191 .Xr 
     191.Xr confman 8 
    192192to use an alternate path to "/" for rolling out files. This is a great way 
    193193to set up a sandbox and test things out before managing your live system. 
     194.It UPDATE_RELEVANT_ONLY 
     195Defaults to "false".  Set it to "true" to cause 
     196.Xr confman 8 
     197to update only the files relevant to the host's recipe when running a commit  
     198or an install.  Additionally,  
     199.Cm confman update 
     200will update only the recipe-relevant files when given no additional arguments. 
    194201.El 
    195202.Sh AUTHORS 
  • trunk/confman.in

    r511 r512  
    100100function update { 
    101101    local wcopy_lock 
    102     wcopy_lock=$(conf_lock_wcopy) 
    103     conf_update_tree "$@" || exit 1 
     102    local opt OPTARG OPTIND 
     103    local revision="HEAD" recipe update_all="false" 
     104    while getopts ":r:a" opt ; do 
     105        case $opt in 
     106            r)  revision="$OPTARG" ;; 
     107            a)  update_all="true" ;; 
     108            *)  echo "Invalid option '-${OPTARG}'." >&4 
     109                print_usage 1 
     110                ;; 
     111        esac 
     112    done 
     113    shift $(($OPTIND - 1)) 
     114    recipe="$1" 
     115    wcopy_lock=$(conf_lock_wcopy) 
     116    $UPDATE_RELEVANT_ONLY && [ -z $recipe ] && recipe="$RECIPE_NAME" 
     117    if [ ! -r "$(conf_recipe_dir)/$recipe" ]; then 
     118        echo "Recipe \"$recipe\" does not exist or is not readable." >&2 
     119        exit 1 
     120    fi 
     121    if $update_all || [ -z $recipe ]; then 
     122        conf_update_tree -r $revision ${WORK_PATH} || exit 1 
     123    else 
     124        conf_update_relevant_tree $recipe -r $revision || exit 1 
     125    fi 
    104126    conf_unlock_wcopy $wcopy_lock 
    105127} 
     
    226248    $SUDO ${SUDO:+-v} 
    227249 
    228     if $UPDATE_RELEVANT_ONLY; then 
    229         conf_update_relevant_tree || conf_cleanExit 
    230     else 
    231         conf_update_tree || conf_cleanExit 
    232     fi 
     250    update 
    233251     
    234252    if status=$(get_status $modules $symlinks); then 
     
    289307    $SUDO ${SUDO:+-v} 
    290308 
    291     if $UPDATE_RELEVANT_ONLY; then 
    292         conf_update_relevant_tree || conf_cleanExit 
    293     else 
    294         conf_update_tree || conf_cleanExit 
    295     fi 
     309    update 
    296310    if status=$(get_status $files) ; then 
    297311        nocommit=false 
  • trunk/confmandoc.sh

    r501 r512  
    3636  $MYNAME [ help | -h ] [ command ] 
    3737  $MYNAME setup 
    38   $MYNAME update [ options ] 
     38  $MYNAME update [ -a ] [ -r revision_string ] [ recipe ] 
    3939  $MYNAME commit 
    4040  $MYNAME diff [ working_copy ] 
     
    139139 
    140140Usage: 
    141   $MYNAME update [ options ] 
    142  
    143 With no arguments, the update command will update your working copy of all 
    144 the modules appearing in the current host's recipe file. This command does 
    145 not alter the repository. 
    146  
    147 Any options specified will be passed directly to svn(1). This can be used 
    148 for updating your working copy to an older revision. Note that before any 
     141  $MYNAME update [ -a ] [ -r revision_string ] [ recipe ] 
     142 
     143With no arguments, the update command will update your entire working copy  
     144unless the UPDATE_RELEVANT_ONLY flag is set in confman.conf or your  
     145~/.confmanrc.  With the UPDATE_RELEVANT_ONLY flag, the default behavior of  
     146the update command is to update all of the files appearing in the current  
     147host's recipe file.  With a recipe argument, the update command will update  
     148all files in the working copy relevant to the recipe.  This command does not  
     149alter the repository. 
     150 
     151If -r is used, confman will retrieve versions of the files indicated by  
     152the revision string, e.g., -r PREV for the previous working copy. 
     153 
     154The -a option will force a full update of all files in your working copy,  
     155regardless of whether UPDATE_RELEVANT_ONLY is set.  Note that before any 
    149156install or commit operation, there is an implicit update that will cause 
    150157the latest repository revision to be reflected in your working copy. 
  • trunk/confmanlib.sh.in

    r511 r512  
    134134function conf_update_relevant_tree { 
    135135    local module symlink 
    136     local relevant_files="" 
    137     @SVN@ update $(conf_recipe_path) 
    138     for module in $(conf_get_recipe); do 
     136    local relevant_files="" recipe args 
     137    recipe="$1" 
     138    shift 
     139    args="$@" 
     140    [ -r $(conf_recipe_dir)/${recipe} ] || exit 1 
     141    @SVN@ update $args $(conf_recipe_dir)/${recipe} 
     142    for module in $(conf_get_recipe $(conf_recipe_dir)/${recipe}); do 
    139143        relevant_files="$relevant_files ${WORK_PATH}/${module}" 
    140144        for symlink in $(find ${WORK_PATH}/${module} -type l); do 
     
    142146        done 
    143147    done 
    144     [ "$relevant_files" = "" ] || @SVN@ update $relevant_files | uniq 
    145 # uniq is kind of an ugly fix, but otherwise we spew 30000 "At revision $n."s 
     148    [ "$relevant_files" = "" ] || @SVN@ update $args $relevant_files | grep \ 
     149        -v -e 'revision' 
    146150} 
    147151 
Note: See TracChangeset for help on using the changeset viewer.