Changeset 1373

Show
Ignore:
Timestamp:
12/19/08 16:45:32 (5 years ago)
Author:
elemoine
Message:

add support to the deploy script for (1) creating a branch based on trunk and replace Map Fish? svn:externals by a copy of Map Fish?, (2) create a tag based on a branch, (3) doing a full install/partial install/update of a branch or a tag

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/MapFish/deploy/deploy.sh

    r1034 r1373  
    8787        rm -rf $PROJECT 
    8888    fi 
    89     fetch_project 
     89    fetch_project $1 
    9090 
    9191    run_hook post_init_light 
     
    9696 
    9797    create_python_env 
    98     init_light 
     98    init_light $1 
    9999 
    100100    run_hook post_init_all 
     
    203203fetch_project() { 
    204204    run_hook pre_fetch_project 
    205  
     205     
    206206    echo "Fetching/updating project" 
    207207    if [ -d "project_source/$PROJECT" ]; then 
     
    209209        rsync -av project_source/$PROJECT . 
    210210    else 
    211         $SVN co $SVN_CO_OPTIONS ${PROJECT_SVN_BASE} 
     211        (echo "${PROJECT_SVN_BASE}" | egrep "(trunk|branches|tags)\/${PROJECT}\/*") 
     212        if [ $? -eq 0 ]; then 
     213            project_svn="${PROJECT_SVN_BASE}" 
     214        else 
     215            if [ -n $1 ]; then 
     216                project_svn="${PROJECT_SVN_BASE}/${1}/${PROJECT}" 
     217            else 
     218                project_svn="${PROJECT_SVN_BASE}/trunk/${PROJECT}" 
     219            fi 
     220        fi 
     221        $SVN co $SVN_CO_OPTIONS ${project_svn} 
    212222    fi 
    213223    init_mapfish 
     
    224234} 
    225235 
     236create_branch() { 
     237    $SVN mkdir -m "create dir for branch $1" ${PROJECT_SVN_BASE}/branches/$1/ 
     238    $SVN cp -m "create branch $1" ${PROJECT_SVN_BASE}/trunk/$PROJECT ${PROJECT_SVN_BASE}/branches/$1 
     239    if [ "$HAS_MAPFISH" = "1" ]; then 
     240        # 
     241        # The branch includes a copy (snapshot) of MapFish as opposed 
     242        # to an svn:externals to MapFish trunk 
     243        # 
     244        ( 
     245            cd /tmp 
     246            rm -rf $PROJECT 
     247            echo "fetching project, it may time some time..." 
     248            $SVN co ${PROJECT_SVN_BASE}/branches/$1/$PROJECT 
     249            cd $PROJECT 
     250            $SVN export MapFish MapFish_ 
     251            $SVN propdel svn:externals MapFish . 
     252            $SVN commit -m "remove externals to MapFish" . 
     253            rm -rf MapFish 
     254            mv MapFish_ MapFish 
     255            $SVN add MapFish 
     256            $SVN commit -m "add MapFish" MapFish 
     257        ) 
     258    fi 
     259} 
     260 
     261create_tag() { 
     262    echo "Enter branch name, followed by [ENTER]" 
     263    read branch 
     264    $SVN mkdir -m "create dir for tag $1" ${PROJECT_SVN_BASE}/tags/$1/ 
     265    $SVN cp -m "create tag $1" ${PROJECT_SVN_BASE}/branches/$branch/$PROJECT ${PROJECT_SVN_BASE}/tags/$1 
     266} 
     267 
     268 
    226269# 
    227270# Main function 
     
    236279    fi 
    237280 
    238     while getopts ijurh OPT; do 
     281    opt_i="no" 
     282    opt_j="no" 
     283    opt_u="no" 
     284    opt_b="no" 
     285    opt_t="no" 
     286 
     287    while getopts ijurhb:t: OPT; do 
    239288        case $OPT in 
    240289        i) 
    241             echo "Initializing everything" 
    242             init_all 
     290            opt_i="yes" 
    243291            ;; 
    244292        j) 
    245             echo "Initializing MapFish and project" 
    246             init_light 
     293            opt_j="yes" 
    247294            ;; 
    248295        u) 
    249             echo "Updating project" 
    250             fetch_project 
     296            opt_u="yes" 
    251297            ;; 
    252298        r) 
     
    254300            subst_in_files 
    255301            ;; 
     302        b) 
     303            opt_b="$OPTARG" 
     304            ;; 
     305        t) 
     306            opt_t="$OPTARG" 
     307            ;; 
    256308        \?|h) 
    257309            echo "Usage: $0 OPTION" 
    258310            echo " -h: help" 
    259             echo -n " -i: initialize everything " 
    260             echo "(WARNING: this deletes existing directories)" 
    261             echo -n " -j: initialize MapFish and project " 
    262             echo "(WARNING: this deletes existing project and MapFish)" 
     311            echo " -i: initialize everything " 
     312            echo "     WARNING: this deletes existing directories" 
     313            echo "     can be used with -t or -b to retrieve a specific tag or branch" 
     314            echo " -j: initialize MapFish and project " 
     315            echo "     (WARNING: this deletes existing project and MapFish)" 
     316            echo "     can be used with -t or -b to retrieve a specific tag or branch" 
    263317            echo " -u: update project" 
     318            echo "     can be used with -t or -b to retrieve a specific tag or branch" 
    264319            echo " -r: replace .in files" 
     320            echo " -b <branch_name>: if not used with -i or -j or -u create a new branch," 
     321            echo "     replacing the svn:external to MapFish by a copy of MapFish" 
     322            echo " -t <tag_name>: if  not used with -i or -j or -u create a new tag" 
     323            echo  
    265324            exit 1 
    266325            ;; 
    267326        esac 
    268327    done 
     328 
     329    arg= 
     330    if [ $opt_b != "no" ]; then 
     331        arg="branches/$opt_b" 
     332    fi 
     333    if [ $opt_t != "no" ]; then 
     334        arg="tags/$opt_t" 
     335    fi 
     336 
     337    if [ $opt_i = "yes" ]; then 
     338        echo "Initializing everything" 
     339        init_all $arg 
     340    elif [ $opt_j = "yes" ]; then 
     341        echo "Initializing MapFish and project" 
     342        init_light $arg 
     343    elif [ $opt_u = "yes" ]; then 
     344        echo "Updating project" 
     345        fetch_project $arg 
     346    elif [ $opt_t != "no" ]; then 
     347        echo "Create tag from branch" 
     348        create_tag $opt_t 
     349    elif [ $opt_b != "no" ]; then 
     350        echo "Create branch from trunk (with a snapshot of MapFish)" 
     351        create_branch $opt_b 
     352    fi 
     353 
    269354    echo "Done." 
    270355}