New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
update_vendor.sh in vendors/svn_tools – NEMO

source: vendors/svn_tools/update_vendor.sh @ 1989

Last change on this file since 1989 was 1989, checked in by smasson, 14 years ago

update scripts to update vendors

  • Property svn:executable set to *
File size: 4.6 KB
Line 
1#!/bin/bash
2# N.B. run this script on EXTERNAL directory!!!
3
4set -u
5
6if [ $# -ne 4 ]; then
7    echo "Usage: $0 vendor_branch nemo_vendor_old new username"
8    echo "first  argument: vendor name (for example: IOIPSL)"
9    echo "second argument: old tag name of the vendor in NEMO vendors deposit (for example: v2_1_9 or 53)"
10    echo "third  argument: definition of the tag or the revision number of the vendor to be updated (for example: v2_2_1 or 114)"
11    echo "fourth argument: user login name"
12    echo
13    echo "run this script on EXTERNAL/svn_tools directory"
14    echo
15    echo
16    echo "examples"
17    echo
18    echo "./update_vendor.sh IOIPSL v2_1_9 v2_2_1 smasson"
19    echo "./update_vendor.sh XMLF90 53 114 smasson"
20    echo "./update_vendor.sh XMLIO_SERVER 53 114 smasson"
21    echo "./update_vendor.sh AGRIF 00 1988 smasson"
22
23   exit 1
24fi
25
26vendor_branch=$1
27nemo_vendor_old=$2
28new=$3
29username=$4
30
31#-
32#-----------------------------------------------------------------------------------
33# path definitions... could need to be changed...
34#-----------------------------------------------------------------------------------
35#-
36
37#- My projet url
38svn_nemo_vendor=svn+ssh://$username@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/vendors/$vendor_branch
39
40#- EXTERNAL directory in which we want to merge vendors
41svn_external=svn+ssh://$username@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/DEV_r1879_FCM/NEMOGCM/EXTERNAL
42
43#- Vendor project original url
44case $vendor_branch in
45    IOIPSL) vendor_url=http://forge.ipsl.jussieu.fr/igcmg/svn/$vendor_branch/tags ;;
46    AGRIF) vendor_url=http://forge.ipsl.jussieu.fr/nemo/svn/trunk/$vendor_branch ;;
47    XMLF90) vendor_url=http://forge.ipsl.jussieu.fr/ioserver/svn/$vendor_branch ;;
48    XMLIO_SERVER) vendor_url=http://forge.ipsl.jussieu.fr/ioserver/svn/XMLIO_SERVER/trunk ;;
49    fcm) echo "url of fcm undefined..." ; exit 2 ;;
50    *)  echo "wrong definition of the vendor name..." ; exit 3 ;;
51esac
52
53#- get a tag or a revision??
54if [ "$vendor_branch" = "IOIPSL" ] 
55then
56    rev_or_tag="tag"
57else
58    rev_or_tag="rev"
59fi
60
61#-
62#-----------------------------------------------------------------------------------
63# end of path definitions...
64#-----------------------------------------------------------------------------------
65#-
66echo
67echo "########################################################"
68echo "#                                                      #"
69echo "#  run this script in EXTERNAL/svn_tools directory!!!  #"
70echo "#                                                      #"
71echo "########################################################"
72echo
73
74#- checkout new vendor version without the .svn directories (-> use export instead of checkout) and put it in a working_directory
75echo
76echo "Downloading $vendor_branch tag $new into working_directory..."
77echo
78[[ ( -d working_directory ) || ( -f working_directory ) ]] && rm -rf working_directory # cleaning
79if [ "$rev_or_tag" = "tag" ] 
80then
81    svn export $vendor_url/$new working_directory      # specify the tag path
82else
83    svn export -r $new $vendor_url working_directory   # specify the revision number
84fi
85
86#- update the vendor deposit:
87#- 1) create a clean version of the current version (take care od added and removed file) and commit it
88#- 2) tag it with a new name $nemo_vendor_new
89if [ "$rev_or_tag" = "tag" ] 
90then
91    nemo_vendor_new=$new
92else
93    nemo_vendor_new=r_$new
94fi
95echo
96echo "updating $vendor_branch/current and tagging this new version as $vendor_branch/$nemo_vendor_new"
97echo
98./svn_load_dirs.pl -t $nemo_vendor_new $svn_nemo_url/vendors/$vendor_branch current working_directory
99#-
100#- merge old and new version of $vendor_branch in $svn_external/$vendor_branch
101#-
102echo
103echo "##############################################"
104echo
105echo "merge old and new version of $vendor_branch in $svn_external/$vendor_branch"
106echo "if everything is ok you should execute the folling command:"
107echo
108echo "svn merge $svn_nemo_vendor/$nemo_vendor_old $svn_nemo_vendor/current ../$vendor_branch"
109
110echo
111echo
112echo "##############################################"
113echo
114echo "Commiting the merge of $vendor_branch changes toward $svn_external/$vendor_branch"
115echo "if everything is ok you should execute the folling command:"
116echo
117echo "svn co --message \"merging $vendor_branch/$nemo_vendor_new into the EXTERNAL deposit\" ../$vendor_branch"
118
119 
120## NOTE : after a merge we have conflicts
121## to resole them it is necessary to do, for example : svn resolved IOIPSL/directory with conflits
122
123## NOTE : if you have a good merge then you have to committ:
124## cd $tmp_dir/IOIPSL
125## svn status ../IOIPSL
126## svn ci --username $username --message "merge IOIPSL version $nemo_vendor_new"
127
128exit 0
129
Note: See TracBrowser for help on using the repository browser.