Changeset 565


Ignore:
Timestamp:
12/16/2011 18:24:22 (5 months ago)
Author:
blee
Message:

Merge fix for #10 into confman-1.9.

Closes #10

Location:
branches/confman-1.9
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/confman-1.9

  • branches/confman-1.9/confman.8.in

    r534 r565  
    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.  
  • branches/confman-1.9/confman.conf.5.in

    r563 r565  
    203203.It LIVE_ROOT 
    204204This option causes  
    205 .Xr 
     205.Xr confman 8 
    206206to use an alternate path to "/" for rolling out files. This is a great way 
    207207to set up a sandbox and test things out before managing your live system. 
     208.It UPDATE_RELEVANT_ONLY 
     209Defaults to "false".  Set it to "true" to cause 
     210.Xr confman 8 
     211to update only the files relevant to the host's recipe when running a commit  
     212or an install.  Additionally,  
     213.Cm confman update 
     214will update only the recipe-relevant files when given no additional arguments. 
    208215.El 
    209216.Sh AUTHORS 
  • branches/confman-1.9/confman.conf.in

    r563 r565  
    106106LIVE_ROOT="" 
    107107 
     108# Allow svn to update only the files relevant to the recipe before a commit  
     109# or install operation. 
     110UPDATE_RELEVANT_ONLY="false" 
     111 
  • branches/confman-1.9/confman.in

    r558 r565  
    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} 
     
    225247     
    226248    $SUDO ${SUDO:+-v} 
    227     conf_update_tree || conf_cleanExit 
     249 
     250    update 
    228251     
    229252    if status=$(get_status $modules $symlinks); then 
     
    284307    $SUDO ${SUDO:+-v} 
    285308 
    286     conf_update_tree || conf_cleanExit 
     309    update 
    287310    if status=$(get_status $files) ; then 
    288311        nocommit=false 
  • branches/confman-1.9/confmandoc.sh

    r502 r565  
    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. 
  • branches/confman-1.9/confmanlib.sh.in

    r563 r565  
    130130        @SVN@ update "$@" 
    131131    fi 
     132} 
     133 
     134# Updates the relevant portions of the source tree 
     135function conf_update_relevant_tree { 
     136    local module symlink 
     137    local relevant_files="" recipe args 
     138    recipe="$1" 
     139    shift 
     140    args="$@" 
     141    [ -r $(conf_recipe_dir)/${recipe} ] || exit 1 
     142    @SVN@ update $args $(conf_recipe_dir)/${recipe} 
     143    if ! [[ $args =~ .*-r.* ]]; then 
     144        # make sure that svn is pulling the same revision everywhere 
     145        args="${args} -r $(@SVN@ info $(conf_recipe_dir)/${recipe} | \ 
     146            awk '/^Revision:/ { print $2 }')" 
     147    fi 
     148    for module in $(conf_get_recipe $(conf_recipe_dir)/${recipe}); do 
     149        relevant_files="$relevant_files ${WORK_PATH}/${module}" 
     150        for symlink in $(find ${WORK_PATH}/${module} -type l); do 
     151            relevant_files="$relevant_files $(@GREADLINK@ -f $symlink)" 
     152        done 
     153    done 
     154    [ "$relevant_files" = "" ] || @SVN@ update $args $relevant_files | grep \ 
     155        -v -e 'revision' 
    132156} 
    133157 
Note: See TracChangeset for help on using the changeset viewer.