8 #### REVIEW this carefully
10 cvstag=planetlab-4_0-rc3
11 previous=002-rc3-2007-05-02
12 next=003-${cvstag}-${date}
15 svn="svn+ssh://thierry@svn.one-lab.org/svn"
16 cvs=":pserver:anon@cvs.planet-lab.org:/cvs"
17 import=$HOME/import-$module-$date
21 echo -n '-------------------- '
23 echo -n 'Enter return to proceed .. '
28 echo -n '-------------------- '
37 function run_prompt () {
43 *) label="y/n (no default)" ;;
46 echo -n '-------------------- '
50 echo -n "want to run $@ $label ? "
52 [ -z "$answer" ] && answer=$default
64 echo 'Please enter y or n'
70 function run_loop () {
73 echo -n '-------------------- '
80 [ -z "$answer" ] && answer=n
89 ### echoes OK on stdout if url exists
90 function svn_url_check () {
92 svn list $url &> /dev/null && echo OK
95 ### return 'y' or 'n' for being used as prompt
96 function svn_url_needs_creation () {
98 if [ -n "$(svn_url_check $url)" ] ; then echo n ; else echo y ; fi
101 function dir_needs_creation () {
103 if [ -d "$dir" ] ; then echo n ; else echo y ; fi
106 ##############################
107 ##############################
108 ##############################
113 this script is quite rough and should be used with care
115 I am slowly trying to automate this painful process,
117 so again : USE WITH CARE
132 function run_test () {
134 run_prompt n "going to /etc" cd /etc
135 run_prompt y "going to /etc" cd /etc
136 run_prompt y "Cleaning up /foobar" rmdir /foobar
137 run_prompt $(dir_needs_creation /foobar) "create unexisting dir /foobar" mkdir /foobar
138 run_prompt $(dir_needs_creation /var) "create existing dir /var" mkdir /var
139 run_prompt y "Cleaning up /foobar" rmdir /foobar
141 run_loop "Check this and that" ls -ls passwd
142 run "Listing passwd" ls -ls passwd
146 # checks current status
147 echo "------------------------------ Checking $module/imports/import-$previous"
148 [ -z "$(svn_url_check $svn/$module/imports/import-$previous)" ] && echo WARNING : import-$previous not found
152 # snapshot current status
153 prompt=$(svn_url_needs_creation $svn/$module/imports/before-$next)
154 run_prompt $prompt "Creating snapshot of current status" \
155 svn copy $svn/$module/trunk $svn/$module/imports/before-$next
157 # init import dir from previous import
158 prompt=$(svn_url_needs_creation $svn/$module/imports/import-$next)
159 run_prompt $prompt "Preparing import-$next from import-$previous" \
160 svn copy $svn/$module/imports/import-$previous $svn/$module/imports/import-$next
163 run_prompt $(dir_needs_creation $import/$module/imports) "Creating working dir " \
164 mkdir -p $import/$module/imports
167 run_prompt $(dir_needs_creation $import/$module/imports/import-$next) "Checking out import-$next for applying changes" \
168 svn co $svn/$module/imports/import-$next $import/$module/imports/import-$next
171 cd $import/$module/imports
173 message 'NOTE: the way we merge changes right below might need to be tested/improved'
175 run_prompt n "Incorporating changes since import-$previous in import-$next" \
176 cvs -d $cvs export -r $cvstag -d import-$next $module
178 run "Going to import-$next" \
179 cd $import/$module/imports/import-$next
181 run_loop "Check the changes in import-$next -- no conflict expected" svn status $import/$module/imports/import-$next
183 run_prompt n "CHECKING IN changes in import-$next" \
184 svn ci -m "Changes since $previous"
187 run "Going to $import/$module" \
190 run_prompt $(dir_needs_creation $svn/$module/trunk) "Checking out trunk for applying changes" \
191 svn co $svn/$module/trunk
193 run_prompt n "Merging changes from import-$previous to import-$next into trunk" \
194 svn merge $svn/$module/imports/import-$previous $svn/$module/imports/import-$next trunk
196 run_loop "Check the changes in trunk -- conflicts should get resolved" svn status trunk
198 run_prompt n "CHECKING IN changes in trunk" \
199 svn ci -m "Merged changes from import-$previous to import-$next"
201 prompt=$(svn_url_needs_creation $svn/$module/imports/after-$next)
202 run_prompt $prompt "Backing up into after-$next" \
203 svn copy $svn/$module/$trunk $svn/$module/imports/after-$next
205 run_prompt n "Want to rename $import as $import-to-trash" \
206 mv $import $import-totrash