releng-common/tools/scripts/promoteToEclipse.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.185 - (view) (download) (as text)

1 : nickb 1.1 #!/bin/bash
2 :    
3 :     # TODO: rename $branch to $version, and $cvsbranch to $branch
4 :    
5 :     # New order of steps in promote (others before or after)
6 :     # 0. uploads zips, jars, docs, etc.
7 :     # 1. publish RSS
8 :     # 2. run parsecvs.sh remotely from http://build.eclipse.org/modeling/build/updateSearchCVS.php?projects[]=org.eclipse...&projects[]=org.eclipse...
9 :     # 3ai. block until done by checking http://build.eclipse.org/modeling/emf/news/checkReleaseExists.php?project=emf&version={buildIDorAlias} until value = 1
10 : nickb 1.12 # 3aii. block until done by checking http://build.eclipse.org/modeling/mdt/news/checkReleaseExists.php?project=uml2&version={buildIDorAlias} until value = 1
11 : nickb 1.1 # 3b. timeout if stuck for more than x mins
12 : nickb 1.101 # 4. update bugs (RESOVED:FIXED -> VERIFIED:FIXED), announce in newsgroup, etc.
13 : nickb 1.1
14 : nickb 1.130 # script to update a given build, plus required files on \$downloadServerFullName from CVS
15 : nickb 1.1 # run script on $buildServerFullName to push data to remote eclipse.org server
16 : nickb 1.136 # Copyright \(c\) 2004-2008, IBM. Nick Boldt. codeslave\(at\)ca.ibm.com
17 : nickb 1.1
18 :     # requires accompanying properties file, promoteToEclipse.properties, plus a few minimal commandline switches, like -sub ocl -branch 1.0.0 -buildID ...
19 :     # can also specify any other properties file with -f flag
20 :    
21 :     # This script references the following other scripts:
22 :     # compareFolders (verify upload succeeded)
23 :     # fixJavadocs (javadocs)
24 :    
25 :     ###### ###### ###### ###### ###### ###### INSTRUCTIONS & OPTIONS ###### ###### ###### ###### ###### ######
26 :    
27 :     norm="\033[0;39m";
28 :     grey="\033[1;30m";
29 :     green="\033[1;32m";
30 :     brown="\033[0;33m";
31 :     yellow="\033[1;33m";
32 :     blue="\033[1;34m";
33 :     cyan="\033[1;36m";
34 :     red="\033[1;31m";
35 :    
36 :     function basichelp ()
37 :     {
38 : nickb 1.34 echo -e "You can either specify a CVS path to your properties file and its branch/tag with $red-c$norm, or use $red-sub$norm to specify a file in the current dir.";
39 : nickb 1.176 echo -e "For details on $red-sub$norm and all other flags & overrides, use $brown-h$norm or $brown--help$norm.";
40 : nickb 1.34
41 :     echo "";
42 : nickb 1.130 echo -e "usage: $blue${0##*/}$norm $yellow-d \$CVSROOT$norm $red-c \$projectNamespace/\$subprojectReleng/promoteToEclipse.\$sub.properties,branchOrTag$norm";
43 : nickb 1.91 echo ""
44 : nickb 1.130 echo -e "example: $blue${0##*/}$norm $red-c org.eclipse.emf/org.eclipse.emf.query.releng/promoteToEclipse.query.properties,R1_1_maintenance$norm"
45 :     echo -e "example: $blue${0##*/}$norm $yellow-d :pserver:anonymous@dev.eclipse.org:/cvsroot/tools$norm \\"
46 : nickb 1.100 echo -e " $red-c org.eclipse.gef/org.eclipse.gef.releng/promoteToEclipse.gef.properties,HEAD$norm"
47 : nickb 1.1 echo "";
48 : nickb 1.34 }
49 :    
50 :     function morehelp ()
51 :     {
52 :     echo -e "If not using a properties file in CVS, specify the local file used by this script BEFORE any overrides like $red-branch$norm or $red-buildID$norm."
53 :     echo "";
54 : nickb 1.130 echo -e "usage: $blue${0##*/}$norm";
55 : nickb 1.1 echo -e "$red-sub$norm <REQUIRED: MUST BE FIRST FLAG; if ./promoteToEclipse.${red}sub$norm.properties not found, try ./promoteToEclipse.properties>"
56 :     echo -e "$red-branch$norm <REQUIRED: release version of the files to be promoted, eg., 1.0.0, 1.0.1 (overrides property file)>"
57 :     echo -e "$red-buildID$norm <REQUIRED: ID of the build>"
58 :     echo "";
59 :     echo -e "$red-cvsbranch$norm <REQUIRED for RSS feeds: cvs branch of the release, eg., R2_2_maintenance, HEAD>"
60 :     echo -e "$brown-branchIES$norm <REQUIRED for IES map file: eg., R3_2_maintenance, HEAD>"
61 :     echo ""
62 : nickb 1.15 echo -e "$yellow-q$norm, $yellow-Q$norm <OPTIONAL: scp, unzip, cvs checkout: quiet or VERY QUIET output>"
63 : nickb 1.130 echo -e "$yellow-coordsite$norm, $yellow-coordsiteonly$norm <OPTIONAL: update coordinated site, eg. $grey-coordsite ganymede$norm or $grey-coordsiteonly ganymede$norm>";
64 : nickb 1.175 echo -e "$yellow-hide$norm, $yellow-unhide$norm <OPTIONAL: hide / unhide build from the downloads page to allow it time to mirror>"
65 : nickb 1.176 echo -e "$yellow-announce$norm, $yellow-announceonly$norm <OPTIONAL: post announcement in newsgroup - see properties file for settings>"
66 : nickb 1.57 echo -e " $yellow-announcedelay$norm <OPTIONAL: if used, delay announcement by specified number of seconds>"
67 :     echo -e "$yellow-addSDK$norm <OPTIONAL: if used, add the SDK zip to the specified dependencies file for use with other builds>"
68 : nickb 1.15 echo -e "$yellow-email$norm <OPTIONAL: email to notify when done>"
69 : nickb 1.1 echo ""
70 :     echo -e "-f <OPTIONAL: if used, MUST BE FIRST FLAG; use specific file instead of ./promoteToEclipse.${red}sub$norm.properties>"
71 :     echo "-user <username on *.eclipse.org (default is $USER (\$USER))>"
72 :     echo "-debug <default 0; can be increased to 1 or 2>"
73 :     echo "-tmpfolder <folder to use when working> (optional)"
74 :     echo "-noclean <don't clean up when done (leave tmpfolder)>"
75 :    
76 : nickb 1.37 # no/only options (9): drop, jars, rss, IES, docs, searchcvs, bugz
77 : nickb 1.1 echo ""
78 :     echo "-nodrop, -droponly <do NOT / ONLY upload drop>"
79 :     echo " -noCompareDropsFolders <after uploading the drop, DO NOT compare source and target for matching MD5s, etc.>"
80 :     echo "-nojars, -jarsonly <do NOT / ONLY do Update Manager jars create & upload step>";
81 :     echo " -basebuilderBranch <org.eclipse.releng.basebuilder CVS branch, such as M2_32 or M3_32>"
82 :     echo " -noCompareUMFolders <after uploading the UM jars, DO NOT compare source and target for matching MD5s, etc.>"
83 : nickb 1.48 echo " -notrackstats <do not track stats in site*.xml>"
84 : nickb 1.64 echo " -refreshSiteXMLOnly <refresh site*.xml from CVS and update on remote>"
85 : nickb 1.1
86 :     echo ""
87 :     echo "-norss, -rssonly <do NOT / ONLY gen RSS feed file update for the given buildID & branch> (optional)"
88 :     echo -e " $red-cvsbranch$norm <REQUIRED for RSS feeds: cvs branch of the release, eg., R2_2_maintenance, HEAD>"
89 :     echo " -feedURL <override value set in feedPublish.*.properties, eg. for use with N builds>"
90 :     echo " -feedFile <override value set in feedPublish.*.properties, eg. for use with N builds>"
91 :     echo ""
92 :    
93 :     echo "-noIES, -IESonly <do NOT / ONLY gen IES map file update for the given buildID & branch> (optional)"
94 :     echo -e " $brown-branchIES$norm <REQUIRED for IES map file: eg., R3_2_maintenance, HEAD>"
95 :     echo " -userIES <override value set in .properties file, eg., -userIES nboldt>"
96 : nickb 1.127 echo " -buildAlias <REQUIRED if doing an -IESonly promote for a build which is not located on this server,"
97 :     echo " in order to set \$buildAlias because it cannot be calculated from the SDK zip's name>"
98 : nickb 1.1 echo ""
99 :     echo "-nodocs, -docsonly <do NOT / ONLY do javadocs step>";
100 :     echo "-nosearchcvs, -searchcvsonly <do NOT / ONLY do Search CVS database update>";
101 :    
102 :     echo ""
103 : nickb 1.101 echo -e "$grey-nobugz$norm, $grey-bugzonly$norm <do NOT / ONLY close RESOLVED:FIXED bugs> (optional; see bugs 171745, 191571, 207383)";
104 : nickb 1.110
105 :     echo "";
106 :     echo -e "$grey-nomaven$norm, $grey-mavenonly$norm <do NOT / ONLY gen Maven jars> (optional)";
107 : nickb 1.1 }
108 :    
109 :     function exampleshelp ()
110 :     {
111 :     echo ""
112 :     echo -e "To promote a drop, you need at least $red-sub$norm, $red-branch$norm, $red-buildID$norm, $red-cvsbranch$norm, and $brown-branchIES$norm (if applicable), with optional $yellow-announce$norm and $yellow-Q$norm:"
113 :     echo ""
114 : nickb 1.130 echo -e " $blue${0##*/} $red-sub ocl $yellow-Q -announce $red-branch 1.0.2 $red-buildID M200612071439 $red-cvsbranch R1_0_maintenance $brown-branchIES R3_2_maintenance$norm"
115 :     echo -e " $blue${0##*/} $red-sub uml2 $yellow-Q -announce $red-branch 2.1.0 $red-buildID I200510101000 $red-cvsbranch HEAD $brown-branchIES HEAD$norm"
116 : nickb 1.1 echo ""
117 : nickb 1.130 echo -e " $blue${0##*/} $red-sub emf $yellow-Q -coordsiteonly callisto $red-branch 2.2.2 -buildID M200702010000$green 2>&1 | tee ~/promo_\`date +%Y%m%d_%H%M%S\`.txt$norm"
118 :     echo -e " $blue${0##*/} $red-sub emf $yellow-Q -announceonly $red-branch 2.3.0 -buildID I200611030200$green 2>&1 | tee ~/promo_\`date +%Y%m%d_%H%M%S\`.txt$norm"
119 : nickb 1.1 echo ""
120 :     }
121 :    
122 :     if [ $# -lt 1 ]; then
123 :     basichelp;
124 :     exit 1;
125 :     elif [[ $1 = "-h" ]] || [[ $1 = "--help" ]]; then
126 :     basichelp;
127 :     morehelp;
128 :     exampleshelp;
129 :     exit 1;
130 :     fi
131 :    
132 :     ###### ###### ###### ###### ###### ###### BEGIN SETUP ###### ###### ###### ###### ###### ######
133 :    
134 :     # default to default properties file
135 :     defaultPropertiesFile=./promoteToEclipse.properties
136 : nickb 1.70 propertiesFile=""; # value set by -c
137 :     propertiesFiles=""; # set of values to iterate
138 :     propertiesFileCmd=""; # contains either "" or "-f /path/to/somefile.properties"
139 : nickb 1.91 projRelengRoot=":pserver:anonymous@dev.eclipse.org:/cvsroot/modeling"; # default if not specified when building
140 : nickb 1.127 buildAlias="";
141 : nickb 1.184 updatesDirSuffix="updates"; # path suffix after /modeling/emf/ or /tools/pdt/; default like /modeling/emf/updates/ but some projects might want /tools/pdt/updates/2.0/ instead
142 : nickb 1.70
143 : nickb 1.37 bugz=0;
144 : nickb 1.50 quietSSH="-v";
145 : nickb 1.57 depsFile="";
146 :     announcedelay=0;
147 : nickb 1.175 hiddenBuild=0;
148 : nickb 1.103 hostname="`hostname -f`";
149 :    
150 : nickb 1.120 builduser=$(id www-data 2>&1 | grep "No such user" -c);
151 :     if [[ $builduser -eq 0 ]]; then
152 :     builduser="www-data";
153 :     else
154 :     builduser=$(id apache 2>&1 | grep "No such user" -c);
155 :     if [[ $builduser -eq 0 ]]; then
156 :     builduser="apache";
157 :     else
158 :     builduser="$USER";
159 :     fi
160 :     fi
161 :    
162 : nickb 1.103 # get path to PHP interpreter
163 :     PHP=php
164 :     if [ -x /usr/bin/php ]; then
165 :     PHP=/usr/bin/php
166 :     elif [ -x /usr/bin/php4 ]; then
167 :     PHP=/usr/bin/php4
168 :     elif [ -x /usr/bin/php5 ]; then
169 :     PHP=/usr/bin/php5
170 :     else
171 :     PHP=php
172 :     fi
173 :    
174 :     getCommonScriptsDir ()
175 :     {
176 :     if [[ ! $commonScriptsDir ]]; then
177 :     if [[ $subprojectName == "emf" ]]; then
178 :     commonScriptsDir="/home/www-data/build/modeling/scripts/"; # default for EMF as common != build
179 :     elif [[ $buildScriptsDir ]] && [[ -d $buildScriptsDir ]]; then
180 :     commonScriptsDir=$buildScriptsDir; # same dir for common & build
181 :     elif [[ -d /home/www-data/build/modeling/scripts ]]; then
182 :     commonScriptsDir=/home/www-data/build/modeling/scripts;
183 :     elif [[ -d /opt/public/modeling/build/modeling/scripts ]]; then
184 :     commonScriptsDir=/opt/public/modeling/build/modeling/scripts
185 :     fi
186 :     fi
187 :     }
188 :    
189 :     getCommonScriptsDir;
190 :    
191 :     getBuildCommonFile ()
192 :     {
193 :     webRoot=/var/www/html; if [[ ! -d $webRoot ]]; then webRoot=/opt/public/modeling/public_html/; fi
194 : nickb 1.184 dlsPath=${localWebDir#$webRoot/}; # /var/www/html/modeling/$projectName or /var/www/html/tools/$projectName --> tools/gef or modeling/emf
195 : nickb 1.112 webPath=${localWebDir#$webRoot/}; # /var/www/html/modeling/$projectName or /var/www/html/tools/$projectName --> tools/gef or modeling/emf
196 :     buildCommonFile=$webRoot/$webPath/$subprojectName/build/_common.php;
197 : nickb 1.103 if [[ -f $buildCommonFile ]]; then
198 : nickb 1.117 parent="modeling";
199 : nickb 1.103 else
200 :     WARN="[promote] [1] can't find $buildCommonFile.";
201 :     webPath=$projectName;
202 :     buildCommonFile=$webRoot/$projectName/build/_common.php;
203 :     if [[ -f $buildCommonFile ]]; then
204 :     parent="NONE";
205 :     else
206 :     echo $WARN; echo "[promote] [2] can't find $buildCommonFile: must abort.";
207 :     sendFailureEmail PROMOTE:FAILED:7; exit 2;
208 :     fi
209 :     fi
210 :     }
211 :    
212 :     getDefaultEmail ()
213 :     {
214 : nickb 1.148 defaultEmail="";
215 : nickb 1.147 if [[ ! $buildCommonFile ]]; then getBuildCommonFile; fi
216 :     emailDefault=$(cat $buildCommonFile | grep "EmailDefault");
217 :     emailDefault=${emailDefault#*=> \"};
218 :     emailDefault=${emailDefault%%\"*};
219 : nickb 1.173 emailDefault=${emailDefault//,/ };
220 : nickb 1.151 if [[ $debug -gt 1 ]]; then echo "[email] emailDefault = $emailDefault"; fi
221 :     if [[ ! $email ]]; then
222 : nickb 1.147 emailList=$emailDefault;
223 :     elif [[ $email ]] && [[ $emailDefault ]]; then
224 :     emailList=$email" "$emailDefault;
225 :     fi
226 : nickb 1.151 if [[ $debug -gt 2 ]]; then echo "[email] emailList = $emailList"; fi
227 : nickb 1.147 # prevent dupe entries
228 : nickb 1.151 allEm="";
229 : nickb 1.147 for em in $emailList; do
230 : nickb 1.151 if [[ ${allEm##*$em*} == $allEm ]]; then # email is new
231 : nickb 1.148 if [[ $defaultEmail ]]; then
232 :     defaultEmail=$defaultEmail",";
233 : nickb 1.147 fi
234 : nickb 1.148 defaultEmail=$defaultEmail$em;
235 : nickb 1.151 else
236 :     if [[ $debug -gt 2 ]]; then echo "[email] $em already added."; fi
237 : nickb 1.147 fi
238 : nickb 1.151 allEm=$allEm$em;
239 : nickb 1.147 done
240 : nickb 1.151 if [[ $debug -gt 2 ]]; then echo "[email] defaultEmail = $defaultEmail"; fi
241 : nickb 1.103 }
242 :    
243 :     sendFailureEmail ()
244 :     {
245 :     getDefaultEmail;
246 : nickb 1.148 if [[ $defaultEmail ]]; then
247 :     cmd="$PHP -q $commonScriptsDir/sendEmail.php -email $defaultEmail -hostname $hostname"
248 : nickb 1.103 if [[ $projectName ]]; then cmd=$cmd" -proj $projectName"; fi
249 :     if [[ $subprojectName ]]; then cmd=$cmd" -sub $subprojectName"; fi
250 :     if [[ $cvsbranch ]]; then cmd=$cmd" -branch $cvsbranch"; fi
251 :     if [[ $branch ]]; then cmd=$cmd" -version $branch"; fi
252 :     if [[ $buildID ]]; then cmd=$cmd" -buildID $buildID"; fi
253 :     if [[ $parent ]]; then cmd=$cmd" -parent $parent"; fi
254 :     cmd=$cmd" -promote true -buildStatus $1";
255 : nickb 1.108 $commonScriptsDir/executeCommand.sh "$cmd";
256 : nickb 1.103 fi
257 :     }
258 :    
259 : nickb 1.76 loaded=0;
260 : nickb 1.34 function loadCVSPropertiesFile()
261 :     {
262 :     # Input: org.eclipse.emf/org.eclipse.emf.query.releng/promoteToEclipse.query.properties,R1_1_maintenance
263 : nickb 1.69 tmpProperties=`mktemp -d`; tmpProperties=${tmpProperties#/tmp/};
264 : nickb 1.34 in=$1;
265 :     if [[ ${in##*,*} ]]; then in=$in,HEAD; fi # default branch is HEAD
266 :     cvsPropertiesPath=$in; cvsPropertiesPath=${cvsPropertiesPath%,*}; # org.eclipse.emf/org.eclipse.emf.query.releng/promoteToEclipse.query.properties
267 :     cvsPropertiesBranch=$in; cvsPropertiesBranch=${cvsPropertiesBranch#*,}; # R1_1_maintenance
268 :     cvsPropertiesFile=${cvsPropertiesPath##*/}; # promoteToEclipse.query.properties
269 :     subprojectName=${cvsPropertiesPath##*promoteToEclipse.}; subprojectName=${subprojectName%.properties}; # query
270 :     #echo "cvsPropertiesPath=$cvsPropertiesPath"; echo "cvsPropertiesBranch=$cvsPropertiesBranch"; echo "cvsPropertiesFile=$cvsPropertiesFile"; echo "subprojectName=$subprojectName";
271 : nickb 1.97 pushd /tmp >/dev/null;
272 : nickb 1.101 cvs -d $projRelengRoot -Q ex -r $cvsPropertiesBranch -d $tmpProperties $cvsPropertiesPath
273 : nickb 1.69 if [ -r /tmp/$tmpProperties/$cvsPropertiesFile ]; then
274 : nickb 1.81 subprojectName=${cvsPropertiesFile##*promoteToEclipse.}; subprojectName=${subprojectName%.properties}; # set a default value in case not set in the properties file
275 :     echo " -c $in [loading $cvsPropertiesFile from $cvsPropertiesBranch, sub = $subprojectName ... ";
276 : nickb 1.69 . /tmp/$tmpProperties/$cvsPropertiesFile;
277 :     propertiesFile=/tmp/$tmpProperties/$cvsPropertiesFile
278 : nickb 1.77 propertiesFileCmd="-f $propertiesFile";
279 : nickb 1.76 loaded=1;
280 : nickb 1.81 echo " done]";
281 : nickb 1.34 else
282 :     echo "[promote] Properties file $cvsPropertiesPath not found in CVS for branch/tag $cvsPropertiesBranch. Exiting...";
283 : nickb 1.102 rm -fr /tmp/$tmpProperties;
284 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:1; exit 2;
285 : nickb 1.34 fi;
286 :    
287 :     if [[ ! $subprojectName ]]; then # if not set in properties file
288 :     subprojectName=${cvsPropertiesPath##*promoteToEclipse.}; subprojectName=${subprojectName%.properties}; # query
289 :     fi
290 : nickb 1.97 popd >/dev/null;
291 : nickb 1.34 }
292 :    
293 : nickb 1.110 # for use with -*only flags, zero out all variables
294 :     # no/only options (8): drop, jars, rss, IES, docs, bugz, searchcvs, (maven)
295 :     # yes/only options(2): (coordsite), announce
296 :     function allZero()
297 :     {
298 :     dodrop=0;
299 :     UMjars=0;
300 :     RSS=0;
301 :     IES=0;
302 :     dodocs=0;
303 :     searchCVS=0;
304 :     bugz=0;
305 :     maven=0;
306 : nickb 1.177 coordsite=0;
307 : nickb 1.110 depsFile="";
308 :     }
309 :    
310 : nickb 1.1 # Create local variable based on the input
311 :     echo " "
312 :     echo "[promote] Started `date +%H:%M:%S`. Executing with the following options:"
313 :     while [ "$#" -gt 0 ]; do
314 :     case $1 in
315 : nickb 1.116 '-d'|'-projRelengRoot') projRelengRoot=$2; echo " $1 $2"; shift 1;;
316 : nickb 1.118 '-parent') parent=$2; echo " $1 $2"; shift 1;;
317 : nickb 1.34 '-c') loadCVSPropertiesFile $2; shift 1;;
318 : nickb 1.81 '-f') propertiesFile=$2;
319 :     if [[ -r $propertiesFile ]]; then
320 :     subprojectName=${propertiesFile##*promoteToEclipse.}; subprojectName=${subprojectName%.properties}; # set a default value in case not set in the properties file
321 :     echo " $1 $2 [loading, sub = $subprojectName ... ";
322 : nickb 1.79 . $propertiesFile;
323 :     propertiesFileCmd="-f $propertiesFile";
324 :     loaded=1;
325 : nickb 1.81 echo "done]";
326 : nickb 1.79 else
327 : nickb 1.102 echo "[promote] Properties file $propertiesFile not found. Exiting...";
328 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:2; exit 2;
329 : nickb 1.79 fi;
330 :     shift 1;;
331 : nickb 1.133 '-sub') subprojectName=$2;
332 : nickb 1.1 # chain them together in order of priority: subproj specific one, default
333 : nickb 1.124 propertiesFiles=$propertiesFile" $commonScriptsDir/promoteToEclipse."$subprojectName".properties "$defaultPropertiesFile;
334 : nickb 1.78 if [[ $loaded -eq 0 ]]; then
335 :     for propFile in $propertiesFiles; do
336 :     if [[ $loaded -eq 0 ]] && [[ -r $propFile ]]; then
337 : nickb 1.133 echo -n " $1 $2 [loading $propFile ... ";
338 : nickb 1.78 . $propFile;
339 : nickb 1.124 propertiesFileCmd="-f $propFile";
340 : nickb 1.78 echo "done]";
341 :     loaded=1;
342 :     fi;
343 :     done
344 :     fi
345 : nickb 1.110 if [[ $loaded -eq 0 ]]; then
346 :     echo " [Can't load any of: $propertiesFiles. Exiting!]";
347 :     sendFailureEmail PROMOTE:FAILED:3; exit 2;
348 :     fi
349 : nickb 1.1 shift 1;;
350 :    
351 :     # build details
352 :    
353 :     '-branch') branch=$2; echo " $1 $2"; shift 1;;
354 :     '-buildID') buildID=$2; echo " $1 $2"; shift 1;;
355 :    
356 :     # user/email
357 :    
358 :     '-user') user=$2; echo " $1 $2"; shift 1;;
359 :     '-email') email=$2; echo " $1 $2"; shift 1;;
360 :    
361 : nickb 1.110 # no/only options (8): drop, jars, rss, IES, docs, searchcvs, bugz, maven
362 : nickb 1.1
363 :     '-droponly') allZero; dodrop=1; echo " $1"; shift 0;;
364 :     '-nodrop') dodrop=0; echo " $1"; shift 0;;
365 :     '-noCompareDropsFolders') noCompareDropsFolders=1; echo " $1"; shift 0;;
366 :    
367 :     '-jarsonly') allZero; UMjars=1; echo " $1"; shift 0;;
368 :     '-nojars') UMjars=0; echo " $1"; shift 0;;
369 :     '-basebuilderBranch') basebuilderBranch="-basebuilderBranch $2"; echo " $1 $2"; shift 1;;
370 :     '-noCompareUMFolders') noCompareUMFolders="-noCompareUMFolders"; echo " $1"; shift 0;;
371 : nickb 1.48 '-notrackstats') notrackstats="-notrackstats"; echo " $1"; shift 0;;
372 : nickb 1.64 '-refreshSiteXMLOnly') allZero; refreshSiteXMLOnly="true"; echo " $1"; shift 0;;
373 : nickb 1.1
374 :     '-rssonly') allZero; RSS=1; echo " $1"; shift 0;;
375 :     '-norss') RSS=0; echo " $1"; shift 0;;
376 :     '-cvsbranch') cvsbranch=$2; echo " $1 $2"; shift 1;;
377 :     '-feedURL') feedURL="-DfeedURL=$2"; echo " $1 $2"; shift 1;;
378 :     '-feedFile') feedFile="-Dfile=$2"; echo " $1 $2"; shift 1;;
379 :    
380 :     '-IESonly') allZero; IES=1; echo " $1"; shift 0;;
381 :     '-noIES') IES=0; echo " $1"; shift 0;;
382 :     '-branchIES') branchIES=$2; echo " $1 $2"; shift 1;;
383 :     '-userIES') userIES=$2; echo " $1 $2"; shift 1;;
384 : nickb 1.127 '-buildAlias') buildAlias=$2; echo " $1 $2"; shift 1;;
385 : nickb 1.1
386 :     '-docsonly') allZero; dodocs=1; echo " $1"; shift 0;;
387 :     '-nodocs') dodocs=0; echo " $1"; shift 0;;
388 :    
389 :     '-searchcvsonly') allZero; searchCVS=1; echo " $1"; shift 0;;
390 :     '-nosearchcvs') searchCVS=0; echo " $1"; shift 0;;
391 :    
392 : nickb 1.37 '-bugzonly') allZero; bugz=1; echo " $1"; shift 0;;
393 :     '-nobugz') bugz=0; echo " $1"; shift 0;;
394 :    
395 : nickb 1.110 '-mavenonly') allZero; maven=1; echo " $1"; shift 0;;
396 :     '-nomaven') maven=0; echo " $1"; shift 0;;
397 :    
398 : nickb 1.57 # coordination options
399 : nickb 1.1
400 : nickb 1.57 '-coordsite') coordsite=1; coordsiteName=$2; echo " $1 $2"; shift 1;;
401 :     '-coordsiteonly') allZero; coordsite=1; coordsiteName=$2; echo " $1 $2"; shift 1;;
402 :     '-addSDK') depsFile="$2"; echo " $1 $2"; shift 1;; # [207007]
403 :     '-addSDKonly') allZero; depsFile="$2"; echo " $1 $2"; shift 1;;
404 : nickb 1.1
405 : nickb 1.57 # announcement options
406 :    
407 : nickb 1.182 '-announce') announce=1; echo " $1"; shift 0;;
408 :     '-announceonly') allZero; announce=1; echo " $1"; shift 0;;
409 :     '-announcedelay') announcedelay="$2"; echo " $1 $2"; shift 1;; # [206706]
410 : nickb 1.175
411 : nickb 1.182 '-hide') hiddenBuild=1; echo " $1"; shift 0;; # [262272]
412 :     '-unhide'|'-nohide') allZero; hiddenBuild=-1; echo " $1"; shift 0;; # [262272]
413 : nickb 1.1
414 :     # debug options
415 :    
416 :     '-tmpfolder') tempfold=$2; echo " $1 $2"; shift 1;;
417 : nickb 1.50 '-q') quietCVS=-q; quiet=-q; quietSSH=""; echo " $1"; shift 0;;
418 : nickb 1.72 '-Q') quietCVS=-Q; quiet=-q; quietSSH="-q"; echo " $1"; shift 0;;
419 : nickb 1.1 '-debug') debug=$2; echo " $1 $2"; shift 1;;
420 :     '-noclean') noclean=1; echo " $1"; shift 0;;
421 : nickb 1.19
422 : nickb 1.1 esac
423 :     shift 1
424 :     done
425 :    
426 : nickb 1.80 if [[ ! $subprojectName ]] && [[ $propertiesFileCmd ]]; then # if not set in properties file
427 :     subprojectName=${propertiesFileCmd##*promoteToEclipse.}; subprojectName=${subprojectName%.properties};
428 :     fi
429 :    
430 : nickb 1.1 if [ "$subprojectName" = "" ]; then # no value set!
431 :     echo "[promote] No subproject name set in properties file or by -sub flag. Script cannot continue. Exiting...";
432 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:4; exit 2;
433 : nickb 1.1 fi
434 :    
435 :     if [ "$branch" = "" ]; then # no value set!
436 :     echo "[promote] No branch value set in properties file or by -branch flag. Script cannot continue. Exiting...";
437 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:5; exit 2;
438 : nickb 1.1 fi
439 :    
440 :     if [ "$buildID" = "" ]; then # no value set!
441 :     echo "[promote] No build ID value set in properties file or by -buildID flag. Script cannot continue. Exiting...";
442 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:6; exit 2;
443 : nickb 1.1 fi
444 :    
445 :     # create default temp folder
446 :     mkdir -p /home/$user/tmp;
447 :    
448 :     ###### ###### ###### ###### ###### VARIABLES DERIVED FROM $user ###### ###### ###### ###### ######
449 :    
450 :     # temp folder base (make 'em unique so concurrent builds don't overlap)
451 :     tempfold=/home/$user/tmp/promoteToEclipse-$projectName-$subprojectName-$user-`date +%Y%m%d_%H%M%S`
452 :    
453 :     #users (for ssh and cvs connections)
454 :     buildServerCVSUser=$user"@"$buildServerFullName
455 :     eclipseCVSUser=$user"@"$eclipseServerFullName
456 :     eclipseSSHUser=$user"@"$downloadServerFullName
457 :     eclipseSSHUserHome=$(ssh $eclipseSSHUser "echo \$HOME");
458 :    
459 :     #cvs paths
460 :     coordsiteCVSRep=:ext:$eclipseCVSUser:/cvsroot/callisto
461 :    
462 :     # if no value for userIES, default to commandline -user or value in properties file
463 :     if [ "$userIES" = "" ]; then userIES=$user; fi
464 :     IESCVSRep=":ext:"$userIES"@ottcvs1.ottawa.ibm.com:/home/cvs/com.ibm.ies.releng"
465 :    
466 : nickb 1.103 getCommonScriptsDir;
467 : nickb 1.67
468 : nickb 1.1 ###### ###### ###### ###### ###### SETUP DONE, DEFINE METHODS ###### ###### ###### ###### ######
469 :    
470 :     getBuildIDactual ()
471 :     {
472 : nickb 1.127 if [[ $buildAlias ]]; then
473 :     buildIDactual=$buildAlias
474 :     else
475 : nickb 1.138 buildIDactual=`find $buildDropsDir/$branch/$buildID -iname "$SDKfilenamepattern"`
476 : nickb 1.127 buildIDactual=${buildIDactual##*-}; # trim up to -
477 :     buildIDactual=${buildIDactual%%\.zip}; # trim off .zip
478 :     #echo $buildIDactual
479 :     fi
480 : nickb 1.1 }
481 :    
482 : nickb 1.103 if [[ ! $buildCommonFile ]]; then getBuildCommonFile; fi
483 : nickb 1.89
484 :     hasProblem="";
485 :     hasFailed="";
486 :     # should set noclean=1, hasProblem/hasFailed & cc: default email address
487 :     # if there's a problem in the build
488 : nickb 1.103 checkBuildStatus ()
489 : nickb 1.1 {
490 : nickb 1.89 projectNameActual=$projectName;
491 :     checkBuildStatusURL="http://$hostname/modeling/build/checkBuildStatus.php?parent=$parent&top=$projectName&project=$subprojectName&version=$version";
492 :     checkBuildStatusURL=$checkBuildStatusURL"&buildID=$buildID";
493 :     result=$(wget "$checkBuildStatusURL" -O - 2>/dev/null);
494 :     hasProblem=$(echo $result | egrep "FAIL|ERROR| F| E");
495 :     hasFailed=$(echo $result | egrep "FAIL| F");
496 : nickb 1.103 isUnknown=$(echo $result | egrep "UNKNOWN");
497 : nickb 1.89 if [[ $hasFailed ]]; then noclean=1; fi
498 :    
499 :     # special case for emf/emft
500 :     if [[ $isUnknown ]] && [[ $projectName == "emf" ]]; then
501 :     projectName2="emft";
502 :     checkBuildStatusURL="http://$hostname/modeling/build/checkBuildStatus.php?parent=$parent&top=$projectName2&project=$subprojectName&version=$version";
503 :     checkBuildStatusURL=$checkBuildStatusURL"&buildID=$buildID";
504 :     result=$(wget "$checkBuildStatusURL" -O - 2>/dev/null);
505 :     hasProblem=$(echo $result | egrep "FAIL|ERROR| F| E");
506 :     hasFailed=$(echo $result | egrep "FAIL| F");
507 :     isUnknown=$(echo $result | egrep "UNKNOWN");
508 :     if [[ ! $isUnknown ]]; then
509 :     projectNameActual=$projectName2;
510 :     fi
511 :     if [[ $hasFailed ]]; then noclean=1; fi
512 :     fi
513 : nickb 1.74 if [[ $hasProblem ]]; then
514 : nickb 1.103 getDefaultEmail;
515 : nickb 1.74 fi
516 : nickb 1.89 }
517 :    
518 :     # must call checkBuildStatus before sendEmail to ensure we have all the right email addresses listed (user-defined + default/backup)
519 :     sendEmail ()
520 :     {
521 : nickb 1.74 if [[ $email ]]; then
522 :     $commonScriptsDir/executeCommand.sh "$PHP -q $commonScriptsDir/sendEmail.php \
523 : nickb 1.89 -email $email -proj $projectNameActual -sub $subprojectName \
524 : nickb 1.90 -branch $cvsbranch -version $branch -buildID $buildID \
525 : nickb 1.89 -hostname $hostname -parent $parent \
526 :     -promote true";
527 : nickb 1.1 fi
528 :     }
529 :    
530 :     ###### ###### ###### ###### METHODS DONE, BEGIN WORK HERE ###### ###### ###### ######
531 :    
532 :     buildIDactual=buildID;
533 : nickb 1.96 webuser=$(grep www /etc/passwd | head -1 | perl -pe "s/(^[^:]+):.+$/\1/g");
534 : nickb 1.1
535 : nickb 1.175 # user@cvsServer:/path/to/cvs/root
536 :     cvsRoot=$user@dev.eclipse.org:/cvsroot/org.eclipse
537 :     # cvs/module/path, eg., www/modeling/emf/ or www/pdt/
538 :     cvsPath=www/${baseBuildDir##/home/www-data/build/}/downloads
539 : nickb 1.181 uniqueBuildPath=${baseBuildDir##/home/www-data/build/}/$branch/$buildID
540 : nickb 1.175
541 :     if [[ $hiddenBuild -gt 0 ]]; then # 1
542 : nickb 1.181 echo "[promote] Build will be hidden to allow time for mirrors to rsync."
543 : nickb 1.175 echo ""
544 :     echo "[promote] Remember to delete this line from $cvsRoot:$cvsPath/hidden.txt"
545 :     echo ""
546 : nickb 1.181 echo " *** $uniqueBuildPath ***"
547 : nickb 1.175 echo ""
548 :     tmpdir=`mktemp -d`
549 :     pushd $tmpdir >/dev/null
550 :     cvs -d $cvsRoot -Q co $cvsPath
551 :     cd $cvsPath
552 :     # add a line of text
553 : nickb 1.181 if [[ ! -f hidden.txt ]]; then touch hidden.txt; cvs add -k v -m "new" hidden.txt; fi
554 :     echo "$uniqueBuildPath" >> hidden.txt
555 :     cvs ci -m "[+] $uniqueBuildPath" hidden.txt
556 : nickb 1.175 popd >/dev/null
557 :     rm -fr $tmpdir
558 :     elif [[ $hiddenBuild -lt 0 ]]; then # -1
559 : nickb 1.181 echo "[promote] Build $uniqueBuildPath will be unhidden."
560 :     echo "[promote] Should be visible online within 30-60 seconds."
561 : nickb 1.175 tmpdir=`mktemp -d`
562 :     pushd $tmpdir >/dev/null
563 :     cvs -d $cvsRoot -Q co $cvsPath
564 :     cd $cvsPath
565 :     # clean out a line of text
566 :     if [[ -f hidden.txt ]]; then
567 : nickb 1.181 cat hidden.txt | grep -v "$uniqueBuildPath" > hidden.txt.tmp; mv -f hidden.txt.tmp hidden.txt
568 :     cvs ci -m "[-] $uniqueBuildPath" hidden.txt
569 : nickb 1.175 fi
570 :     popd >/dev/null
571 :     rm -fr $tmpdir
572 :     else
573 : nickb 1.181 echo "[promote] Build $uniqueBuildPath will be shown."
574 :     echo "[promote] Should be visible online within 30-60 mins."
575 : nickb 1.175 fi
576 :    
577 : nickb 1.1 if [ $dodrop -eq 0 ]; then
578 :     echo "[promote] Upload new drop - omitted."
579 :     else
580 :     echo "[promote] Remove any temp files left over from a -noclean build"
581 :     for f in \
582 :     `find $buildDropsDir/$branch/$buildID -type d -name "org.eclipse*releng*"` \
583 : nickb 1.161 $buildDropsDir/$branch/$buildID/packaging $buildDropsDir/$branch/$buildID/testing $buildDropsDir/$branch/$buildID/eclipse; do
584 : nickb 1.96 if [ -d $f ]; then sudo -u $webuser rm -fr $f; fi
585 : nickb 1.1 done
586 :     echo "[promote] [`date +%H:%M:%S`] Create target drop folder $projectDropsDir/$branch/$buildID on remote box started:"
587 :     ssh $eclipseSSHUser mkdir -p $projectDropsDir/$branch/$buildID
588 :     echo "[promote] [`date +%H:%M:%S`] Create target drop folder $projectDropsDir/$branch/$buildID on remote box done."
589 :    
590 : nickb 1.137 echo "[promote] [`date +%H:%M:%S`] SCP build folder $branch/$buildID onto remote box started:"
591 : nickb 1.145 rsync -ar $quietSSH --rsh=ssh --exclude='*-Update-*.zip*' --exclude='*-Master-*.zip*' $buildDropsDir/$branch/$buildID $eclipseSSHUser:$projectDropsDir/$branch/
592 : nickb 1.1 echo "[promote] [`date +%H:%M:%S`] SCP build folder $branch/$buildID onto remote box done."
593 :    
594 :     if [ $noCompareDropsFolders -eq 0 ]; then
595 :     ### CHECK MD5s and compare dir filesizes for match (du -s)
596 :     echo "[promote] [`date +%H:%M:%S`] Comparing local and remote folders to ensure SCP completeness... "
597 : nickb 1.67 $commonScriptsDir/compareFolders.sh -user $user -local $buildDropsDir/$branch/$buildID -remote $projectDropsDir/$branch/$buildID -server $eclipseSSHUser
598 : nickb 1.1 returnCode=$?
599 :     if [ $returnCode -gt 0 ]; then
600 :     echo "[promote] [`date +%H:%M:%S`] ERROR! Script exiting with code $returnCode from compareFolders.sh"
601 :     exit $returnCode;
602 :     fi
603 :     else
604 :     echo "[promote] [`date +%H:%M:%S`] Comparing local and remote folders to ensure SCP completeness ... omitted."
605 :     fi
606 :    
607 : nickb 1.29 # removed 20070608
608 :     #echo "[promote] [`date +%H:%M:%S`] CHMOD build folder $branch/$buildID on remote box to give group perms started:"
609 :     # ssh $eclipseSSHUser "
610 :     # chmod -R $eclipsePermsDir $projectDropsDir/$branch/$buildID
611 :     # chgrp -fR $eclipseUserGroup $projectDropsDir/$branch/$buildID
612 :     # "
613 :     # ## must keep closing quote on preceeding line to close the ssh command section
614 :     #echo "[promote] [`date +%H:%M:%S`] CHMOD build folder $branch/$buildID on remote box to give group perms done."
615 : nickb 1.1 fi
616 :    
617 : nickb 1.57 # add build to dependencies file?
618 :     if [[ $depsFile != "" ]]; then
619 :     if [[ -f $depsFile ]]; then
620 : nickb 1.121 sudo -u $builduser chmod g+w $depsFile; sudo -u $builduser chgrp www $depsFile;
621 : nickb 1.57 depNum=$(cat $depsFile | grep "$subprojectName=" | tail -1); depNum=${depNum%%$subprojectName=*};
622 : nickb 1.58 SDKURL=$(find $buildDropsDir/$branch/$buildID -maxdepth 1 -name "$SDKfilenamepattern" | tail -1);
623 : nickb 1.57 if [[ $SDKURL != "" ]]; then
624 :     SDKURL=${SDKURL##$buildDropsDir/$branch/$buildID}; SDKURL=${SDKURL##*/};
625 : nickb 1.107 SDKURL=http://$hostname/$dlsPath/$subprojectName/downloads/drops/$branch/$buildID/$SDKURL; # TODO fix for GEF
626 : nickb 1.121 if [[ -w $depsFile ]]; then
627 :     echo "$depNum$subprojectName=$SDKURL" >> $depsFile;
628 :     echo "[promote] $SDKURL ($depNum$subprojectName) appended to $depsFile.";
629 :     else
630 :     echo "[promote] *** WARNING: File $depsFile is not writable. Add this manually:";
631 :     echo "$depNum$subprojectName=$SDKURL"
632 :     echo "[promote] ***";
633 :     fi
634 : nickb 1.57 else
635 : nickb 1.58 echo "[promote] *** WARNING: no SDK zip found in $buildDropsDir/$branch/$buildID. ***";
636 : nickb 1.57 fi
637 :     else
638 : nickb 1.58 echo "[promote] *** WARNING: cannot store SDK. File $depsFile does not exist. ***";
639 : nickb 1.57 fi
640 :     fi
641 :    
642 : nickb 1.60 function refreshUpdates ()
643 :     {
644 : nickb 1.63 # purge updates site*.xml and refresh anonymously from cvs
645 : nickb 1.184 pushd $localWebDir/${updatesDirSuffix} >/dev/null;
646 :     for f in $(find $localWebDir/${updatesDirSuffix} -type f -name "site*.xml" -o -name ".#site*"); do
647 : nickb 1.134 rm -f $f;
648 :     done
649 : nickb 1.184 echo ":pserver:anonymous@dev.eclipse.org:/cvsroot/org.eclipse" > $localWebDir/${updatesDirSuffix}/CVS/Root
650 : nickb 1.135 cvs -Q up -Pd >/dev/null 2>&1;
651 : nickb 1.60 chmod -R g+w site*.xml;
652 :     chgrp -R $buildUserGroup site*.xml;
653 : nickb 1.97 popd >/dev/null;
654 : nickb 1.60 }
655 :    
656 : nickb 1.64 if [[ $refreshSiteXMLOnly ]]; then
657 : nickb 1.60 echo "[promote] Refresh updates folder (site*.xml) ...";
658 :     refreshUpdates;
659 : nickb 1.66 echo "[promote] Promote site*.xml to $downloadServerFullName ...";
660 : nickb 1.184 pushd $localWebDir/${updatesDirSuffix} >/dev/null;
661 :     scp -r $quiet site*.xml $user"@"$downloadServerFullName:$projectWWWDir/${updatesDirSuffix};
662 : nickb 1.97 popd >/dev/null;
663 : nickb 1.64 else
664 :     if [[ $UMjars -eq 0 ]]; then
665 :     echo "[promote] Create & promote Update Manager jars to download ... omitted [-nojars]."
666 :     else
667 :     echo "[promote] [`date +%H:%M:%S`] Create & promote Update Manager jars to download started:"
668 :    
669 :     echo "[promote] Refresh updates folder (site*.xml) ...";
670 :     refreshUpdates;
671 :    
672 : nickb 1.130 echo "[promote] Running buildUpdateSite.sh:"
673 : nickb 1.131 cmd="./buildUpdateSite.sh $propertiesFileCmd -sub $subprojectName -user $user $quietCVS -branch $branch -buildID $buildID -catgXMLOnly -promote $notrackstats $basebuilderBranch -debug $debug";
674 : nickb 1.104 if [[ $parent ]]; then cmd=$cmd" -parent $parent"; fi
675 :     if [[ $coordsiteName ]]; then cmd=$cmd" -coordsite $coordsiteName"; fi
676 : nickb 1.123 pushd $commonScriptsDir >/dev/null; $cmd; popd >/dev/null;
677 : nickb 1.64 echo "[promote] [`date +%H:%M:%S`] Create & promote Update Manager jars to download done."
678 : nickb 1.28 fi
679 : nickb 1.1 fi
680 :    
681 : nickb 1.60 function refreshFeeds ()
682 :     {
683 :     # purge feeds folder and refresh from cvs
684 :     cd $localWebDir;
685 :     rm -fr $localWebDir/feeds;
686 : nickb 1.152 cvs $quiet up -Pd feeds;
687 : nickb 1.60 chmod -R g+w feeds;
688 :     chgrp -R $buildUserGroup feeds;
689 :     }
690 :    
691 : nickb 1.19 ### Update Eclipse Project RSS feed file
692 : nickb 1.1 if [ "$RSS" -eq 0 ]; then
693 :     echo "[promote] Update RSS feed - omitted."
694 :     elif [ "$RSS" -eq 1 ]; then
695 :     echo "[promote] Update RSS feed ..."
696 :    
697 : nickb 1.60 echo "[promote] Refresh RSS feeds folder..."
698 :     refreshFeeds;
699 :    
700 : nickb 1.1 cd $buildScriptsDir;
701 :    
702 :     if [ "$cvsbranch" = "" ]; then # no value set!
703 :     echo "[promote] No CVS branch value set in properties file or by -cvsbranch flag. Script cannot continue. Exiting...";
704 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:8; exit 2;
705 : nickb 1.1 fi
706 :    
707 :     getBuildIDactual; buildAlias=$buildIDactual;
708 : nickb 1.132 buildType=${buildID:0:1};
709 :     typeSuffix=""; if [ "$buildType" = "N" ]; then typeSuffix="\-N"; fi
710 : nickb 1.1 if [[ $debug -gt 0 ]]; then echo "[promote] Using buildAlias = $buildIDactual, branch = $branch, buildID = $buildID"; fi
711 :    
712 :     # find dependencyURLs from $buildDropsDir/$branch/$buildID/buildlog.txt
713 :     # http://download.eclipse.org/downloads/drops/M20060609-1217/eclipse-SDK-M20060609-1217-linux-gtk.tar.gz
714 : nickb 1.19 # http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.2.0/I200606150000/emf-sdo-xsd-SDK-I200606150000.zip
715 : nickb 1.1 dependencyURLs="";
716 :     for dep in `head -50 $buildDropsDir/$branch/$buildID/buildlog.txt | grep "\-URL" | sed -e "s/^[^hf]\\+//g" -e "s/fullmoon\..\\+\.ibm\.com/download.eclipse.org/g" | sort | uniq`; do
717 :     if [ "x$dependencyURLs" != "x" ]; then dependencyURLs="$dependencyURLs,"; fi # join with commas
718 :     dependencyURLs=$dependencyURLs"$dep";
719 :     if [[ $debug -gt 0 ]]; then echo "[promote] Using URL = $dep"; fi
720 :     done
721 : nickb 1.19 # http://download.eclipse.org/downloads/drops/M20060609-1217/eclipse-SDK-M20060609-1217-linux-gtk.tar.gz,http://download.eclipse.org/modeling/emf/emf/downloads/drops/2.2.0/I200606150000/emf-sdo-xsd-SDK-I200606150000.zip
722 : nickb 1.1
723 :     export JAVA_HOME=/opt/sun-java2-5.0;
724 : nickb 1.158 export ANT_HOME=/opt/apache-ant-1.7;
725 : nickb 1.1
726 : nickb 1.25 # extract jar from CVS if not available (first time only - this will only work if run as web user (www-data, apache) on emf.toro or emft.eclipse
727 :     #+ not a problem on build.eclipse running as modelingBuild
728 : nickb 1.1 if [ ! -f feedTools.jar ]; then $ANT_HOME/bin/ant -f feedWatchSetup.xml; fi
729 : nickb 1.130
730 : nickb 1.1 mkdir -p $tempfold/rss;
731 :     # replace %%project%% (ocl, transaction, etc.); %%typeSuffix%% ("-N" or ""); %%user%% (cdamus, nickb, etc.) with actual values
732 : nickb 1.52 SDKzip=$(find $buildDropsDir/$branch/$buildID -name "$SDKfilenamepattern"); SDKzip=${SDKzip##*/}; # trim path
733 : nickb 1.102 if [[ ! $SDKzip ]]; then
734 : nickb 1.146 echo "No SDK zip found for $buildDropsDir/$branch/$buildID/$SDKfilenamepattern -- script cannot continue. Exiting... ";
735 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:9; exit 2;
736 : nickb 1.102 fi
737 : nickb 1.52 echo "[promote] Using SDK = $SDKzip";
738 : nickb 1.51 cat feedPublish.$projectName.properties | sed \
739 :     -e "s/%%user%%/$user/g" \
740 :     -e "s/%%typeSuffix%%/$typeSuffix/g" \
741 :     -e "s/%%project%%/$subprojectName/g" \
742 :     -e "s/%%SDKzip%%/$SDKzip/g" \
743 :     > $tempfold/rss/feedPublish.$subprojectName.properties
744 : nickb 1.1
745 :     CLASSPATH="$JAVA_HOME/lib/rt.jar:"$ANT_HOME/lib/ant.jar":"$ANT_HOME/lib/ant-launcher.jar;
746 :     cmd="$JAVA_HOME/bin/java -Dant.home=$ANT_HOME -Dant.library.dir=$JAVA_HOME/lib -classpath $CLASSPATH org.apache.tools.ant.launch.Launcher"
747 :     cmd=$cmd" -buildfile feedPublish.xml -propertyfile $tempfold/rss/feedPublish.$subprojectName.properties"
748 :    
749 :     # override values in properties file with current values (or assign dynamic/missing values)
750 :     # TODO: rename $branch to $version, and $cvsbranch to $branch
751 :     cmd=$cmd" -Dproject=$subprojectName -Dversion=$branch -Dbranch=$cvsbranch -DbuildID=$buildID -DbuildAlias=$buildAlias -DbuildType=$buildType";
752 :     cmd=$cmd" -DdependencyURLs=$dependencyURLs -Ddebug=$debug $feedURL $feedFile";
753 : nickb 1.3 echo ""; echo $cmd | perl -pe "s/ -/\n -/g" | perl -pe "s/\.jar:/\.jar\n :/g"; echo "";
754 : nickb 1.1 $cmd;
755 :    
756 :     # note: created files will not have the correct group ownership / perms
757 :     echo "[promote] feed update done."
758 :     fi
759 :    
760 :     if [ "$IES" -eq 0 ]; then
761 :     echo "[promote] Update IES map file - omitted."
762 :     elif [ "$IES" -eq 1 ]; then
763 :     # update the IES mapping file: checkout file, edit it, then check back in (commit)
764 :     if [ "$branchIES" = "" ]; then # no value set!
765 :     echo "[promote] No IES branch value set in properties file or by -branchIES flag. Script cannot continue. Exiting...";
766 : nickb 1.103 sendFailureEmail PROMOTE:FAILED:10; exit 2;
767 : nickb 1.1 fi
768 :    
769 :     getBuildIDactual;
770 : nickb 1.85 # create file in /home/cvs/com.ibm.ies.releng/com.ibm.ies.releng/maps/
771 :     if [[ $projectName == $subprojectName ]] || [[ ! $subprojectName ]]; then
772 :     IESmapfile=$projectName".map"; # EMF, GEF
773 :     else
774 :     IESmapfile=$projectName"-"$subprojectName".map"; # all others
775 :     fi
776 :     echo "[promote] Got actual buildID: $buildIDactual, IES branch: $branchIES, mapfile: com.ibm.ies.releng/maps/$IESmapfile";
777 : nickb 1.1
778 :     # setup
779 :     tmpfolder=$tempfold/ies; mkdir -p $tmpfolder/1; cd $tmpfolder;
780 :    
781 :     # checkout
782 :     if [ "$branchIES" != "HEAD" ]; then branchIES="-r "$branchIES; else branchIES=""; fi
783 :     cvscmd="cvs -d $IESCVSRep $quietCVS co $branchIES -P -d 1 com.ibm.ies.releng/maps";
784 :     if [[ $debug -gt 0 ]]; then echo "[promote] [`date +%H:%M:%S`] "$cvscmd; fi
785 :     $cvscmd;
786 :     echo "[promote] [`date +%H:%M:%S`] done."
787 : nickb 1.128 if [[ $projectName == $subprojectName ]] && [[ $subprojectName == "gef" ]]; then
788 : nickb 1.111 IESwebPath=http://fullmoon.ottawa.ibm.com/${dlsPath}/downloads/drops/$branch/$buildID/; # GEF
789 : nickb 1.109 else
790 : nickb 1.111 IESwebPath=http://fullmoon.ottawa.ibm.com/${dlsPath}/$subprojectName/downloads/drops/$branch/$buildID/; # all in Modeling
791 : nickb 1.109 fi
792 : nickb 1.1 #edit file, then make a copy in the other folder
793 :     echo "[promote] Writing $IESmapfile ...";
794 :     outfile=$tmpfolder/1/$IESmapfile
795 :    
796 :     index=0;
797 :     element_count=${#IESmapfileArray[@]}
798 :     while [ "$index" -lt "$element_count" ]; do
799 : nickb 1.111 # eg., echo "$projectName-SDK-$buildIDactual.zip=$IESwebPath | | | sdk | $projectName" >> $outfile.tmp ;
800 :     txt=${IESmapfileArray[$index]/buildIDactual/$buildIDactual}; txt=${txt/webPath/$IESwebPath};
801 : nickb 1.1 echo $txt >> $outfile.tmp;
802 :     let "index = $index + 1";
803 :     done
804 :    
805 :     ## adds optional cvs add command
806 :     cd $tmpfolder/1 ;
807 :     if [ ! -f $IESmapfile ]; then
808 :     echo "[promote] [`date +%H:%M:%S`] add $IESmapfile"; ## add if not found
809 :     mv -f $IESmapfile.tmp $IESmapfile ;
810 :     cvs -d $IESCVSRep $quietCVS add -k v -m "promoteToEclipse: new map file" $IESmapfile;
811 :     else
812 :     dif=`diff -q $IESmapfile.tmp $IESmapfile`; # echo $dif;
813 :     if [ "x$dif" = "x" ]; then # remove temp file, it's the same as the previous
814 :     echo "[promote] [`date +%H:%M:%S`] $IESmapfile exists, no change "; ## no add if found
815 :     rm -f $IESmapfile.tmp ;
816 :     else # files differ
817 :     echo "[promote] [`date +%H:%M:%S`] $IESmapfile exists, updating "; ## no add if found
818 :     mv -f $IESmapfile.tmp $IESmapfile ;
819 :     fi
820 :     fi
821 :    
822 :     #check in
823 :     cvs -d $IESCVSRep $quietCVS ci -m "promoteToEclipse: $branch/$buildID";
824 :     echo "[promote] [`date +%H:%M:%S`] done." ;
825 :    
826 :     fi
827 :    
828 :     if [ "$dodocs" -eq 0 ]; then
829 :     echo "[promote] Unzip new javadocs - omitted."
830 :     else
831 :    
832 :     echo "[promote] [`date +%H:%M:%S`] Javadoc creation started: "
833 :     index=0;
834 :     element_count=${#javadocTargetArray[@]}
835 :     while [ "$index" -lt "$element_count" ]; do
836 : nickb 1.97 pushd $commonScriptsDir >/dev/null; ./fixJavadocs.sh $propertiesFileCmd ${javadocTargetArray[$index]} $quiet -user $user -branch $branch -buildID $buildID; popd >/dev/null;
837 : nickb 1.1 let "index = $index + 1"
838 :     done
839 :     echo "[promote] [`date +%H:%M:%S`] Javadoc creation done."
840 :     fi
841 :    
842 :     # run parsecvs.sh remotely http://build.eclipse.org/modeling/build/updateSearchCVS.php?projects[]=org.eclipse...&projects[]=org.eclipse...
843 :     # block until done by checking http://build.eclipse.org/modeling/emf/news/checkReleaseExists.php?project=emf&version={buildIDorAlias} until value = 1
844 : nickb 1.12 # block until done by checking http://build.eclipse.org/modeling/mdt/news/checkReleaseExists.php?project=uml2&version={buildIDorAlias} until value = 1
845 : nickb 1.1 # timeout if stuck for more than x mins
846 :    
847 : nickb 1.156 updateSearchCVSDisabled=1; # DISABLED by bug 250820
848 : nickb 1.37 function updateSearchCVS ()
849 :     {
850 : nickb 1.153 if [[ $updateSearchCVSDisabled -ne 1 ]]; then
851 :     echo "[promote] [`date +%H:%M:%S`] Update Search CVS & Release Notes database ...";
852 :     parsecvsCmd="http://build.eclipse.org/modeling/build/updateSearchCVS.php?";
853 :     if [[ $subprojectName == "emf" ]]; then
854 :     i=0;
855 :     while [[ $i -lt ${#cvsModulesArray[@]} ]]; do
856 :     # projects[]=cvssrc/projectName-subprojectNamespace (cvssrc/emf-org.eclipse.emf.ecore.sdo) or
857 :     # projects[]=cvssrc_branches/projectName-subprojectNamespace-cvsbranch (cvssrc_branches/mdt-org.eclipse.xsd-R2_2_maintenance)
858 :     if [[ $cvsbranch = "HEAD" ]]; then
859 :     parsecvsCmd=$parsecvsCmd"projects%5B%5D=cvssrc%2F"${cvsModulesArray[$i]}"&";
860 :     else
861 :     parsecvsCmd=$parsecvsCmd"projects%5B%5D=cvssrc_branches%2F"${cvsModulesArray[$i]}"-"$cvsbranch"&";
862 :     fi
863 :     let "i = $i + 1"
864 :     done
865 :     elif [[ $projectName == "emf" ]] || [[ $projectName == "emft" ]]; then
866 :     parsecvsCmd=$parsecvsCmd"projects%5B%5D=cvssrc%2F"$projectName"-org.eclipse.emf."$subprojectName"&";
867 :     else
868 :     parsecvsCmd=$parsecvsCmd"projects%5B%5D=cvssrc%2F"$projectName"-org.eclipse."$subprojectName"&";
869 :     fi
870 :     tmpfile=`mktemp`.updateSearchCVS;
871 :     echo "[promote] wget -q -O $tmpfile \"$parsecvsCmd\"";
872 :     echo "";
873 :     wget -q -O $tmpfile $parsecvsCmd; sleep 2; grep "Error: no valid projects added" $tmpfile; grep "h3" -A2 $tmpfile; rm -f $tmpfile;
874 :     echo "";
875 :     echo "[promote] Parallel update job started.";
876 : nickb 1.54 else
877 : nickb 1.153 echo "[promote] [`date +%H:%M:%S`] Update Search CVS & Release Notes database: DISABLED on line 801 of promoteToEclipse.sh.";
878 : nickb 1.37 fi
879 :     }
880 :    
881 : nickb 1.156 #if [[ $searchCVS -eq 1 ]]; then
882 :     # updateSearchCVS; # DISABLED by bug 250820
883 :     #else
884 :     echo "[promote] [`date +%H:%M:%S`] Update Release Notes & Search CVS database ... DISABLED.";
885 :     #fi
886 : nickb 1.37
887 :     if [[ $bugz -eq 0 ]]; then
888 : nickb 1.101 echo "[promote] Change RESOLVED:FIXED bugs to VERIFIED:FIXED - omitted."
889 : nickb 1.37 else
890 :     getBuildIDactual;
891 : nickb 1.154 if [[ $updateSearchCVSDisabled -ne 1 ]]; then
892 :     echo "[promote] [`date +%H:%M:%S`] Update Search CVS started: checking up to $searchCVSTimeout seconds for verification...";
893 :     if [[ $checkReleaseExists -eq 1 ]]; then
894 :     url="http://build.eclipse.org/$webPath/news/checkReleaseExists.php?project=$subprojectName&version=$buildIDactual";
895 :     tmpfile=`mktemp`;
896 :     wget -q -O $tmpfile "$url";
897 : nickb 1.157 # DISABLED by bug 250820
898 :     #if [[ $(cat $tmpfile) -ne 1 ]]; then
899 : nickb 1.154 # force a database update
900 : nickb 1.157 #updateSearchCVS;
901 :     #fi
902 : nickb 1.37 rm -f $tmpfile;
903 : nickb 1.154
904 :     if [[ $searchCVSTimeout -gt 0 ]]; then
905 :     elapsed=0;
906 :     while [[ $elapsed -lt $searchCVSTimeout ]]; do
907 :     echo -n "[promote] $elapsed: $url ... ";
908 :     rm -f $tmpfile;
909 :     wget -q -O $tmpfile "$url";
910 :     if [[ $(cat $tmpfile) -ne 1 ]]; then echo ""; sleep 30s; (( elapsed += 30 ));
911 :     else echo "done!"; break 1; fi
912 :     done
913 :     rm -f $tmpfile;
914 :     if [[ $elapsed -ge $searchCVSTimeout ]]; then
915 :     echo "[promote] [`date +%H:%M:%S`] Update Search CVS may have taken more than $searchCVSTimeout seconds to complete.";
916 :     echo "[promote] Giving up verification and continuing script. You may have to re-run the following step.";
917 :     fi
918 :     fi
919 : nickb 1.37 fi
920 : nickb 1.154 else
921 :     echo "[promote] [`date +%H:%M:%S`] Update Search CVS & Release Notes database: DISABLED on line 801 of promoteToEclipse.sh.";
922 : nickb 1.37 fi
923 : nickb 1.101 echo "[promote] [`date +%H:%M:%S`] Changing RESOLVED:FIXED bugs to VERIFIED:FIXED ... ";
924 : nickb 1.37
925 : nickb 1.97 pushd $commonScriptsDir >/dev/null;
926 : nickb 1.37
927 :     # extract jar from CVS if not available (first time only) -- this will only work if run as www-data user
928 : nickb 1.86 if [ ! -f $commonScriptsDir/bugTools.jar ]; then sudo -u www-data $ANT -f $commonScriptsDir/updateBugStateSetup.xml; sudo -u www-data chmod +x $buildScriptsDir/*.sh; fi
929 : nickb 1.37
930 :     loginfile=/home/$user/.ssh/UpdateBugStateTask.properties
931 :     bugzillaLoginID="";
932 :     bugzillaLoginCookie="";
933 :    
934 :     getBuildIDactual;
935 :     if [ "$buildIDactual" != "$buildID" ]; then
936 :     buildAliasFlag="-buildAlias $buildIDactual";
937 :     relnotesver=$buildIDactual;
938 :     else
939 :     buildAliasFlag="";
940 :     relnotesver=$buildIDactual;
941 :     fi
942 :    
943 : nickb 1.149 relnotesURL="http://build.eclipse.org/$webPath/news/relnotes.php?project="$subprojectName"&version="$relnotesver"&bugzonly&strict";
944 : nickb 1.37 echo -n "[promote] Check $relnotesURL ... ";
945 :     bugList=$(curl "$relnotesURL" 2>&1 | egrep "[0-9]+;[0-9]{0,6}"); echo -n " found "${bugList%;*}" bugs: "; bugList=${bugList#*;}; echo $bugList;
946 : nickb 1.70
947 : nickb 1.157 # EMF Special Case -- EMF + XSD
948 : nickb 1.70 if [ "$subprojectName" = "emf" ]; then
949 : nickb 1.149 relnotesURL="http://build.eclipse.org/modeling/mdt/news/relnotes.php?project=xsd&version="$relnotesver"&bugzonly&strict";
950 : nickb 1.70 echo -n "[promote] Check $relnotesURL ... ";
951 :     bugList2=$(curl "$relnotesURL" 2>&1 | egrep "[0-9]{5,6}"); echo -n " found "${bugList2%;*}" bugs: "; bugList2=${bugList2#*;}; echo $bugList2;
952 :     if [[ ! $bugList ]]; then bugList=$bugList2; else bugList=$bugList","$bugList2; fi
953 :     bugList2="";
954 :     fi
955 :    
956 : nickb 1.37 echo "[promote] Found the following bugs for release $relnotesver: $bugList";
957 :    
958 :     if [ -r $loginfile ]; then
959 :     bugzillaLoginID=`head -1 $loginfile`; bugzillaLoginID=${bugzillaLoginID#login=};
960 :     bugzillaLoginCookie=`head -2 $loginfile | tail -1`; bugzillaLoginCookie=${bugzillaLoginCookie#logincookie=};
961 :     fi
962 :    
963 : nickb 1.86 cmd="$commonScriptsDir/updateBugState.sh -login $bugzillaLoginID -logincookie $bugzillaLoginCookie -commonScriptsDir $commonScriptsDir \
964 : nickb 1.87 -in RESOLVED:FIXED -out VERIFIED:FIXED -bugList $bugList $buildAliasFlag -buildID $buildID -branch $cvsbranch -version $branch";
965 : nickb 1.37 if [ $debug -gt 0 ]; then cmd=$cmd" -debug $debug"; fi
966 :    
967 :     if [ "x$bugzillaLoginID" == "x" ] || [ "x$bugzillaLoginCookie" == "x" ]; then
968 :     if [ "x$bugzillaLoginID" == "x" ]; then echo "[promote] ERROR: login cannot be read from "$loginfile".";
969 :     elif [ "x$bugzillaLoginCookie" == "x" ]; then echo "[promote] ERROR: logincookie cannot be read from "$loginfile"."; fi
970 :     echo "[promote] Run \`./bugzillaLogin.sh 2> $loginfile\` to regenerate login credentials."
971 : nickb 1.47 echo "[promote] Then use '-bugzonly' (or manually update bugs in Bugzilla).";
972 : nickb 1.37 elif [ "x$bugList" == "x" ]; then
973 :     echo "[promote] Check the above query - no bugs found for this release. Nothing to do!";
974 :     else
975 :     if [ $debug -gt 0 ]; then
976 :     echo -n "Running "; echo "$cmd" | perl -pe "s/ -/\n -/g";
977 :     else
978 :     echo "[promote] Running updateBugState.sh"
979 :     fi
980 :     $cmd;
981 :     fi
982 :     echo "[promote] [`date +%H:%M:%S`] Bugzilla updated.";
983 : nickb 1.97 popd >/dev/null;
984 : nickb 1.37 fi
985 : nickb 1.1
986 : nickb 1.110 if [[ $maven -eq 1 ]]; then
987 :     if [[ -f $buildScriptsDir/buildMaven.sh ]]; then
988 :     echo "[promote] [`date +%H:%M:%S`] Create & promote Maven jars to download started:"
989 :     echo "[promote] Running buildMaven.sh:"
990 :     cd $buildScriptsDir; ./buildMaven.sh -sub "$subprojectName" -user $user -branch $branch -buildID $buildID -promote -debug $debug;
991 :     echo "[promote] [`date +%H:%M:%S`] Create & promote Maven jars to download done."
992 :     else
993 :     echo "[promote] Maven jar creation is not yet supported.";
994 :     fi
995 :     else
996 :     echo "[promote] Create Maven jars ... omitted [-nomaven]."
997 :     fi
998 :    
999 : nickb 1.1 getBranchLabel ()
1000 :     {
1001 : nickb 1.19 if [[ "$buildIDactual" == "$branch" ]]; then # echo "branch and actual are equal, need only $branch";
1002 : nickb 1.1 branchLabel="$branch";
1003 : nickb 1.19 elif [[ "${buildIDactual##$branch}" != "$buildIDactual" ]]; then # echo "just need $buildIDactual";
1004 : nickb 1.1 branchLabel="$buildIDactual";
1005 :     else # echo "Need both $branch and $buildIDactual";
1006 :     branchLabel="$branch $buildIDactual";
1007 :     fi
1008 :     }
1009 :    
1010 :     if [[ $coordsite -eq 1 ]]; then
1011 :     if [[ ! $coordsiteBranch ]]; then coordsiteBranch="HEAD"; fi # set default if missing
1012 :    
1013 :     # setup
1014 :     tmpfolder=$tempfold/coordsite; mkdir -p $tmpfolder; cd $tempfold;
1015 :     qualifier=".v"${buildID:1};
1016 :     buildType=${buildID:0:1};
1017 : nickb 1.132 case $buildType in
1018 :     'N'|'M'|'I') buildTypeLabel="interim";;
1019 :     'S') buildTypeLabel="milestones";;
1020 :     'R') buildTypeLabel="releases";;
1021 :     esac
1022 : nickb 1.38 if [[ $coordsiteName ]]; then coordsiteSuffix="-"$coordsiteName; else coordsiteSuffix=""; fi
1023 : nickb 1.130 sitexmlPath="$buildTypeLabel/site"$coordsiteSuffix".xml"; # interim/site-ganymede.xml
1024 : nickb 1.56
1025 : nickb 1.147 # TODO: add next coordsite format, if applicable
1026 :    
1027 :     featuresXMLArray=( "$projectName.sc" );
1028 :     cspecNameArray=( "org.eclipse.$projectName-sc" );
1029 :     featuresXMLfiltersArray=( "" );
1030 :     if [[ $subprojectName == "emf" ]]; then # special case -- generate two .sc files (TODO: split SDO out of EMF?)
1031 :     featuresXMLArray=( "emf-emf.sc" "mdt-xsd.sc");
1032 :     cspecNameArray=( "org.eclipse.emf-emf-sc" "org.eclipse.mdt-xsd-sc" );
1033 :     featuresXMLfiltersArray=( "emf" "xsd" );
1034 :     elif [[ $projectName == $subprojectName ]] && [[ $subprojectName != "emf" ]]; then # gmf
1035 :     true;
1036 :     elif [[ ! $subprojectName ]]; then # gef
1037 :     true;
1038 :     else # all other modeling projects
1039 :     featuresXMLArray=( "$projectName-$subprojectName.sc" );
1040 :     cspecNameArray=( "org.eclipse.$projectName-$subprojectName-sc" );
1041 : nickb 1.56 fi
1042 : nickb 1.147
1043 :     echo "[coordsite] [`date +%H:%M:%S`] Update Coordinated Update Site";
1044 : nickb 1.1 # checkout
1045 :     if [ "$coordsiteBranch" != "HEAD" ]; then coordsiteBranch="-r "$coordsiteBranch; else coordsiteBranch=""; fi
1046 : nickb 1.163 # TODO: add next coordsite format, if applicable
1047 :     if [[ $coordsiteName == "galileo" ]]; then
1048 :     cvscmd="cvs -d $coordsiteCVSRep -Q co $coordsiteBranch -d coordsite org.eclipse."$coordsiteName".build";
1049 :     else
1050 :     cvscmd="cvs -d $coordsiteCVSRep -Q co $coordsiteBranch -d coordsite org.eclipse."$coordsiteName".sitecontributions";
1051 :     fi
1052 : nickb 1.1 if [[ $debug -gt 0 ]]; then echo "[coordsite] [`date +%H:%M:%S`] "$cvscmd; fi
1053 :     $cvscmd;
1054 :    
1055 : nickb 1.147 i=0;
1056 :     while [[ $i -lt ${#featuresXMLArray[@]} ]]; do
1057 :     featuresXML=${featuresXMLArray[$i]};
1058 : nickb 1.162 if [[ $coordsiteName == "galileo" ]]; then featuresXML=${featuresXML/.sc/.build}; fi
1059 : nickb 1.147 cspecName=${cspecNameArray[$i]};
1060 :     featuresXMLfilters=${featuresXMLfiltersArray[$i]};
1061 :     (( i++ ));
1062 :     echo "[coordsite] [`date +%H:%M:%S`] [$i] $sitexmlPath -> $featuresXML ...";
1063 : nickb 1.184 cd $localWebDir/${updatesDirSuffix}/$buildTypeLabel/features;
1064 : nickb 1.147 coordsiteZips=$(find $buildDropsDir/$branch/$buildID -name "$SDKfilenamepattern");
1065 :     features="";
1066 :     for coordsiteZip in $coordsiteZips; do
1067 :     echo "[coordsite] [`date +%H:%M:%S`] Searching for features in "${coordsiteZip#$buildDropsDir/}":";
1068 :    
1069 :     # get actual feature versions for the following defined list: org.eclipse.*sub_x.y.z.vqualifier.jar - by default, include runtime and sdk only
1070 :     # or override in promoteToEclipse.*.properties file
1071 :     if [[ ! $coordsiteFeaturePattern ]]; then coordsiteFeaturePattern=".*eclipse/features/org.eclipse..*(${subprojectName}|${subprojectName}.sdk)_.*\/$"; fi
1072 :    
1073 :     features=$features" "$(unzip -l $coordsiteZip | grep -v "META-INF" | egrep "${coordsiteFeaturePattern}" | perl -pe "s#.*eclipse/features/(.+)/#\1#g");
1074 :     if [[ $SDKfilenamepattern2 ]]; then # hack for qtv which requires two zips
1075 :     coordsiteZip=$(find $buildDropsDir/$branch/$buildID -name "$SDKfilenamepattern2");
1076 :     if [[ $coordsiteZip ]]; then
1077 :     echo "[coordsite] [`date +%H:%M:%S`] Searching for features in "${coordsiteZip#$buildDropsDir/}":";
1078 :     features=$features" "$(unzip -l $coordsiteZip | grep -v "META-INF" | egrep "${coordsiteFeaturePattern}" | perl -pe "s#.*eclipse/features/(.+)/#\1#g");
1079 :     else
1080 :     echo "[coordsite] [`date +%H:%M:%S`] WARNING! No SDK zip found in $buildDropsDir/$branch/$buildID for pattern $SDKfilenamepattern2!";
1081 :     fi
1082 :     fi
1083 :     done
1084 : nickb 1.126
1085 : nickb 1.147 cd $tmpfolder;
1086 :     if [[ ! -f $featuresXML ]]; then
1087 :     touch $featuresXML; cvs -q add -k v -m "promoteToEclipse: new file" $featuresXML;
1088 :     else
1089 :     echo -n '' > $featuresXML
1090 : nickb 1.83 fi
1091 : nickb 1.45
1092 : nickb 1.147 memberName=$projectNameVanity" Build Team";
1093 :     #memberEmail=${newsgroupPublisherEmail##*<}; memberEmail=${memberEmail%%>}; # echo $memberEmail;
1094 :     getDefaultEmail;
1095 : nickb 1.148 emailList=$(echo $defaultEmail | tr "," " "); #" "$memberEmail;
1096 : nickb 1.139
1097 : nickb 1.162 if [[ $coordsiteName == "galileo" ]]; then
1098 :     echo '<?xml version="1.0" encoding="ASCII"?>' >> $featuresXML;
1099 : nickb 1.171 if [[ $subprojectName == "emf" ]]; then
1100 :     if [[ $featuresXML == "mdt-xsd.build" ]]; then
1101 :     echo '<build:Contribution xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:build="http://www.eclipse.org/amalgam/2008/build" label="MDT XSD">' >> $featuresXML;
1102 :     else
1103 :     echo '<build:Contribution xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:build="http://www.eclipse.org/amalgam/2008/build" label="EMF (Core)">' >> $featuresXML;
1104 :     fi
1105 :     else
1106 :     echo '<build:Contribution xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:build="http://www.eclipse.org/amalgam/2008/build" label="'$projectNameVanity'">' >> $featuresXML;
1107 :     fi
1108 : nickb 1.165 echo -n "[coordsite] [`date +%H:%M:%S`] Set contact info: $memberName";
1109 : nickb 1.162 for memberEmail in $emailList; do
1110 : nickb 1.165 echo -n ", $memberEmail";
1111 : nickb 1.162 echo ' <contacts name="'$memberName'" email="'$memberEmail'"/>' >> $featuresXML;
1112 :     done
1113 :     echo "";
1114 :     featuresMain="";
1115 :     featuresEnable="";
1116 :     if [[ ! $coordsiteMainFeaturePattern ]]; then coordsiteMainFeaturePattern="org.eclipse..*(${subprojectName}|${subprojectName}.sdk)$"; fi
1117 :     for f in $features; do
1118 :     featureId=${f%%_*}; # trim from _ to end
1119 :     featureVersion=${f#*_}; # trim from start to _
1120 :     # collect main features vs. enabling features
1121 :     if [[ ! $featuresXMLfilters ]] || [[ $(echo $featureId | egrep -c "$featuresXMLfilters") -gt 0 ]]; then
1122 :     if [[ $(echo $featureId | egrep -c "${coordsiteMainFeaturePattern}") -gt 0 ]]; then
1123 : nickb 1.174 featuresMain=$featuresMain" "$f;
1124 : nickb 1.162 echo " :main: "$f; # to console only
1125 :     else
1126 : nickb 1.174 featuresEnable=$featuresEnable" "$f;
1127 : nickb 1.162 echo " :enable: "$f; # to console only
1128 :     fi
1129 :     fi
1130 :     done
1131 :     if [[ $featuresMain ]]; then
1132 :     for f in $featuresMain; do
1133 : nickb 1.174 featureId=${f%%_*}; # trim from _ to end
1134 :     featureVersion=${f#*_}; # trim from start to _
1135 :     if [[ ! ${featureId##*.sdk} ]]; then # include SDKs
1136 :     echo ' <features id="'$featureId'" version="'$featureVersion'" repo="//@repositories.0">' >> $featuresXML;
1137 : nickb 1.168 # TODO: support assigning features to specific categories in galileo.build, eg., for GEF & PDT?
1138 : nickb 1.185 if [[ $projectName == "pdt" ]]; then
1139 :     echo ' <category href="galileo.build#//@categories.1"/>' >> $featuresXML;
1140 :     echo ' <category href="galileo.build#//@categories.2"/>' >> $featuresXML;
1141 :     fi
1142 : nickb 1.168 if [[ $parent == "modeling" ]]; then
1143 : nickb 1.166 echo ' <category href="galileo.build#//@categories.0"/>' >> $featuresXML;
1144 :     fi
1145 : nickb 1.169 echo ' </features>' >> $featuresXML;
1146 : nickb 1.162 fi
1147 :     done
1148 :     fi
1149 : nickb 1.167 # omit enabling features, because the PC doesn't like them this year
1150 : nickb 1.166 # if [[ $featuresEnable ]]; then
1151 :     # for f in $featuresEnable; do
1152 : nickb 1.174 # featureId=${f%%_*}; # trim from _ to end
1153 :     # featureVersion=${f#*_}; # trim from start to _
1154 :     # echo ' <features id="'$featureId'" version="'$featureVersion'" repo="//@repositories.0">' >> $featuresXML;
1155 : nickb 1.166 # # support enabling features in separate category, rather than in "uncategorized"
1156 :     # if [[ $parent == "modeling" ]]; then
1157 :     # echo ' <category href="galileo.build#//@categories.8"/>' >> $featuresXML;
1158 :     # fi
1159 :     # echo ' </features>' >> $featuresXML;
1160 :     # done
1161 :     # fi
1162 : nickb 1.170 if [[ $subprojectName == "emf" ]]; then
1163 :     if [[ $featuresXML == "mdt-xsd.build" ]]; then
1164 : nickb 1.184 echo ' <repositories location="http://download.eclipse.org/'${dlsPath}'/'${updatesDirSuffix}'/'$buildTypeLabel'/" label="MDT XSD '$buildTypeLabel'"/>' >> $featuresXML;
1165 : nickb 1.170 else
1166 : nickb 1.184 echo ' <repositories location="http://download.eclipse.org/'${dlsPath}'/'${updatesDirSuffix}'/'$buildTypeLabel'/" label="EMF (Core) '$buildTypeLabel'"/>' >> $featuresXML;
1167 : nickb 1.170 fi
1168 :     else
1169 : nickb 1.184 echo ' <repositories location="http://download.eclipse.org/'${dlsPath}'/'${updatesDirSuffix}'/'$buildTypeLabel'/" label="'$projectNameVanity' '$buildTypeLabel'"/>' >> $featuresXML;
1170 : nickb 1.170 fi
1171 : nickb 1.162 echo '</build:Contribution>' >> $featuresXML;
1172 :    
1173 :     elif [[ $coordsiteName == "ganymede" ]]; then
1174 :     echo '<?xml version="1.0" encoding="UTF-8" ?>
1175 : nickb 1.56 <sc:siteContribution
1176 :     xmlns="http://www.eclipse.org/buckminster/CSpec-1.0"
1177 :     xmlns:sc="http://www.eclipse.org/buckminster/SiteContribution-1.0"
1178 : nickb 1.184 updateSite="${downloads}/'${dlsPath}'/'${updatesDirSuffix}'/'$sitexmlPath'">' >> $featuresXML;
1179 : nickb 1.162 echo -n "[coordsite] [`date +%H:%M:%S`] Set contact info: $memberName";
1180 :     for memberEmail in $emailList; do
1181 : nickb 1.165 echo -n ", $memberEmail";
1182 : nickb 1.162 echo ' <sc:member name="'$memberName'" email="'$memberEmail'" />' >> $featuresXML;
1183 :     done
1184 :     echo "";
1185 :     echo ' <sc:cspec name="'$cspecName'">
1186 : nickb 1.56 <dependencies>' >> $featuresXML;
1187 : nickb 1.162 featuresMain="";
1188 :     featuresEnable="";
1189 :     if [[ ! $coordsiteMainFeaturePattern ]]; then coordsiteMainFeaturePattern="org.eclipse..*(${subprojectName}|${subprojectName}.sdk)$"; fi
1190 :     for f in $features; do
1191 :     featureId=${f%%_*}; # trim from _ to end
1192 :     featureVersion=${f#*_}; # trim from start to _
1193 :     # collect main features vs. enabling features
1194 :     if [[ ! $featuresXMLfilters ]] || [[ $(echo $featureId | egrep -c "$featuresXMLfilters") -gt 0 ]]; then
1195 :     if [[ $(echo $featureId | egrep -c "${coordsiteMainFeaturePattern}") -gt 0 ]]; then
1196 :     featuresMain=$featuresMain" "$featureId;
1197 :     echo " :main: "$f; # to console only
1198 :     else
1199 :     featuresEnable=$featuresEnable" "$featureId;
1200 :     echo " :enable: "$f; # to console only
1201 :     fi
1202 :     echo ' <dependency name="'$featureId'" versionDesignator="['$featureVersion']" />' >> $featuresXML;
1203 :     fi
1204 :     done
1205 :     echo ' </dependencies>
1206 :     <groups>' >> $featuresXML;
1207 :    
1208 :     if [[ $featuresEnable ]]; then
1209 :     echo ' <public name="Enabling Features">' >> $featuresXML;
1210 :     for f in $featuresEnable; do
1211 :     echo ' <attribute component="'$f'" />' >> $featuresXML;
1212 :     done
1213 :     echo ' </public>' >> $featuresXML;
1214 :     fi
1215 :     if [[ $featuresMain ]]; then
1216 :     if [[ $coordsiteMainFeatureName ]]; then
1217 :     echo ' <public name="'$coordsiteMainFeatureName'">' >> $featuresXML;
1218 : nickb 1.147 else
1219 : nickb 1.162 echo ' <public name="Models and Model Development">' >> $featuresXML; # default
1220 : nickb 1.147 fi
1221 : nickb 1.162 for f in $featuresMain; do
1222 :     echo ' <attribute component="'$f'" />' >> $featuresXML;
1223 :     done
1224 :     echo ' </public>' >> $featuresXML;
1225 : nickb 1.147 fi
1226 : nickb 1.162 echo ' </groups>
1227 : nickb 1.67 </sc:cspec>
1228 : nickb 1.56 </sc:siteContribution>
1229 :     ' >> $featuresXML;
1230 : nickb 1.162 fi
1231 : nickb 1.147 #cat $featuresXML;
1232 : nickb 1.1
1233 : nickb 1.147 # commit changes
1234 :     cvs ci -m "promoteToEclipse: $sitexmlPath, $branch$qualifier" $featuresXML;
1235 :    
1236 :     done
1237 : nickb 1.1 echo "[coordsite] [`date +%H:%M:%S`] done.";
1238 :     fi
1239 :    
1240 :     if [[ $noclean -eq 0 ]]; then
1241 :     # cleanup temp space
1242 : nickb 1.122 if [[ -d $tempfold/ ]]; then
1243 :     rm -fr $tempfold/;
1244 :     echo "[promote] Temporary files purged from $tempfold/."
1245 :     fi
1246 : nickb 1.70 if [[ $tmpProperties ]]; then
1247 :     rm -fr /tmp/$tmpProperties
1248 :     echo "[promote] Temporary files purged from /tmp/$tmpProperties/"
1249 :     fi
1250 : nickb 1.1 else
1251 : nickb 1.70 if [[ $tmpProperties ]]; then
1252 :     echo "[promote] Temporary files left in $tempfold/ and /tmp/$tmpProperties/. Please scrub them manually when done."
1253 :     else
1254 :     echo "[promote] Temporary files left in $tempfold/. Please scrub them manually when done."
1255 :     fi
1256 : nickb 1.1 fi
1257 :    
1258 :     # send newsgroup notification
1259 :     postfile=newsgroup-post.txt
1260 :     if [[ $announce -eq 1 ]]; then
1261 : nickb 1.19 echo -n "[announce] Announce new build in newsgroup";
1262 :     if [[ -r /home/$user/.ssh/$postfile ]]; then
1263 : nickb 1.57 echo -n " ($newsgroup): ";
1264 :     elapsed=0; while [[ $elapsed -lt $announcedelay ]]; do echo -n "."; sleep 15s; (( elapsed += 15 )); done
1265 :     echo "";
1266 : nickb 1.1 getBuildIDactual;
1267 :     getBranchLabel;
1268 :     mkdir -p $tempfold;
1269 :     head -2 /home/$user/.ssh/$postfile > $tempfold/$postfile;
1270 :     # this file should contain the following two lines:
1271 :     # authinfo user exquisitus
1272 :     # authinfo pass ********** (replace with real pwd)
1273 :     echo "post" >> $tempfold/$postfile;
1274 :     echo "From: $newsgroupPublisherEmail" >> $tempfold/$postfile;
1275 :     echo "Subject: [Announce] $projectNameVanity $branchLabel is available" >> $tempfold/$postfile;
1276 :     echo "Newsgroups: $newsgroup" >> $tempfold/$postfile;
1277 : nickb 1.19 if [[ $newsgroupThreadReferences ]]; then # add support for threading under an existing post
1278 : nickb 1.1 echo "References: $newsgroupThreadReferences" >> $tempfold/$postfile;
1279 :     echo "In-Reply-To: $newsgroupThreadReferences" >> $tempfold/$postfile;
1280 :     fi
1281 :     echo "" >> $tempfold/$postfile;
1282 : nickb 1.159 echo "The following build [1] will be available at eclipse.org in the next 30-60 mins." >> $tempfold/$postfile;
1283 :     echo "[1] "$downloadsURL"&showAll=1&hlbuild="$buildID"#"$buildID >> $tempfold/$postfile;
1284 :     echo "" >> $tempfold/$postfile;
1285 : nickb 1.172 echo "Updated release notes [2] should be updated within 24hrs." >> $tempfold/$postfile;
1286 : nickb 1.159 echo "[2] "$releaseNotesURL"&version="$buildIDactual >> $tempfold/$postfile;
1287 :     echo "" >> $tempfold/$postfile;
1288 :    
1289 : nickb 1.1 echo "" >> $tempfold/$postfile;
1290 :     echo "." >> $tempfold/$postfile;
1291 :     echo "quit" >> $tempfold/$postfile;
1292 : nickb 1.160 if [[ $(man nc 2>/dev/null) ]]; then
1293 :     cat $tempfold/$postfile | nc news.eclipse.org 119 2>&1 ;
1294 :     elif [[ $(man netcat 2>/dev/null) ]]; then
1295 :     cat $tempfold/$postfile | netcat news.eclipse.org 119 2>&1 ;
1296 :     else
1297 :     echo "[announce] ERROR: cannot submit message to newsgroup. Please install nc or netcat."
1298 :     fi
1299 : nickb 1.1 rm -fr $tempfold/$postfile;
1300 :     echo "[announce] done.";
1301 :     else
1302 : nickb 1.19 echo ": $postfile not found or not readable, message delivery disabled."
1303 : nickb 1.1 fi
1304 :     fi
1305 :    
1306 : nickb 1.75 cd $commonScriptsDir;
1307 : nickb 1.89 checkBuildStatus; sendEmail;
1308 : nickb 1.1
1309 :     echo "[promote] Done `date +%H:%M:%S`"
1310 :     echo ""
1311 :