| 814 |
mhunt |
1 |
package com.erggroup.buildtool.ripple;
|
|
|
2 |
|
|
|
3 |
import java.sql.CallableStatement;
|
|
|
4 |
import java.sql.Connection;
|
|
|
5 |
|
|
|
6 |
import java.sql.DriverManager;
|
|
|
7 |
|
|
|
8 |
import java.sql.PreparedStatement;
|
|
|
9 |
import java.sql.ResultSet;
|
|
|
10 |
import java.sql.SQLException;
|
|
|
11 |
|
|
|
12 |
import java.sql.Timestamp;
|
|
|
13 |
|
|
|
14 |
import java.sql.Types;
|
|
|
15 |
|
|
|
16 |
import java.util.Calendar;
|
|
|
17 |
import java.util.Date;
|
|
|
18 |
import java.util.GregorianCalendar;
|
|
|
19 |
import java.util.Iterator;
|
|
|
20 |
import java.util.ListIterator;
|
|
|
21 |
import java.util.Vector;
|
| 850 |
mhunt |
22 |
import java.util.concurrent.locks.ReentrantLock;
|
| 814 |
mhunt |
23 |
|
|
|
24 |
import org.apache.log4j.Logger;
|
|
|
25 |
|
|
|
26 |
/**Release Manager schema abstraction
|
|
|
27 |
*/
|
|
|
28 |
public class ReleaseManager
|
|
|
29 |
{
|
|
|
30 |
/**Unit test hook.
|
|
|
31 |
* Prevents Oracle interaction when false.
|
|
|
32 |
* @attribute
|
|
|
33 |
*/
|
|
|
34 |
public static boolean mUseDatabase = true;
|
|
|
35 |
|
| 924 |
dpurdie |
36 |
/**Debug Support.
|
|
|
37 |
* Set to false if EnvVar GBE_BUILDTOOL_DEBUG exists
|
|
|
38 |
* Value of GBE_BUILDTOOL_DEBUG is expected to be an email if greater than
|
|
|
39 |
* one character.
|
|
|
40 |
*
|
|
|
41 |
* When set to false will:
|
|
|
42 |
* Prevents use of Oracle Mutex and potential lockout during debug sessions.
|
|
|
43 |
* Prevent the initiaition of an indefinite pause.
|
|
|
44 |
* @attribute
|
|
|
45 |
*/
|
|
|
46 |
public static boolean mUseMutex = true;
|
|
|
47 |
|
| 814 |
mhunt |
48 |
/**Unit test hook
|
|
|
49 |
* Container of persisted run levels for unit test usage
|
|
|
50 |
* Must be managed by the unit test code
|
|
|
51 |
* @attribute
|
|
|
52 |
*/
|
| 864 |
mhunt |
53 |
public static Vector<Integer> mPersistedRunLevelCollection = new Vector<Integer>();
|
| 814 |
mhunt |
54 |
|
|
|
55 |
/**database represented enumerated value
|
|
|
56 |
* @attribute
|
|
|
57 |
*/
|
|
|
58 |
public static final int DB_CANNOT_CONTINUE = 1;
|
|
|
59 |
|
|
|
60 |
/**database represented enumerated value
|
|
|
61 |
* @attribute
|
|
|
62 |
*/
|
|
|
63 |
public static final int DB_PAUSED = 2;
|
|
|
64 |
|
|
|
65 |
/**database represented enumerated value
|
|
|
66 |
* @attribute
|
|
|
67 |
*/
|
|
|
68 |
public static final int DB_ACTIVE = 3;
|
|
|
69 |
|
|
|
70 |
/**database represented enumerated value
|
|
|
71 |
* @attribute
|
|
|
72 |
*/
|
|
|
73 |
public static final int DB_IDLE = 4;
|
|
|
74 |
|
|
|
75 |
/**database represented enumerated value
|
|
|
76 |
* @attribute
|
|
|
77 |
*/
|
|
|
78 |
public static final int DB_WAITING = 5;
|
|
|
79 |
|
| 886 |
mhunt |
80 |
/**database represented enumerated value
|
|
|
81 |
* @attribute
|
|
|
82 |
*/
|
|
|
83 |
public static final int DB_PUBLISHING = 6;
|
|
|
84 |
|
| 814 |
mhunt |
85 |
/**package object of no consequence
|
|
|
86 |
* @attribute
|
|
|
87 |
*/
|
| 908 |
mhunt |
88 |
public static final Package NULL_PACKAGE = new Package();
|
| 814 |
mhunt |
89 |
|
|
|
90 |
/**registered status
|
|
|
91 |
* @attribute
|
|
|
92 |
*/
|
|
|
93 |
static boolean mRegistered = false;
|
|
|
94 |
|
|
|
95 |
/**Logger
|
|
|
96 |
* @attribute
|
|
|
97 |
*/
|
|
|
98 |
private static final Logger mLogger = Logger.getLogger(ReleaseManager.class);
|
|
|
99 |
|
|
|
100 |
/**database session handle
|
|
|
101 |
* @attribute
|
|
|
102 |
*/
|
| 920 |
mhunt |
103 |
private static Connection mNonPlanningConnection = null;
|
| 814 |
mhunt |
104 |
|
| 850 |
mhunt |
105 |
/**database session handle
|
|
|
106 |
* @attribute
|
|
|
107 |
*/
|
| 918 |
mhunt |
108 |
private static Connection mPlanningConnection = null;
|
|
|
109 |
|
| 920 |
mhunt |
110 |
/**database session handle
|
|
|
111 |
* note this handle is only ever set to mNonPlanningConnection or mPlanningConnection
|
|
|
112 |
* @attribute
|
|
|
113 |
*/
|
|
|
114 |
private Connection mConnection = null;
|
|
|
115 |
|
| 918 |
mhunt |
116 |
/**thread synchronisation governing non planning database connection usage
|
|
|
117 |
* this lock is used by all build threads
|
|
|
118 |
* @attribute
|
|
|
119 |
*/
|
| 850 |
mhunt |
120 |
private static final ReentrantLock mSession = new ReentrantLock();
|
|
|
121 |
|
| 918 |
mhunt |
122 |
/**thread synchronisation governing database connection usage
|
|
|
123 |
* this lock is used by master threads with a high priority planning requirement
|
|
|
124 |
* and at most one thread with a low priority planning requirement
|
|
|
125 |
* @attribute
|
|
|
126 |
*/
|
|
|
127 |
private static final ReentrantLock mPlanningSession = new ReentrantLock();
|
|
|
128 |
|
|
|
129 |
/**thread synchronisation governing database connection request queueing
|
|
|
130 |
* this lock is used by master threads with a low priority planning requirement
|
|
|
131 |
* use the fairness parameter to grant access to the longest waiting thread
|
|
|
132 |
* @attribute
|
|
|
133 |
*/
|
|
|
134 |
private static final ReentrantLock mLowPriorityQueue = new ReentrantLock(true);
|
|
|
135 |
|
| 814 |
mhunt |
136 |
/**index to current ReleaseConfig item
|
|
|
137 |
* @attribute
|
|
|
138 |
*/
|
|
|
139 |
private int mReleaseConfigIndex = -1;
|
|
|
140 |
|
|
|
141 |
/**index to current RunLevel item
|
|
|
142 |
* @attribute
|
|
|
143 |
*/
|
|
|
144 |
private int mRunLevelIndex = -1;
|
|
|
145 |
|
|
|
146 |
/**collection of ReleaseConfig objects
|
|
|
147 |
* @attribute
|
|
|
148 |
*/
|
| 864 |
mhunt |
149 |
private Vector<ReleaseConfig> mReleaseConfigCollection = new Vector<ReleaseConfig>();
|
| 814 |
mhunt |
150 |
|
|
|
151 |
/**database connection string
|
|
|
152 |
* @attribute
|
|
|
153 |
*/
|
|
|
154 |
private static String mConnectionString = new String();
|
|
|
155 |
|
|
|
156 |
/**database username
|
|
|
157 |
* @attribute
|
|
|
158 |
*/
|
|
|
159 |
private static String mUsername = new String();
|
|
|
160 |
|
|
|
161 |
/**database password
|
|
|
162 |
* @attribute
|
|
|
163 |
*/
|
|
|
164 |
private static String mPassword = new String();
|
|
|
165 |
|
|
|
166 |
/**collection of RunLevel objects
|
|
|
167 |
* @attribute
|
|
|
168 |
*/
|
| 864 |
mhunt |
169 |
private Vector<RunLevel> mRunLevelCollection = new Vector<RunLevel>();
|
| 868 |
mhunt |
170 |
|
| 896 |
mhunt |
171 |
/**set in claimVersion, cleared in discardVersion
|
|
|
172 |
* @attribute
|
|
|
173 |
*/
|
|
|
174 |
private String mPlannedPkgId = null;
|
|
|
175 |
|
| 898 |
mhunt |
176 |
/**prevents inadvertantly attempting a commit which releases record locks in between claimMutex and releaseMutex
|
|
|
177 |
* @attribute
|
|
|
178 |
*/
|
|
|
179 |
private boolean mDoNotCommit = false;
|
|
|
180 |
|
| 896 |
mhunt |
181 |
/**set in claimVersion, cleared in discardVersion
|
|
|
182 |
* @attribute
|
|
|
183 |
*/
|
| 898 |
mhunt |
184 |
|
| 896 |
mhunt |
185 |
private String mPlannedPkgVersion = null;
|
| 924 |
dpurdie |
186 |
|
| 2541 |
dpurdie |
187 |
/** Set in autoMakeRelease
|
|
|
188 |
* @attribute
|
|
|
189 |
*/
|
|
|
190 |
public String mAutoMakeReleaseCause = null;
|
|
|
191 |
|
| 814 |
mhunt |
192 |
/**in daemon mode
|
| 882 |
mhunt |
193 |
* select gm.gbe_value from release_manager.release_config rc, release_manager.gbe_machtype gm
|
| 814 |
mhunt |
194 |
* where rc.rtag_id=<baseline> and gm.gbe_id=rc.gbe_id;
|
|
|
195 |
* in escrow mode
|
| 882 |
mhunt |
196 |
* select gm.gbe_value from deployment_manager.boms b, release_manager.release_config rc,
|
| 814 |
mhunt |
197 |
* release_manager.gbe_machtype gm
|
|
|
198 |
* where b.bom_id=<baseline> and rc.rtag_id=b.rtag_id_fk and gm.gbe_id=rc.gbe_id;
|
|
|
199 |
* populates the machtypeCollection with the resultset
|
|
|
200 |
*/
|
| 864 |
mhunt |
201 |
void queryMachtypes(Vector<String> machtypeCollection, boolean daemonMode, int baseline) throws SQLException, Exception
|
| 814 |
mhunt |
202 |
{
|
|
|
203 |
mLogger.debug("queryMachtypes " + daemonMode);
|
|
|
204 |
if ( !mUseDatabase )
|
|
|
205 |
{
|
|
|
206 |
mLogger.info("queryMachtypes !mUseDatabase");
|
|
|
207 |
// a highly unlikely set of machtypes
|
|
|
208 |
String machtype = new String("linux_i386");
|
|
|
209 |
machtypeCollection.add(machtype);
|
|
|
210 |
machtype = new String("sparc");
|
|
|
211 |
machtypeCollection.add(machtype);
|
|
|
212 |
machtype = new String("solaris10_x86");
|
|
|
213 |
machtypeCollection.add(machtype);
|
|
|
214 |
}
|
|
|
215 |
else
|
|
|
216 |
{
|
|
|
217 |
String sql = new String("");
|
|
|
218 |
|
|
|
219 |
if ( daemonMode )
|
|
|
220 |
{
|
| 4201 |
dpurdie |
221 |
sql = "select gm.gbe_value " +
|
|
|
222 |
"from release_manager.release_config rc, release_manager.gbe_machtype gm " +
|
|
|
223 |
"where rc.rtag_id=" + baseline + " and gm.gbe_id=rc.gbe_id";
|
| 814 |
mhunt |
224 |
}
|
|
|
225 |
else
|
|
|
226 |
{
|
|
|
227 |
sql =
|
| 4123 |
dpurdie |
228 |
"select gm.gbe_value " +
|
|
|
229 |
"from deployment_manager.boms b, release_manager.release_config rc, release_manager.gbe_machtype gm " +
|
|
|
230 |
"where b.bom_id=" + baseline +
|
|
|
231 |
" and rc.rtag_id=b.rtag_id_fk "+
|
|
|
232 |
" and gm.gbe_id=rc.gbe_id";
|
| 814 |
mhunt |
233 |
}
|
| 4123 |
dpurdie |
234 |
|
| 814 |
mhunt |
235 |
try
|
|
|
236 |
{
|
|
|
237 |
CallableStatement stmt = mConnection.prepareCall(sql);
|
|
|
238 |
ResultSet rset = stmt.executeQuery();
|
|
|
239 |
|
|
|
240 |
while( rset.next() )
|
|
|
241 |
{
|
|
|
242 |
String machtype = rset.getString("gbe_value");
|
|
|
243 |
|
|
|
244 |
if ( machtype != null )
|
|
|
245 |
{
|
|
|
246 |
machtypeCollection.add(machtype);
|
|
|
247 |
}
|
|
|
248 |
}
|
| 830 |
mhunt |
249 |
|
|
|
250 |
rset.close();
|
|
|
251 |
stmt.close();
|
| 814 |
mhunt |
252 |
}
|
|
|
253 |
catch ( SQLException e )
|
|
|
254 |
{
|
|
|
255 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
256 |
{
|
|
|
257 |
mLogger.error("queryMachtypes database access error only");
|
|
|
258 |
throw new SQLException();
|
|
|
259 |
}
|
|
|
260 |
else
|
|
|
261 |
{
|
| 4123 |
dpurdie |
262 |
mLogger.fatal("queryMachtypes show stopper:" + e.toString());
|
| 868 |
mhunt |
263 |
throw new Exception("queryMachtypes show stopper");
|
| 814 |
mhunt |
264 |
}
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
/**in daemon mode
|
| 882 |
mhunt |
270 |
* select p.proj_name, rt.rtag_name from release_manager.projects p, release_manager.release_tags rt
|
| 814 |
mhunt |
271 |
* where rt.rtag_id=<baseline> and p.proj_id=rt.proj_id;
|
|
|
272 |
* returns a concatenation of the proj_name and rtag_name
|
|
|
273 |
* in escrow mode
|
| 1313 |
dpurdie |
274 |
* dp.proj_name, br.branch_name, b.bom_version, b.bom_lifecycle
|
| 882 |
mhunt |
275 |
* from deployment_manager.dm_projects dp, deployment_manager.branches br, deployment_manager.boms b
|
| 814 |
mhunt |
276 |
* where b.bom_id=<baseline> and br.branch_id=b.branch_id and dp.proj_id=br.proj_id;
|
|
|
277 |
* returns a concatenation of the proj_name, branch_name, bom_version and bom_lifecycle
|
|
|
278 |
*/
|
|
|
279 |
String queryBaselineName(boolean daemonMode, int baseline) throws SQLException, Exception
|
|
|
280 |
{
|
|
|
281 |
mLogger.debug("queryBaselineName " + daemonMode);
|
|
|
282 |
String retVal = new String();
|
|
|
283 |
|
|
|
284 |
if ( !mUseDatabase )
|
|
|
285 |
{
|
|
|
286 |
mLogger.info("queryBaselineName !mUseDatabase");
|
|
|
287 |
// a highly unlikely baseline name
|
|
|
288 |
if (daemonMode)
|
|
|
289 |
{
|
|
|
290 |
retVal = "TIMBUKTU (TIM) > R7";
|
|
|
291 |
}
|
|
|
292 |
else
|
|
|
293 |
{
|
|
|
294 |
retVal = "TIMBUKTU (TIM) > R7 7.9";
|
|
|
295 |
}
|
|
|
296 |
}
|
|
|
297 |
else
|
|
|
298 |
{
|
|
|
299 |
String sql = new String("");
|
|
|
300 |
|
|
|
301 |
if ( daemonMode )
|
|
|
302 |
{
|
|
|
303 |
sql = "select p.proj_name, rt.rtag_name from release_manager.projects p, release_manager.release_tags rt where rt.rtag_id=" + baseline + " and p.proj_id=rt.proj_id";
|
|
|
304 |
}
|
|
|
305 |
else
|
|
|
306 |
{
|
|
|
307 |
sql =
|
| 882 |
mhunt |
308 |
"select dp.proj_name, br.branch_name, b.bom_version, b.bom_lifecycle from deployment_manager.dm_projects dp, deployment_manager.branches br, deployment_manager.boms b where b.bom_id=" +
|
| 814 |
mhunt |
309 |
baseline + " and br.branch_id=b.branch_id and dp.proj_id=br.proj_id";
|
|
|
310 |
}
|
|
|
311 |
|
|
|
312 |
try
|
|
|
313 |
{
|
|
|
314 |
CallableStatement stmt = mConnection.prepareCall(sql);
|
|
|
315 |
ResultSet rset = stmt.executeQuery();
|
|
|
316 |
|
|
|
317 |
while( rset.next() )
|
|
|
318 |
{
|
|
|
319 |
String proj_name = rset.getString("proj_name");
|
|
|
320 |
|
|
|
321 |
if ( proj_name != null )
|
|
|
322 |
{
|
|
|
323 |
retVal += proj_name;
|
|
|
324 |
}
|
|
|
325 |
|
|
|
326 |
if ( daemonMode )
|
|
|
327 |
{
|
|
|
328 |
String rtag_name = rset.getString("rtag_name");
|
|
|
329 |
|
|
|
330 |
if ( rtag_name != null )
|
|
|
331 |
{
|
|
|
332 |
retVal += " > " + rtag_name;
|
|
|
333 |
}
|
|
|
334 |
}
|
|
|
335 |
else
|
|
|
336 |
{
|
|
|
337 |
String branch_name = rset.getString("branch_name");
|
|
|
338 |
|
|
|
339 |
if ( branch_name != null )
|
|
|
340 |
{
|
|
|
341 |
retVal += " > " + branch_name;
|
|
|
342 |
}
|
|
|
343 |
|
|
|
344 |
String bom_version = rset.getString("bom_version");
|
|
|
345 |
|
|
|
346 |
if ( bom_version != null )
|
|
|
347 |
{
|
|
|
348 |
retVal += " " + bom_version;
|
|
|
349 |
}
|
|
|
350 |
|
|
|
351 |
String bom_lifecycle = rset.getString("bom_lifecycle");
|
|
|
352 |
|
|
|
353 |
if ( bom_lifecycle != null )
|
|
|
354 |
{
|
|
|
355 |
retVal += "." + bom_lifecycle;
|
|
|
356 |
}
|
|
|
357 |
}
|
|
|
358 |
}
|
| 830 |
mhunt |
359 |
|
|
|
360 |
rset.close();
|
|
|
361 |
stmt.close();
|
| 814 |
mhunt |
362 |
}
|
|
|
363 |
catch ( SQLException e )
|
|
|
364 |
{
|
|
|
365 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
366 |
{
|
|
|
367 |
mLogger.error("queryBaselineName database access error only");
|
|
|
368 |
throw new SQLException();
|
|
|
369 |
}
|
|
|
370 |
else
|
|
|
371 |
{
|
|
|
372 |
mLogger.fatal("queryBaselineName show stopper");
|
| 868 |
mhunt |
373 |
throw new Exception("queryBaselineName show stopper");
|
| 814 |
mhunt |
374 |
}
|
|
|
375 |
}
|
|
|
376 |
}
|
|
|
377 |
mLogger.info("queryBaselineName returned " + retVal);
|
|
|
378 |
return retVal;
|
|
|
379 |
}
|
|
|
380 |
|
|
|
381 |
/**in daemon mode
|
|
|
382 |
* 1 get planned package info
|
| 924 |
dpurdie |
383 |
* select pl.pv_id, p.pkg_id, p.pkg_name, pv.v_ext, pv.pkg_vcs_tag, pv.change_type
|
| 882 |
mhunt |
384 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.packages p
|
| 814 |
mhunt |
385 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
386 |
* and pv.pv_id=pl.pv_id and p.pkg_id=pv.pkg_id
|
|
|
387 |
* order by pl.pv_id;
|
|
|
388 |
* 2 get planned package dependency info
|
|
|
389 |
* select pl.pv_id, p.pkg_name, dpv.v_ext
|
| 882 |
mhunt |
390 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p
|
| 814 |
mhunt |
391 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
392 |
* and pv.pv_id = pl.pv_id and pd.pv_id=pl.pv_id and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id
|
|
|
393 |
* order by pl.pv_id;
|
|
|
394 |
* 3 get planned package build info
|
|
|
395 |
* select pl.pv_id, bm.bm_name, bsa.bsa_name
|
| 882 |
mhunt |
396 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa
|
| 814 |
mhunt |
397 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
398 |
* and pv.pv_id = pl.pv_id and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id
|
|
|
399 |
* order by pl.pv_id;
|
|
|
400 |
* 4 get planned package unit test info
|
|
|
401 |
* select pl.pv_id, tt.test_type_name
|
| 882 |
mhunt |
402 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.unit_tests ut, release_manager.test_types tt
|
| 814 |
mhunt |
403 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
404 |
* and pv.pv_id = pl.pv_id and ut.pv_id=pv.pv_id and tt.test_type_id=ut.test_types_fk
|
|
|
405 |
* order by pl.pv_id;
|
|
|
406 |
* 5 get planned package build failure info
|
|
|
407 |
* select pl.pv_id, u.user_email
|
| 882 |
mhunt |
408 |
* from release_manager.planned pl, release_manager.release_tags rt, release_manager.package_versions pv, release_manager.autobuild_failure af, release_manager.members_group mg, release_manager.users u
|
| 814 |
mhunt |
409 |
* where pl.rtag_id=<mBaseline> and rt.rtag_id=pl.rtag_id and pv.build_type='A' and pv.dlocked='A'
|
|
|
410 |
* and pv.pv_id = pl.pv_id and af.view_id=pl.view_id and mg.group_email_id=af.group_email_id and u.user_id=mg.user_id and af.proj_id=rt.proj_id
|
|
|
411 |
* order by pl.pv_id;
|
|
|
412 |
* 6 get planned package do not ripple info
|
|
|
413 |
* select pl.pv_id
|
| 882 |
mhunt |
414 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.do_not_ripple dnr
|
| 814 |
mhunt |
415 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
416 |
* and pv.pv_id = pl.pv_id and dnr.rtag_id=pl.rtag_id and dnr.pv_id=pl.pv_id
|
|
|
417 |
* order by pl.pv_id;
|
|
|
418 |
* 7 get planned package advisory ripple info
|
|
|
419 |
* select pl.pv_id
|
| 882 |
mhunt |
420 |
* from release_manager.planned pl, release_manager.package_versions pv, release_manager.advisory_ripple ar
|
| 814 |
mhunt |
421 |
* where pl.rtag_id=<mBaseline> and pv.build_type='A' and pv.dlocked='A'
|
|
|
422 |
* and pv.pv_id = pl.pv_id and ar.rtag_id=pl.rtag_id and ar.pv_id=pl.pv_id
|
|
|
423 |
* order by pl.pv_id;
|
|
|
424 |
* 8 get released package info
|
| 924 |
dpurdie |
425 |
* select rc.pv_id, p.pkg_id, p.pkg_name, pv.pkg_version, pv.v_ext, pv.pkg_vcs_tag, pv.ripple_field
|
| 874 |
mhunt |
426 |
* pv.major_limit, pv.minor_limit, pv.patch_limit, pv.build_number_limit
|
| 882 |
mhunt |
427 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.packages p
|
| 814 |
mhunt |
428 |
* where rc.rtag_id=<mBaseline>
|
|
|
429 |
* and pv.pv_id = rc.pv_id and p.pkg_id = pv.pkg_id
|
|
|
430 |
* order by rc.pv_id;
|
|
|
431 |
* 9 get released package dependency info
|
|
|
432 |
* select rc.pv_id, dpv.pv_id, p.pkg_name, dpv.v_ext
|
| 882 |
mhunt |
433 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p
|
| 814 |
mhunt |
434 |
* where rc.rtag_id=<mBaseline>
|
|
|
435 |
* and pv.pv_id = rc.pv_id and pd.pv_id=pv.pv_id and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id
|
|
|
436 |
* order by rc.pv_id;
|
|
|
437 |
* 10 get released package build info
|
|
|
438 |
* select rc.pv_id, bm.bm_name, bsa.bsa_name
|
| 882 |
mhunt |
439 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa
|
| 814 |
mhunt |
440 |
* where rc.rtag_id=<mBaseline>
|
|
|
441 |
* and pv.pv_id = rc.pv_id and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id
|
|
|
442 |
* order by rc.pv_id;
|
|
|
443 |
* 11 get released package unit test info
|
|
|
444 |
* select rc.pv_id, tt.test_type_name
|
| 882 |
mhunt |
445 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.unit_tests ut, release_manager.test_types tt
|
| 814 |
mhunt |
446 |
* where rc.rtag_id=<mBaseline>
|
|
|
447 |
* and pv.pv_id = rc.pv_id and ut.pv_id=pv.pv_id and tt.test_type_id=ut.test_types_fk
|
|
|
448 |
* order by rc.pv_id;
|
|
|
449 |
* 12 get released package build failure email info
|
|
|
450 |
* select rc.pv_id, u.user_email
|
| 882 |
mhunt |
451 |
* from release_manager.release_content rc, release_manager.release_tags rt, release_manager.package_versions pv, release_manager.autobuild_failure af, release_manager.members_group mg, release_manager.users u
|
| 814 |
mhunt |
452 |
* where rc.rtag_id=<mBaseline> and rt.rtag_id=rc.rtag_id
|
|
|
453 |
* and pv.pv_id = rc.pv_id and af.view_id=rc.base_view_id and mg.group_email_id=af.group_email_id and u.user_id=mg.user_id and af.proj_id=rt.proj_id
|
|
|
454 |
* order by rc.pv_id;
|
|
|
455 |
* 13 get released package do not ripple info
|
|
|
456 |
* select rc.pv_id
|
| 882 |
mhunt |
457 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.do_not_ripple dnr
|
|
|
458 |
* where rc.rtag_id=<mBaseline>
|
| 814 |
mhunt |
459 |
* and pv.pv_id = rc.pv_id and dnr.rtag_id=rc.rtag_id and dnr.pv_id=rc.pv_id
|
|
|
460 |
* order by rc.pv_id;
|
|
|
461 |
* 14 get released advisory ripple info
|
|
|
462 |
* select rc.pv_id
|
| 882 |
mhunt |
463 |
* from release_manager.release_content rc, release_manager.package_versions pv, release_manager.advisory_ripple ar
|
| 814 |
mhunt |
464 |
* where rc.rtag_id=<mBaseline>
|
|
|
465 |
* and pv.pv_id = rc.pv_id and ar.rtag_id=rc.rtag_id and ar.pv_id=rc.pv_id
|
|
|
466 |
* order by rc.pv_id;
|
|
|
467 |
* in escrow mode
|
|
|
468 |
* 1 get released product info
|
| 924 |
dpurdie |
469 |
* select oc.prod_id, p.pkg_name, pv.pkg_version, pv.v_ext, pv.pkg_vcs_tag
|
| 882 |
mhunt |
470 |
* from deployment_manager.bom_contents bc, deployment_manager.operating_systems os, deployment_manager.os_contents oc, release_manager.package_versions pv, release_manager.packages p
|
| 814 |
mhunt |
471 |
* where bc.bom_id=<mBaseline> and os.node_id=bc.node_id and oc.os_id=os.os_id and pv.pv_id=oc.prod_id and p.pkg_id=pv.pkg_id
|
|
|
472 |
* order by oc.prod_id;
|
|
|
473 |
* this will generate a list of pv_ids associtaed with products
|
|
|
474 |
* many in the list will reference cots products outside the scope of a escrow build
|
|
|
475 |
* 2 for each <pv_id>, call traverseDependencies( packageCollection, pv_id, false ) to traverse its set of dependencies
|
|
|
476 |
* 3 for each Package, call queryBuildInfo to get released package build info
|
|
|
477 |
*
|
|
|
478 |
* Supports
|
|
|
479 |
* test_type_name="Autobuild UTF"
|
|
|
480 |
* bm_name="Generic"|"Linux"|"Solaris"|"Win32"
|
|
|
481 |
* bsa_name="Debug"|"Production"|"Production and Debug"|"Java 1.4"|"Java 1.5"|"Java 1.6"
|
|
|
482 |
*/
|
|
|
483 |
void queryPackageVersions(RippleEngine rippleEngine,
|
| 864 |
mhunt |
484 |
Vector<Package> packageCollection, boolean daemonMode, int baseline) throws SQLException, Exception
|
| 814 |
mhunt |
485 |
{
|
|
|
486 |
mLogger.debug("queryPackageVersions " + daemonMode);
|
|
|
487 |
|
|
|
488 |
if ( !mUseDatabase )
|
|
|
489 |
{
|
|
|
490 |
mLogger.info("queryPackageVersions !mUseDatabase");
|
|
|
491 |
|
|
|
492 |
if (daemonMode)
|
|
|
493 |
{
|
|
|
494 |
/* a highly unlikely set of packages
|
|
|
495 |
* planned info
|
| 924 |
dpurdie |
496 |
* pv_id pkg_id pkg_name v_ext pkg_vcs_tag change_type
|
| 814 |
mhunt |
497 |
* 0 76 UncommonDependency .tim 0.TIM.WIP \vob\UncommonDependency P
|
|
|
498 |
* 1 1011 DependencyMissingFromRelease .tim 1.TIM.WIP \vob\DependencyMissingFromRelease M
|
|
|
499 |
* 2 34 CommonDependency .tim 2.TIM.WIP \vob\CommonDependency M
|
|
|
500 |
* 3 908 SolarisCentricProduct .tim 3.TIM.WIP \vob\SolarisCentricProduct N
|
|
|
501 |
* 4 6 GenericProduct .tim 4.TIM.WIP \vob\GenericProduct P
|
|
|
502 |
* 5 11 Product .tim 5.TIM.WIP \vob\Product M
|
|
|
503 |
* 6 113 UnfinishedProduct .tim 6.TIM.WIP \vob\UnfinishedProduct M
|
| 910 |
mhunt |
504 |
* 25 45 Banana .tim B.TIM.WIP \vob\Banana M
|
| 814 |
mhunt |
505 |
*/
|
|
|
506 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
507 |
{
|
| 4212 |
dpurdie |
508 |
Package p = new Package(0, "UncommonDependency", ".tim", "UncommonDependency.tim", "CC::/vob/UncommonDependency::0.TIM.WIP", 'P', 'b', "1.0.0000");
|
| 814 |
mhunt |
509 |
p.mPid = 76;
|
|
|
510 |
p.mDirectlyPlanned = true;
|
|
|
511 |
packageCollection.add(p);
|
|
|
512 |
}
|
|
|
513 |
|
| 4212 |
dpurdie |
514 |
Package p = new Package(1, "DependencyMissingFromRelease", ".tim", "DependencyMissingFromRelease.tim", "CC::/vob/DependencyMissingFromRelease::1.TIM.WIP", 'M', 'b', "1.0.0000");
|
| 814 |
mhunt |
515 |
p.mPid = 1011;
|
|
|
516 |
p.mDirectlyPlanned = true;
|
|
|
517 |
packageCollection.add(p);
|
|
|
518 |
|
|
|
519 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
520 |
{
|
| 4212 |
dpurdie |
521 |
p = new Package(2, "CommonDependency", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::2.TIM.WIP", 'M', 'b', "1.0.0000");
|
| 814 |
mhunt |
522 |
p.mPid = 34;
|
|
|
523 |
p.mDirectlyPlanned = true;
|
|
|
524 |
packageCollection.add(p);
|
|
|
525 |
}
|
|
|
526 |
|
|
|
527 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
528 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
529 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
530 |
{
|
| 4212 |
dpurdie |
531 |
p = new Package(3, "SolarisCentricProduct", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::3.TIM.WIP", 'N', 'b', "1.0.0000");
|
| 814 |
mhunt |
532 |
p.mPid = 908;
|
|
|
533 |
p.mDirectlyPlanned = true;
|
|
|
534 |
packageCollection.add(p);
|
|
|
535 |
}
|
|
|
536 |
|
|
|
537 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
538 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
539 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
540 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
541 |
{
|
| 4212 |
dpurdie |
542 |
p = new Package(4, "GenericProduct", ".tim", "GenericProduct.tim", "CC::/vob/GenericProduct::4.TIM.WIP", 'P', 'b', "1.0.0000");
|
| 814 |
mhunt |
543 |
p.mPid = 6;
|
|
|
544 |
p.mDirectlyPlanned = true;
|
|
|
545 |
packageCollection.add(p);
|
|
|
546 |
}
|
|
|
547 |
|
|
|
548 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
549 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
550 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
551 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
552 |
|| mConnectionString.compareTo("iteration5") == 0 )
|
|
|
553 |
{
|
| 4212 |
dpurdie |
554 |
p = new Package(5, "Product", ".tim", "Product.tim", "CC::/vob/Product::5.TIM.WIP", 'M', 'b', "1.0.0000");
|
| 814 |
mhunt |
555 |
p.mPid = 11;
|
|
|
556 |
p.mDirectlyPlanned = true;
|
|
|
557 |
packageCollection.add(p);
|
|
|
558 |
}
|
|
|
559 |
|
| 4212 |
dpurdie |
560 |
p = new Package(6, "UnfinishedProduct", ".tim", "UnfinishedProduct.tim", "CC::/vob/UnfinishedProduct::6.TIM.WIP", 'M', 'b', "1.0.0000");
|
| 814 |
mhunt |
561 |
p.mPid = 113;
|
|
|
562 |
p.mDirectlyPlanned = true;
|
|
|
563 |
packageCollection.add(p);
|
|
|
564 |
|
| 910 |
mhunt |
565 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
566 |
{
|
| 4212 |
dpurdie |
567 |
p = new Package(25, "Banana", ".tim", "Banana.tim", "CC::B.TIM.WIP/vob/Banana", 'M', 'b', "1.0.0000");
|
| 910 |
mhunt |
568 |
p.mPid = 45;
|
|
|
569 |
p.mDirectlyPlanned = true;
|
|
|
570 |
packageCollection.add(p);
|
|
|
571 |
}
|
|
|
572 |
|
| 814 |
mhunt |
573 |
/* planned dependencies
|
|
|
574 |
* pv_id pkg_name v_ext
|
|
|
575 |
* 1 NotInTheRelease .cots
|
|
|
576 |
* 2 CotsWithFunnyVersion .cots
|
|
|
577 |
* 2 UncommonDependency .tim
|
|
|
578 |
* 3 CommonDependency .tim
|
|
|
579 |
* 4 CommonDependency .tim
|
|
|
580 |
* 5 UncommonDependency .tim
|
| 910 |
mhunt |
581 |
* 25 Car .tim
|
| 814 |
mhunt |
582 |
*/
|
|
|
583 |
p = findPackage(1, packageCollection);
|
|
|
584 |
p.mDependencyCollection.add("NotInTheRelease.cots");
|
|
|
585 |
p.mDependencyIDCollection.add(-1);
|
|
|
586 |
|
|
|
587 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
588 |
{
|
|
|
589 |
p = findPackage(2, packageCollection);
|
|
|
590 |
p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
|
|
|
591 |
p.mDependencyIDCollection.add(-1);
|
|
|
592 |
p.mDependencyCollection.add("UncommonDependency.tim");
|
|
|
593 |
p.mDependencyIDCollection.add(-1);
|
|
|
594 |
}
|
|
|
595 |
|
|
|
596 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
597 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
598 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
599 |
{
|
|
|
600 |
p = findPackage(3, packageCollection);
|
|
|
601 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
602 |
p.mDependencyIDCollection.add(-1);
|
|
|
603 |
}
|
|
|
604 |
|
|
|
605 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
606 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
607 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
608 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
609 |
{
|
|
|
610 |
p = findPackage(4, packageCollection);
|
|
|
611 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
612 |
p.mDependencyIDCollection.add(-1);
|
|
|
613 |
}
|
|
|
614 |
|
|
|
615 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
616 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
617 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
618 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
619 |
|| mConnectionString.compareTo("iteration5") == 0 )
|
|
|
620 |
{
|
|
|
621 |
p = findPackage(5, packageCollection);
|
|
|
622 |
p.mDependencyCollection.add("UncommonDependency.tim");
|
|
|
623 |
p.mDependencyIDCollection.add(-1);
|
|
|
624 |
}
|
|
|
625 |
|
| 910 |
mhunt |
626 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
627 |
{
|
|
|
628 |
p = findPackage(25, packageCollection);
|
|
|
629 |
p.mDependencyCollection.add("Car.tim");
|
|
|
630 |
p.mDependencyIDCollection.add(-1);
|
|
|
631 |
}
|
|
|
632 |
|
| 814 |
mhunt |
633 |
/* planned build info
|
|
|
634 |
* pv_id bm_name bsa_name
|
|
|
635 |
* 0 Linux Java 1.6
|
|
|
636 |
* 1 Linux Debug
|
|
|
637 |
* 2 Linux Debug
|
|
|
638 |
* 2 Solaris Production
|
|
|
639 |
* 2 Win32 Production and Debug
|
|
|
640 |
* 3 Solaris Java 1.4
|
|
|
641 |
* 4 Generic Java 1.5
|
|
|
642 |
* 5 Linux Java 1.6
|
|
|
643 |
* 5 Win32 Java 1.6
|
| 910 |
mhunt |
644 |
* 25 Linux Java 1.6
|
| 814 |
mhunt |
645 |
*/
|
|
|
646 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
647 |
{
|
|
|
648 |
p = findPackage(0, packageCollection);
|
|
|
649 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
650 |
bs.setLinux();
|
|
|
651 |
bs.set1_6();
|
|
|
652 |
p.mBuildStandardCollection.add(bs);
|
|
|
653 |
}
|
|
|
654 |
|
|
|
655 |
p = findPackage(1, packageCollection);
|
|
|
656 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
657 |
bs.setLinux();
|
|
|
658 |
bs.setDebug();
|
|
|
659 |
p.mBuildStandardCollection.add(bs);
|
|
|
660 |
|
|
|
661 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
662 |
{
|
|
|
663 |
p = findPackage(2, packageCollection);
|
|
|
664 |
bs = new BuildStandard(rippleEngine);
|
|
|
665 |
bs.setLinux();
|
|
|
666 |
bs.setDebug();
|
|
|
667 |
p.mBuildStandardCollection.add(bs);
|
|
|
668 |
bs = new BuildStandard(rippleEngine);
|
|
|
669 |
bs.setSolaris();
|
|
|
670 |
bs.setProduction();
|
|
|
671 |
p.mBuildStandardCollection.add(bs);
|
|
|
672 |
bs = new BuildStandard(rippleEngine);
|
|
|
673 |
bs.setWin32();
|
|
|
674 |
bs.setAll();
|
|
|
675 |
p.mBuildStandardCollection.add(bs);
|
|
|
676 |
}
|
|
|
677 |
|
|
|
678 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
679 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
680 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
681 |
{
|
|
|
682 |
p = findPackage(3, packageCollection);
|
|
|
683 |
bs = new BuildStandard(rippleEngine);
|
|
|
684 |
bs.setSolaris();
|
|
|
685 |
bs.set1_4();
|
|
|
686 |
p.mBuildStandardCollection.add(bs);
|
|
|
687 |
}
|
|
|
688 |
|
|
|
689 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
690 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
691 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
692 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
693 |
{
|
|
|
694 |
p = findPackage(4, packageCollection);
|
|
|
695 |
bs = new BuildStandard(rippleEngine);
|
|
|
696 |
bs.setGeneric();
|
|
|
697 |
bs.set1_5();
|
|
|
698 |
p.mBuildStandardCollection.add(bs);
|
|
|
699 |
}
|
|
|
700 |
|
|
|
701 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
702 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
703 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
704 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
705 |
|| mConnectionString.compareTo("iteration5") == 0 )
|
|
|
706 |
{
|
|
|
707 |
p = findPackage(5, packageCollection);
|
|
|
708 |
bs = new BuildStandard(rippleEngine);
|
|
|
709 |
bs.setLinux();
|
|
|
710 |
bs.set1_6();
|
|
|
711 |
p.mBuildStandardCollection.add(bs);
|
|
|
712 |
bs = new BuildStandard(rippleEngine);
|
|
|
713 |
bs.setWin32();
|
|
|
714 |
bs.set1_6();
|
|
|
715 |
p.mBuildStandardCollection.add(bs);
|
|
|
716 |
}
|
|
|
717 |
|
| 910 |
mhunt |
718 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
719 |
{
|
|
|
720 |
p = findPackage(25, packageCollection);
|
|
|
721 |
bs = new BuildStandard(rippleEngine);
|
|
|
722 |
bs.setLinux();
|
|
|
723 |
bs.set1_6();
|
|
|
724 |
p.mBuildStandardCollection.add(bs);
|
|
|
725 |
}
|
|
|
726 |
|
|
|
727 |
/* planned unit test info
|
| 814 |
mhunt |
728 |
* pv_id test_type_name
|
|
|
729 |
* 2 Manual Test
|
|
|
730 |
* 2 Interactive Test
|
|
|
731 |
* 2 Integration Test
|
|
|
732 |
* 5 Autobuild UTF
|
|
|
733 |
*/
|
|
|
734 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
735 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
736 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
737 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
738 |
|| mConnectionString.compareTo("iteration5") == 0 )
|
|
|
739 |
{
|
|
|
740 |
p = findPackage(5, packageCollection);
|
|
|
741 |
p.mHasAutomatedUnitTests = true;
|
|
|
742 |
}
|
|
|
743 |
|
|
|
744 |
/* planned build failure info
|
|
|
745 |
* pv_id user_email
|
|
|
746 |
* 3 jimmyfishcake@erggroup.com
|
|
|
747 |
* 3 rayhaddock@erggroup.com
|
|
|
748 |
* 5 timbutdim@erggroup.com
|
|
|
749 |
*/
|
|
|
750 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
751 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
752 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
753 |
{
|
|
|
754 |
p = findPackage(3, packageCollection);
|
| 864 |
mhunt |
755 |
p.addEmail("jimmyfishcake@erggroup.com");
|
|
|
756 |
p.addEmail("rayhaddock@erggroup.com");
|
| 814 |
mhunt |
757 |
}
|
|
|
758 |
|
|
|
759 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
760 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
761 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
762 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
763 |
|| mConnectionString.compareTo("iteration5") == 0 )
|
|
|
764 |
{
|
|
|
765 |
p = findPackage(5, packageCollection);
|
| 864 |
mhunt |
766 |
p.addEmail("timbutdim@erggroup.com");
|
| 814 |
mhunt |
767 |
}
|
|
|
768 |
|
|
|
769 |
/* planned advisory ripple info
|
|
|
770 |
* pv_id
|
|
|
771 |
* 0
|
|
|
772 |
*/
|
|
|
773 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
774 |
{
|
|
|
775 |
p = findPackage(0, packageCollection);
|
|
|
776 |
p.mAdvisoryRipple = true;
|
|
|
777 |
}
|
|
|
778 |
|
|
|
779 |
/* released info
|
| 924 |
dpurdie |
780 |
* pv_id pkg_id pkg_name pkg_version v_ext pkg_vcs_tag ripple_field
|
| 814 |
mhunt |
781 |
* 7 8 CotsWithFunnyVersion hoopla2_x.cots .cots CotsWithFunnyVersion_hoopla2_x.cots \vob\CotsWithFunnyVersion
|
|
|
782 |
* 8 17 NotInAnyWayReproducible 1.0.0.tim .tim NA NA
|
|
|
783 |
* 9 34 CommonDependency 1.0.0000.tim .tim CommonDependency_1.0.0000.tim \vob\CommonDependency
|
|
|
784 |
* 10 908 SolarisCentricProduct 1.0.0000.tim .tim SolarisCentricProduct_1.0.0000.tim \vob\SolarisCentricProduct m
|
|
|
785 |
* 11 16 LinuxCentricProduct 1.0.0000.tim .tim LinuxCentricProduct_1.0.0000.tim \vob\LinuxCentricProduct
|
|
|
786 |
* 12 312 Win32CentricProduct 1.0.0000.tim .tim Win32CentricProduct_1.0.0000.tim \vob\Win32CentricProduct
|
|
|
787 |
* 13 6 GenericProduct 1.0.0000.tim .tim GenericProduct_1.0.0000.tim \vob\ToBeMovedFromHere M
|
|
|
788 |
* 14 81 AdvisoryDependency 1.0.0000.tim .tim AdvisoryDependency_1.0.0000.tim \vob\AdvisoryDependency
|
|
|
789 |
* 15 1 MergedProduct 1.0.0000.tim .tim MergedProduct_1.0.0000.tim \vob\MergedProduct m
|
| 910 |
mhunt |
790 |
* 22 45 Banana 1.1.0000.tim .tim Banana_1.1.0000.tim \vob\Banana
|
|
|
791 |
* 23 18 Aardvark 1.1.1000.tim .tim Aardvark_1.1.1000.tim \vob\Aardvark
|
|
|
792 |
* 24 227 Car 1.0.10000.tim .tim Car_1.0.10000.tim \vob\Car
|
| 814 |
mhunt |
793 |
*/
|
|
|
794 |
if ( mConnectionString.compareTo("iteration1") != 0 )
|
|
|
795 |
{
|
| 924 |
dpurdie |
796 |
p = new Package(0, "UncommonDependency", "0.0.1000.tim", ".tim", "UncommonDependency.tim", "CC::/vob/UncommonDependency::UncommonDependency_0.0.1000.tim", 'x');
|
| 814 |
mhunt |
797 |
p.mPid = 76;
|
|
|
798 |
Integer pv_id = new Integer(0);
|
|
|
799 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
800 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
801 |
|
|
|
802 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
803 |
{
|
|
|
804 |
packageCollection.add(p);
|
|
|
805 |
}
|
|
|
806 |
else
|
|
|
807 |
{
|
|
|
808 |
plannedPackage.mVersion = "0.0.1000";
|
|
|
809 |
}
|
|
|
810 |
}
|
|
|
811 |
|
|
|
812 |
if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
|
|
|
813 |
{
|
| 924 |
dpurdie |
814 |
p = new Package(2, "CommonDependency", "2.0.0000.tim", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::CommonDependency_2.0.0000.tim", 'x');
|
| 814 |
mhunt |
815 |
p.mPid = 34;
|
|
|
816 |
Integer pv_id = new Integer(2);
|
|
|
817 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
818 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
819 |
|
|
|
820 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
821 |
{
|
|
|
822 |
packageCollection.add(p);
|
|
|
823 |
}
|
|
|
824 |
else
|
|
|
825 |
{
|
|
|
826 |
plannedPackage.mVersion = "2.0.0000";
|
|
|
827 |
}
|
|
|
828 |
}
|
|
|
829 |
|
|
|
830 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
831 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
832 |
&& mConnectionString.compareTo("iteration3") != 0 )
|
|
|
833 |
{
|
| 924 |
dpurdie |
834 |
p = new Package(3, "SolarisCentricProduct", "1.1.0000.tim", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.1.0000.tim", 'm');
|
| 814 |
mhunt |
835 |
p.mPid = 908;
|
|
|
836 |
Integer pv_id = new Integer(3);
|
|
|
837 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
838 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
839 |
|
|
|
840 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
841 |
{
|
|
|
842 |
packageCollection.add(p);
|
|
|
843 |
}
|
|
|
844 |
else
|
|
|
845 |
{
|
|
|
846 |
plannedPackage.mVersion = "1.1.0000";
|
|
|
847 |
}
|
|
|
848 |
}
|
|
|
849 |
|
|
|
850 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
851 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
852 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
853 |
&& mConnectionString.compareTo("iteration4") != 0 )
|
|
|
854 |
{
|
| 924 |
dpurdie |
855 |
p = new Package(4, "GenericProduct", "1.0.1000.tim", ".tim", "GenericProduct.tim", "CC::/vob/GenericProduct::GenericProduct_1.0.1000.tim", 'M');
|
| 814 |
mhunt |
856 |
p.mPid = 6;
|
|
|
857 |
Integer pv_id = new Integer(4);
|
|
|
858 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
859 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
860 |
|
|
|
861 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
862 |
{
|
|
|
863 |
packageCollection.add(p);
|
|
|
864 |
}
|
|
|
865 |
else
|
|
|
866 |
{
|
|
|
867 |
plannedPackage.mVersion = "1.0.1000";
|
|
|
868 |
}
|
|
|
869 |
}
|
|
|
870 |
|
|
|
871 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
872 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
873 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
874 |
&& mConnectionString.compareTo("iteration4") != 0
|
|
|
875 |
&& mConnectionString.compareTo("iteration5") != 0 )
|
|
|
876 |
{
|
| 924 |
dpurdie |
877 |
p = new Package(5, "Product", "1.0.0000.tim", ".tim", "Product.tim", "CC::/vob/Product::Product_1.0.0000.tim", 'M');
|
| 814 |
mhunt |
878 |
p.mPid = 11;
|
|
|
879 |
Integer pv_id = new Integer(5);
|
|
|
880 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
881 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
882 |
|
|
|
883 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
884 |
{
|
|
|
885 |
packageCollection.add(p);
|
|
|
886 |
}
|
|
|
887 |
else
|
|
|
888 |
{
|
|
|
889 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
890 |
}
|
|
|
891 |
}
|
|
|
892 |
|
| 924 |
dpurdie |
893 |
p = new Package(7, "CotsWithFunnyVersion", "hoopla2_x.cots", ".cots", "CotsWithFunnyVersion.cots", "CC::/vob/CotsWithFunnyVersion::CotsWithFunnyVersion_hoopla2_x", 'x');
|
| 814 |
mhunt |
894 |
p.mPid = 8;
|
|
|
895 |
Integer pv_id = new Integer(7);
|
|
|
896 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
897 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
898 |
|
|
|
899 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
900 |
{
|
|
|
901 |
packageCollection.add(p);
|
|
|
902 |
}
|
|
|
903 |
else
|
|
|
904 |
{
|
|
|
905 |
plannedPackage.mVersion = "hoopla2_x";
|
|
|
906 |
}
|
|
|
907 |
|
| 924 |
dpurdie |
908 |
p = new Package(8, "NotInAnyWayReproducible", "1.0.0.tim", ".tim", "NotInAnyWayReproducible.tim", "CC::NA::NA", 'x');
|
| 814 |
mhunt |
909 |
p.mPid = 17;
|
|
|
910 |
pv_id = new Integer(8);
|
|
|
911 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
912 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
913 |
|
|
|
914 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
915 |
{
|
|
|
916 |
packageCollection.add(p);
|
|
|
917 |
}
|
|
|
918 |
else
|
|
|
919 |
{
|
|
|
920 |
plannedPackage.mVersion = "1.0.0";
|
|
|
921 |
}
|
|
|
922 |
|
|
|
923 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
924 |
{
|
| 924 |
dpurdie |
925 |
p = new Package(9, "CommonDependency", "1.0.0000.tim", ".tim", "CommonDependency.tim", "CC::/vob/CommonDependency::CommonDependency_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
926 |
p.mPid = 34;
|
|
|
927 |
pv_id = new Integer(9);
|
|
|
928 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
929 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
930 |
|
|
|
931 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
932 |
{
|
|
|
933 |
packageCollection.add(p);
|
|
|
934 |
}
|
|
|
935 |
else
|
|
|
936 |
{
|
|
|
937 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
938 |
}
|
|
|
939 |
}
|
|
|
940 |
|
|
|
941 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
942 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
943 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
944 |
{
|
| 924 |
dpurdie |
945 |
p = new Package(10, "SolarisCentricProduct", "1.0.0000.tim", ".tim", "SolarisCentricProduct.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.0.0000.tim", 'm');
|
| 814 |
mhunt |
946 |
p.mPid = 908;
|
|
|
947 |
pv_id = new Integer(10);
|
|
|
948 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
949 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
950 |
|
|
|
951 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
952 |
{
|
|
|
953 |
packageCollection.add(p);
|
|
|
954 |
}
|
|
|
955 |
else
|
|
|
956 |
{
|
|
|
957 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
958 |
}
|
|
|
959 |
}
|
|
|
960 |
|
| 924 |
dpurdie |
961 |
p = new Package(11, "LinuxCentricProduct", "1.0.0000.tim", ".tim", "LinuxCentricProduct.tim", "CC::/vob/LinuxCentricProduct::LinuxCentricProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
962 |
p.mPid = 16;
|
|
|
963 |
pv_id = new Integer(11);
|
|
|
964 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
965 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
966 |
|
|
|
967 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
968 |
{
|
|
|
969 |
packageCollection.add(p);
|
|
|
970 |
}
|
|
|
971 |
else
|
|
|
972 |
{
|
|
|
973 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
974 |
}
|
|
|
975 |
|
| 924 |
dpurdie |
976 |
p = new Package(12, "Win32CentricProduct", "1.0.0000.tim", ".tim", "Win32CentricProduct.tim", "CC::/vob/Win32CentricProduct::Win32CentricProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
977 |
p.mPid = 312;
|
|
|
978 |
pv_id = new Integer(12);
|
|
|
979 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
980 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
981 |
|
|
|
982 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
983 |
{
|
|
|
984 |
packageCollection.add(p);
|
|
|
985 |
}
|
|
|
986 |
else
|
|
|
987 |
{
|
|
|
988 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
989 |
}
|
|
|
990 |
|
|
|
991 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
992 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
993 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
994 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
995 |
{
|
| 924 |
dpurdie |
996 |
p = new Package(13, "GenericProduct", "1.0.0000.tim", ".tim", "GenericProduct.tim", "CC::/vob/ToBeMovedFromHere::GenericProduct_1.0.0000.tim", 'M');
|
| 814 |
mhunt |
997 |
p.mPid = 6;
|
|
|
998 |
pv_id = new Integer(13);
|
|
|
999 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1000 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1001 |
}
|
|
|
1002 |
|
|
|
1003 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1004 |
{
|
|
|
1005 |
packageCollection.add(p);
|
|
|
1006 |
}
|
|
|
1007 |
else
|
|
|
1008 |
{
|
|
|
1009 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
1010 |
}
|
|
|
1011 |
|
| 924 |
dpurdie |
1012 |
p = new Package(14, "AdvisoryDependency", "1.0.0000.tim", ".tim", "AdvisoryDependency.tim", "CC::/vob/AdvisoryDependency::AdvisoryDependency_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
1013 |
p.mPid = 81;
|
|
|
1014 |
pv_id = new Integer(14);
|
|
|
1015 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1016 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1017 |
|
|
|
1018 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1019 |
{
|
|
|
1020 |
packageCollection.add(p);
|
|
|
1021 |
}
|
|
|
1022 |
else
|
|
|
1023 |
{
|
|
|
1024 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
1025 |
}
|
|
|
1026 |
|
|
|
1027 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1028 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1029 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
1030 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
1031 |
|| mConnectionString.compareTo("iteration5") == 0
|
|
|
1032 |
|| mConnectionString.compareTo("iteration6") == 0 )
|
|
|
1033 |
{
|
| 924 |
dpurdie |
1034 |
p = new Package(15, "MergedProduct", "1.0.0000.tim", ".tim", "MergedProduct.tim", "CC::/vob/MergedProduct::MergedProduct_1.0.0000.tim", 'm');
|
| 814 |
mhunt |
1035 |
p.mPid = 1;
|
|
|
1036 |
pv_id = new Integer(15);
|
|
|
1037 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1038 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1039 |
}
|
|
|
1040 |
else
|
|
|
1041 |
{
|
| 924 |
dpurdie |
1042 |
p = new Package(16, "MergedProduct", "1.0.0000.tim", ".tim", "MergedProduct.tim", "CC::/vob/MergedProduct::MergedProduct_1.0.0000.tim", 'm');
|
| 814 |
mhunt |
1043 |
p.mPid = 1;
|
|
|
1044 |
pv_id = new Integer(16);
|
|
|
1045 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1046 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1047 |
}
|
|
|
1048 |
|
|
|
1049 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1050 |
{
|
|
|
1051 |
packageCollection.add(p);
|
|
|
1052 |
}
|
|
|
1053 |
else
|
|
|
1054 |
{
|
|
|
1055 |
plannedPackage.mVersion = "1.0.0000";
|
|
|
1056 |
}
|
|
|
1057 |
|
| 910 |
mhunt |
1058 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
1059 |
{
|
| 924 |
dpurdie |
1060 |
p = new Package(22, "Banana", "1.1.0000.tim", ".tim", "Banana.tim", "CC::/vob/Banana::Banana_1.1.0000.tim", 'x');
|
| 910 |
mhunt |
1061 |
p.mPid = 45;
|
|
|
1062 |
pv_id = new Integer(22);
|
|
|
1063 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1064 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1065 |
|
|
|
1066 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1067 |
{
|
|
|
1068 |
packageCollection.add(p);
|
|
|
1069 |
}
|
|
|
1070 |
else
|
|
|
1071 |
{
|
|
|
1072 |
plannedPackage.mVersion = "1.1.0000";
|
|
|
1073 |
}
|
|
|
1074 |
|
| 924 |
dpurdie |
1075 |
p = new Package(23, "Aardvark", "1.1.1000.tim", ".tim", "Aardvark.tim", "CC::/vob/Aardvark::Aardvark_1.1.1000.tim", 'x');
|
| 910 |
mhunt |
1076 |
p.mPid = 18;
|
|
|
1077 |
pv_id = new Integer(18);
|
|
|
1078 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1079 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1080 |
|
|
|
1081 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1082 |
{
|
|
|
1083 |
packageCollection.add(p);
|
|
|
1084 |
}
|
|
|
1085 |
else
|
|
|
1086 |
{
|
|
|
1087 |
plannedPackage.mVersion = "1.1.1000";
|
|
|
1088 |
}
|
|
|
1089 |
|
| 924 |
dpurdie |
1090 |
p = new Package(24, "Car", "1.0.10000.tim", ".tim", "Car.tim", "CC::/vob/Car::Car_1.0.10000.tim", 'x');
|
| 910 |
mhunt |
1091 |
p.mPid = 227;
|
|
|
1092 |
pv_id = new Integer(227);
|
|
|
1093 |
rippleEngine.mReleasedPvIDCollection.add(pv_id);
|
|
|
1094 |
plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1095 |
|
|
|
1096 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1097 |
{
|
|
|
1098 |
packageCollection.add(p);
|
|
|
1099 |
}
|
|
|
1100 |
else
|
|
|
1101 |
{
|
|
|
1102 |
plannedPackage.mVersion = "1.0.10000";
|
|
|
1103 |
}
|
|
|
1104 |
}
|
|
|
1105 |
|
|
|
1106 |
/* released dependencies
|
| 814 |
mhunt |
1107 |
* pv_id dpv_id pkg_name v_ext
|
|
|
1108 |
* 8 9 CommonDependency .tim
|
|
|
1109 |
* 9 7 CotsWithFunnyVersion .cots
|
|
|
1110 |
* 10 9 CommonDependency .tim
|
|
|
1111 |
* 11 44 AdvisoryDependency .tim
|
|
|
1112 |
* 13 9 CommonDependency .tim
|
|
|
1113 |
* 15 99 CommonDependency .tim
|
| 910 |
mhunt |
1114 |
* 23 22 Banana .tim
|
|
|
1115 |
* 24 23 Aardvark .tim
|
| 814 |
mhunt |
1116 |
*/
|
|
|
1117 |
if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
|
|
|
1118 |
{
|
|
|
1119 |
p = findPackage(2, packageCollection);
|
|
|
1120 |
p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
|
|
|
1121 |
p.mDependencyIDCollection.add(7);
|
|
|
1122 |
p.mDependencyCollection.add("UncommonDependency.tim");
|
|
|
1123 |
p.mDependencyIDCollection.add(0);
|
|
|
1124 |
}
|
|
|
1125 |
|
|
|
1126 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1127 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1128 |
&& mConnectionString.compareTo("iteration3") != 0 )
|
|
|
1129 |
{
|
|
|
1130 |
p = findPackage(3, packageCollection);
|
|
|
1131 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1132 |
p.mDependencyIDCollection.add(2);
|
|
|
1133 |
}
|
|
|
1134 |
|
|
|
1135 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1136 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1137 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1138 |
&& mConnectionString.compareTo("iteration4") != 0 )
|
|
|
1139 |
{
|
|
|
1140 |
p = findPackage(4, packageCollection);
|
|
|
1141 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1142 |
p.mDependencyIDCollection.add(2);
|
|
|
1143 |
}
|
|
|
1144 |
|
|
|
1145 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1146 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1147 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1148 |
&& mConnectionString.compareTo("iteration4") != 0
|
|
|
1149 |
&& mConnectionString.compareTo("iteration5") != 0 )
|
|
|
1150 |
{
|
|
|
1151 |
p = findPackage(5, packageCollection);
|
|
|
1152 |
p.mDependencyCollection.add("UncommonDependency.tim");
|
|
|
1153 |
p.mDependencyIDCollection.add(0);
|
|
|
1154 |
}
|
|
|
1155 |
|
|
|
1156 |
p = findPackage(8, packageCollection);
|
|
|
1157 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1158 |
p.mDependencyIDCollection.add(9);
|
|
|
1159 |
|
|
|
1160 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
1161 |
{
|
|
|
1162 |
p = findPackage(9, packageCollection);
|
|
|
1163 |
p.mDependencyCollection.add("CotsWithFunnyVersion.cots");
|
|
|
1164 |
p.mDependencyIDCollection.add(7);
|
|
|
1165 |
}
|
|
|
1166 |
|
|
|
1167 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1168 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1169 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
1170 |
{
|
|
|
1171 |
p = findPackage(10, packageCollection);
|
|
|
1172 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1173 |
p.mDependencyIDCollection.add(9);
|
|
|
1174 |
}
|
|
|
1175 |
|
|
|
1176 |
p = findPackage(11, packageCollection);
|
|
|
1177 |
p.mDependencyCollection.add("AdvisoryDependency.tim");
|
|
|
1178 |
p.mDependencyIDCollection.add(44);
|
|
|
1179 |
|
|
|
1180 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1181 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1182 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
1183 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
1184 |
{
|
|
|
1185 |
p = findPackage(13, packageCollection);
|
|
|
1186 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1187 |
p.mDependencyIDCollection.add(9);
|
|
|
1188 |
}
|
|
|
1189 |
|
|
|
1190 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1191 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1192 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
1193 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
1194 |
|| mConnectionString.compareTo("iteration5") == 0
|
|
|
1195 |
|| mConnectionString.compareTo("iteration6") == 0 )
|
|
|
1196 |
{
|
|
|
1197 |
p = findPackage(15, packageCollection);
|
|
|
1198 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1199 |
p.mDependencyIDCollection.add(99);
|
|
|
1200 |
}
|
|
|
1201 |
else
|
|
|
1202 |
{
|
|
|
1203 |
p = findPackage(16, packageCollection);
|
|
|
1204 |
p.mDependencyCollection.add("CommonDependency.tim");
|
|
|
1205 |
p.mDependencyIDCollection.add(2);
|
|
|
1206 |
}
|
|
|
1207 |
|
| 910 |
mhunt |
1208 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
1209 |
{
|
|
|
1210 |
p = findPackage(23, packageCollection);
|
|
|
1211 |
p.mDependencyCollection.add("Banana.tim");
|
|
|
1212 |
p.mDependencyIDCollection.add(22);
|
|
|
1213 |
|
|
|
1214 |
p = findPackage(24, packageCollection);
|
|
|
1215 |
p.mDependencyCollection.add("Aardvark.tim");
|
|
|
1216 |
p.mDependencyIDCollection.add(23);
|
|
|
1217 |
}
|
|
|
1218 |
|
| 814 |
mhunt |
1219 |
/* released build info
|
|
|
1220 |
* pv_id bm_name bsa_name
|
|
|
1221 |
* 7 Solaris Debug
|
|
|
1222 |
* 9 Linux Debug
|
|
|
1223 |
* 9 Solaris Debug
|
|
|
1224 |
* 9 Win32 Production
|
|
|
1225 |
* 10 Solaris Java 1.4
|
|
|
1226 |
* 11 Linux Production and Debug
|
|
|
1227 |
* 12 Win32 Java 1.6
|
|
|
1228 |
* 13 Generic Java 1.4
|
|
|
1229 |
* 14 Linux Debug
|
|
|
1230 |
* 15 Linux Debug
|
| 910 |
mhunt |
1231 |
* 22 Linux Java 1.6
|
|
|
1232 |
* 23 Linux Java 1.6
|
|
|
1233 |
* 24 Linux Java 1.6
|
| 814 |
mhunt |
1234 |
*/
|
|
|
1235 |
if ( mConnectionString.compareTo("iteration1") != 0 )
|
|
|
1236 |
{
|
|
|
1237 |
p = findPackage(0, packageCollection);
|
|
|
1238 |
bs = new BuildStandard(rippleEngine);
|
|
|
1239 |
bs.setLinux();
|
|
|
1240 |
bs.set1_6();
|
|
|
1241 |
p.mBuildStandardCollection.add(bs);
|
|
|
1242 |
}
|
|
|
1243 |
|
|
|
1244 |
if ( mConnectionString.compareTo("iteration1") != 0 && mConnectionString.compareTo("iteration2") != 0 )
|
|
|
1245 |
{
|
|
|
1246 |
p = findPackage(2, packageCollection);
|
|
|
1247 |
bs = new BuildStandard(rippleEngine);
|
|
|
1248 |
bs.setLinux();
|
|
|
1249 |
bs.setDebug();
|
|
|
1250 |
p.mBuildStandardCollection.add(bs);
|
|
|
1251 |
bs = new BuildStandard(rippleEngine);
|
|
|
1252 |
bs.setSolaris();
|
|
|
1253 |
bs.setProduction();
|
|
|
1254 |
p.mBuildStandardCollection.add(bs);
|
|
|
1255 |
bs = new BuildStandard(rippleEngine);
|
|
|
1256 |
bs.setWin32();
|
|
|
1257 |
bs.setAll();
|
|
|
1258 |
p.mBuildStandardCollection.add(bs);
|
|
|
1259 |
}
|
|
|
1260 |
|
|
|
1261 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1262 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1263 |
&& mConnectionString.compareTo("iteration3") != 0 )
|
|
|
1264 |
{
|
|
|
1265 |
p = findPackage(3, packageCollection);
|
|
|
1266 |
bs = new BuildStandard(rippleEngine);
|
|
|
1267 |
bs.setSolaris();
|
|
|
1268 |
bs.set1_4();
|
|
|
1269 |
p.mBuildStandardCollection.add(bs);
|
|
|
1270 |
}
|
|
|
1271 |
|
|
|
1272 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1273 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1274 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1275 |
&& mConnectionString.compareTo("iteration4") != 0 )
|
|
|
1276 |
{
|
|
|
1277 |
p = findPackage(4, packageCollection);
|
|
|
1278 |
bs = new BuildStandard(rippleEngine);
|
|
|
1279 |
bs.setGeneric();
|
|
|
1280 |
bs.set1_5();
|
|
|
1281 |
p.mBuildStandardCollection.add(bs);
|
|
|
1282 |
}
|
|
|
1283 |
|
|
|
1284 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1285 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1286 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1287 |
&& mConnectionString.compareTo("iteration4") != 0
|
|
|
1288 |
&& mConnectionString.compareTo("iteration5") != 0 )
|
|
|
1289 |
{
|
|
|
1290 |
p = findPackage(5, packageCollection);
|
|
|
1291 |
bs = new BuildStandard(rippleEngine);
|
|
|
1292 |
bs.setLinux();
|
|
|
1293 |
bs.set1_6();
|
|
|
1294 |
p.mBuildStandardCollection.add(bs);
|
|
|
1295 |
bs = new BuildStandard(rippleEngine);
|
|
|
1296 |
bs.setWin32();
|
|
|
1297 |
bs.set1_6();
|
|
|
1298 |
p.mBuildStandardCollection.add(bs);
|
|
|
1299 |
}
|
|
|
1300 |
|
|
|
1301 |
p = findPackage(7, packageCollection);
|
|
|
1302 |
bs = new BuildStandard(rippleEngine);
|
|
|
1303 |
bs.setSolaris();
|
|
|
1304 |
bs.setDebug();
|
|
|
1305 |
p.mBuildStandardCollection.add(bs);
|
|
|
1306 |
|
|
|
1307 |
if ( mConnectionString.compareTo("iteration1") == 0 || mConnectionString.compareTo("iteration2") == 0 )
|
|
|
1308 |
{
|
|
|
1309 |
p = findPackage(9, packageCollection);
|
|
|
1310 |
bs = new BuildStandard(rippleEngine);
|
|
|
1311 |
bs.setLinux();
|
|
|
1312 |
bs.setDebug();
|
|
|
1313 |
p.mBuildStandardCollection.add(bs);
|
|
|
1314 |
bs = new BuildStandard(rippleEngine);
|
|
|
1315 |
bs.setSolaris();
|
|
|
1316 |
bs.setDebug();
|
|
|
1317 |
p.mBuildStandardCollection.add(bs);
|
|
|
1318 |
bs = new BuildStandard(rippleEngine);
|
|
|
1319 |
bs.setWin32();
|
|
|
1320 |
bs.setProduction();
|
|
|
1321 |
p.mBuildStandardCollection.add(bs);
|
|
|
1322 |
}
|
|
|
1323 |
|
|
|
1324 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1325 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1326 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
1327 |
{
|
|
|
1328 |
p = findPackage(10, packageCollection);
|
|
|
1329 |
bs = new BuildStandard(rippleEngine);
|
|
|
1330 |
bs.setSolaris();
|
|
|
1331 |
bs.set1_4();
|
|
|
1332 |
p.mBuildStandardCollection.add(bs);
|
|
|
1333 |
}
|
|
|
1334 |
|
|
|
1335 |
p = findPackage(11, packageCollection);
|
|
|
1336 |
bs = new BuildStandard(rippleEngine);
|
|
|
1337 |
bs.setLinux();
|
|
|
1338 |
bs.setAll();
|
|
|
1339 |
p.mBuildStandardCollection.add(bs);
|
|
|
1340 |
|
|
|
1341 |
p = findPackage(12, packageCollection);
|
|
|
1342 |
bs = new BuildStandard(rippleEngine);
|
|
|
1343 |
bs.setWin32();
|
|
|
1344 |
bs.set1_6();
|
|
|
1345 |
p.mBuildStandardCollection.add(bs);
|
|
|
1346 |
|
|
|
1347 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1348 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1349 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
1350 |
|| mConnectionString.compareTo("iteration4") == 0 )
|
|
|
1351 |
{
|
|
|
1352 |
p = findPackage(13, packageCollection);
|
|
|
1353 |
bs = new BuildStandard(rippleEngine);
|
|
|
1354 |
bs.setGeneric();
|
|
|
1355 |
bs.set1_4();
|
|
|
1356 |
p.mBuildStandardCollection.add(bs);
|
|
|
1357 |
}
|
|
|
1358 |
|
|
|
1359 |
p = findPackage(14, packageCollection);
|
|
|
1360 |
bs = new BuildStandard(rippleEngine);
|
|
|
1361 |
bs.setLinux();
|
|
|
1362 |
bs.setDebug();
|
|
|
1363 |
p.mBuildStandardCollection.add(bs);
|
|
|
1364 |
|
|
|
1365 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1366 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1367 |
|| mConnectionString.compareTo("iteration3") == 0
|
|
|
1368 |
|| mConnectionString.compareTo("iteration4") == 0
|
|
|
1369 |
|| mConnectionString.compareTo("iteration5") == 0
|
|
|
1370 |
|| mConnectionString.compareTo("iteration6") == 0 )
|
|
|
1371 |
{
|
|
|
1372 |
p = findPackage(15, packageCollection);
|
|
|
1373 |
bs = new BuildStandard(rippleEngine);
|
|
|
1374 |
bs.setLinux();
|
|
|
1375 |
bs.setDebug();
|
|
|
1376 |
p.mBuildStandardCollection.add(bs);
|
|
|
1377 |
}
|
|
|
1378 |
else
|
|
|
1379 |
{
|
|
|
1380 |
p = findPackage(16, packageCollection);
|
|
|
1381 |
bs = new BuildStandard(rippleEngine);
|
|
|
1382 |
bs.setLinux();
|
|
|
1383 |
bs.setDebug();
|
|
|
1384 |
p.mBuildStandardCollection.add(bs);
|
| 910 |
mhunt |
1385 |
}
|
|
|
1386 |
|
|
|
1387 |
if ( mConnectionString.compareTo("iteration1") == 0 )
|
|
|
1388 |
{
|
|
|
1389 |
p = findPackage(22, packageCollection);
|
|
|
1390 |
bs = new BuildStandard(rippleEngine);
|
|
|
1391 |
bs.setLinux();
|
|
|
1392 |
bs.set1_6();
|
|
|
1393 |
p.mBuildStandardCollection.add(bs);
|
|
|
1394 |
|
|
|
1395 |
p = findPackage(23, packageCollection);
|
|
|
1396 |
bs = new BuildStandard(rippleEngine);
|
|
|
1397 |
bs.setLinux();
|
|
|
1398 |
bs.set1_6();
|
|
|
1399 |
p.mBuildStandardCollection.add(bs);
|
|
|
1400 |
|
|
|
1401 |
p = findPackage(24, packageCollection);
|
|
|
1402 |
bs = new BuildStandard(rippleEngine);
|
|
|
1403 |
bs.setLinux();
|
|
|
1404 |
bs.set1_6();
|
|
|
1405 |
p.mBuildStandardCollection.add(bs);
|
| 814 |
mhunt |
1406 |
}
|
| 910 |
mhunt |
1407 |
|
|
|
1408 |
/* released package unit test info
|
| 814 |
mhunt |
1409 |
* pv_id tt.test_type_name
|
|
|
1410 |
* 9 Manual Test
|
|
|
1411 |
* 9 Interactive Test
|
|
|
1412 |
* 9 Integration Test
|
|
|
1413 |
* 11 Autobuild UTF
|
|
|
1414 |
*/
|
|
|
1415 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1416 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1417 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1418 |
&& mConnectionString.compareTo("iteration4") != 0
|
|
|
1419 |
&& mConnectionString.compareTo("iteration5") != 0 )
|
|
|
1420 |
{
|
|
|
1421 |
p = findPackage(5, packageCollection);
|
|
|
1422 |
p.mHasAutomatedUnitTests = true;
|
|
|
1423 |
}
|
|
|
1424 |
|
|
|
1425 |
p = findPackage(11, packageCollection);
|
|
|
1426 |
p.mHasAutomatedUnitTests = true;
|
|
|
1427 |
|
|
|
1428 |
/* released build failure email info
|
|
|
1429 |
* pv_id user_email
|
|
|
1430 |
* 10 jimmyfishcake@erggroup.com
|
|
|
1431 |
*/
|
|
|
1432 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1433 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1434 |
&& mConnectionString.compareTo("iteration3") != 0 )
|
|
|
1435 |
{
|
|
|
1436 |
p = findPackage(3, packageCollection);
|
| 864 |
mhunt |
1437 |
p.addEmail("jimmyfishcake@erggroup.com");
|
|
|
1438 |
p.addEmail("rayhaddock@erggroup.com");
|
| 814 |
mhunt |
1439 |
}
|
|
|
1440 |
|
|
|
1441 |
if ( mConnectionString.compareTo("iteration1") != 0
|
|
|
1442 |
&& mConnectionString.compareTo("iteration2") != 0
|
|
|
1443 |
&& mConnectionString.compareTo("iteration3") != 0
|
|
|
1444 |
&& mConnectionString.compareTo("iteration4") != 0
|
|
|
1445 |
&& mConnectionString.compareTo("iteration5") != 0 )
|
|
|
1446 |
{
|
|
|
1447 |
p = findPackage(5, packageCollection);
|
| 864 |
mhunt |
1448 |
p.addEmail("timbutdim@erggroup.com");
|
| 814 |
mhunt |
1449 |
}
|
|
|
1450 |
|
|
|
1451 |
if ( mConnectionString.compareTo("iteration1") == 0
|
|
|
1452 |
|| mConnectionString.compareTo("iteration2") == 0
|
|
|
1453 |
|| mConnectionString.compareTo("iteration3") == 0 )
|
|
|
1454 |
{
|
|
|
1455 |
p = findPackage(10, packageCollection);
|
| 864 |
mhunt |
1456 |
p.addEmail("jimmyfishcake@erggroup.com");
|
| 814 |
mhunt |
1457 |
}
|
|
|
1458 |
|
|
|
1459 |
/* released advisory ripple info
|
|
|
1460 |
* pv_id
|
|
|
1461 |
* 14
|
|
|
1462 |
*/
|
|
|
1463 |
if ( mConnectionString.compareTo("iteration1") != 0 )
|
|
|
1464 |
{
|
|
|
1465 |
p = findPackage(0, packageCollection);
|
|
|
1466 |
p.mAdvisoryRipple = true;
|
|
|
1467 |
}
|
|
|
1468 |
|
|
|
1469 |
p = findPackage(14, packageCollection);
|
|
|
1470 |
p.mAdvisoryRipple = true;
|
|
|
1471 |
}
|
|
|
1472 |
else
|
|
|
1473 |
{
|
| 924 |
dpurdie |
1474 |
/* prod_id pkg_name pkg_version v_ext pkg_vcs_tag
|
| 814 |
mhunt |
1475 |
* 8 NotInAnyWayReproducible 1.0.0.tim .tim NA NA
|
|
|
1476 |
* 10 SolarisCentricProduct 1.0.0000.tim .tim SolarisCentricProduct_1.0.0000.tim \vob\SolarisCentricProduct
|
|
|
1477 |
* 11 LinuxCentricProduct 1.0.0000.tim .tim LinuxCentricProduct_1.0.0000.tim \vob\LinuxCentricProduct
|
|
|
1478 |
* 12 Win32CentricProduct 1.0.0000.tim .tim Win32CentricProduct_1.0.0000.tim \vob\Win32CentricProduct
|
|
|
1479 |
* 13 GenericProduct 1.0.0000.tim .tim GenericProduct_1.0.0000.tim \vob\ToBeMovedFromHere
|
|
|
1480 |
*/
|
| 924 |
dpurdie |
1481 |
Package p = new Package(8, "NotInAnyWayReproducible", "1.0.0.tim", ".tim", "NotInAnyWayReproducible.1.0.0.tim", "CC::NA::NA", 'x');
|
| 814 |
mhunt |
1482 |
packageCollection.add(p);
|
| 924 |
dpurdie |
1483 |
p = new Package(10, "SolarisCentricProduct", "1.0.0000.tim", ".tim", "SolarisCentricProduct.1.0.0000.tim", "CC::/vob/SolarisCentricProduct::SolarisCentricProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
1484 |
packageCollection.add(p);
|
| 924 |
dpurdie |
1485 |
p = new Package(11, "LinuxCentricProduct", "1.0.0000.tim", ".tim", "LinuxCentricProduct.1.0.0000.tim", "CC::/vob/LinuxCentricProduct::LinuxCentricProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
1486 |
packageCollection.add(p);
|
| 924 |
dpurdie |
1487 |
p = new Package(12, "Win32CentricProduct", "1.0.0000.tim", ".tim", "Win32CentricProduct.1.0.0000.tim", "CC::/vob/Win32CentricProduct::Win32CentricProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
1488 |
packageCollection.add(p);
|
| 924 |
dpurdie |
1489 |
p = new Package(13, "GenericProduct", "1.0.0000.tim", ".tim", "GenericProduct.1.0.0000.tim", "CC::/vob/ToBeMovedFromHere::GenericProduct_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
1490 |
packageCollection.add(p);
|
|
|
1491 |
|
|
|
1492 |
/* the above products have the following dependencies which will be discovered in traverseDependencies
|
| 924 |
dpurdie |
1493 |
* pv_id pkg_name, dpv.pkg_version, dpv.v_ext, dpv.pkg_vcs_tag
|
| 814 |
mhunt |
1494 |
* 7 CotsWithFunnyVersion hoopla2_x.cots .cots CotsWithFunnyVersion_hoopla2_x.cots \vob\CotsWithFunnyVersion
|
|
|
1495 |
* 9 CommonDependency 1.0.0000.tim .tim CommonDependency_1.0.0000.tim \vob\CommonDependency
|
|
|
1496 |
* 14 AdvisoryDependency 1.0.0000.tim .tim AdvisoryDependency_1.0.0000.tim \vob\AdvisoryDependency
|
|
|
1497 |
* the above packages have the following build info
|
|
|
1498 |
* pv_id bm_name bsa_name
|
|
|
1499 |
* 7 Solaris Debug
|
|
|
1500 |
* 9 Linux Debug
|
|
|
1501 |
* 9 Solaris Debug
|
|
|
1502 |
* 9 Win32 Production
|
|
|
1503 |
* 10 Solaris Java 1.4
|
|
|
1504 |
* 11 Linux Production and Debug
|
|
|
1505 |
* 12 Win32 Java 1.6
|
|
|
1506 |
* 13 Generic Java 1.4
|
|
|
1507 |
* 14 Linux Debug
|
|
|
1508 |
*/
|
|
|
1509 |
}
|
|
|
1510 |
}
|
|
|
1511 |
else
|
|
|
1512 |
{
|
|
|
1513 |
try
|
|
|
1514 |
{
|
|
|
1515 |
if (daemonMode)
|
|
|
1516 |
{
|
| 4123 |
dpurdie |
1517 |
mLogger.warn("queryPackageVersions: stmt0");
|
| 864 |
mhunt |
1518 |
Vector<String> globalAndProjectWideBuildFailureEmailCollection = new Vector<String>();
|
| 868 |
mhunt |
1519 |
globalAndProjectWideBuildFailureEmailCollection.add(queryGlobalAddresses());
|
| 864 |
mhunt |
1520 |
|
|
|
1521 |
CallableStatement stmt0 = mConnection.prepareCall(
|
|
|
1522 |
"select u.user_email " +
|
| 4212 |
dpurdie |
1523 |
"from release_manager.autobuild_failure af, " +
|
|
|
1524 |
"release_manager.members_group mg, " +
|
|
|
1525 |
"release_manager.users u, " +
|
|
|
1526 |
"release_manager.views v, " +
|
|
|
1527 |
"release_manager.release_tags rt " +
|
| 864 |
mhunt |
1528 |
"where rt.rtag_id=" + baseline + " " +
|
|
|
1529 |
"and v.view_name='PROJECT WIDE' " +
|
|
|
1530 |
"and af.proj_id=rt.proj_id " +
|
|
|
1531 |
"and af.view_id=v.view_id " +
|
|
|
1532 |
"and mg.group_email_id=af.group_email_id " +
|
|
|
1533 |
"and u.user_id=mg.user_id"
|
|
|
1534 |
);
|
|
|
1535 |
ResultSet rset0 = stmt0.executeQuery();
|
|
|
1536 |
|
|
|
1537 |
while( rset0.next() )
|
|
|
1538 |
{
|
|
|
1539 |
String email = rset0.getString("user_email");
|
|
|
1540 |
|
|
|
1541 |
if ( email != null )
|
|
|
1542 |
{
|
|
|
1543 |
globalAndProjectWideBuildFailureEmailCollection.add(email);
|
|
|
1544 |
}
|
|
|
1545 |
}
|
|
|
1546 |
|
|
|
1547 |
rset0.close();
|
|
|
1548 |
stmt0.close();
|
|
|
1549 |
|
| 814 |
mhunt |
1550 |
// get planned package info
|
| 876 |
mhunt |
1551 |
// devi 48629 support multiple wips on the same package and build in the order they were released
|
| 4212 |
dpurdie |
1552 |
// These are packages that are marked as pending build
|
|
|
1553 |
//
|
| 4123 |
dpurdie |
1554 |
mLogger.warn("queryPackageVersions: stmt1");
|
| 814 |
mhunt |
1555 |
CallableStatement stmt1 = mConnection.prepareCall(
|
| 4212 |
dpurdie |
1556 |
"select pl.pv_id, p.pkg_id, p.pkg_name, pv.pkg_version, " +
|
| 924 |
dpurdie |
1557 |
"pv.v_ext, pv.change_type, pv.ripple_field," +
|
|
|
1558 |
"pv.major_limit, pv.minor_limit, pv.patch_limit, pv.build_number_limit," +
|
|
|
1559 |
"pv.modified_stamp," +
|
|
|
1560 |
"release_manager.PK_RMAPI.return_vcs_tag(pl.pv_id) AS vcsTag" +
|
|
|
1561 |
" from release_manager.planned pl," +
|
|
|
1562 |
"release_manager.package_versions pv," +
|
|
|
1563 |
"release_manager.packages p" +
|
|
|
1564 |
" where pl.rtag_id=" + baseline +
|
|
|
1565 |
" and pv.build_type='A' and pv.dlocked='A'" +
|
|
|
1566 |
" and pv.pv_id=pl.pv_id and p.pkg_id=pv.pkg_id" +
|
|
|
1567 |
" order by pv.modified_stamp"
|
| 814 |
mhunt |
1568 |
);
|
|
|
1569 |
ResultSet rset1 = stmt1.executeQuery();
|
|
|
1570 |
|
|
|
1571 |
while( rset1.next() )
|
|
|
1572 |
{
|
|
|
1573 |
int pv_id = rset1.getInt("pv_id");
|
|
|
1574 |
|
|
|
1575 |
if ( rset1.wasNull() )
|
|
|
1576 |
{
|
|
|
1577 |
mLogger.fatal("queryPackageVersions rset1 null pv_id");
|
|
|
1578 |
// show stopper
|
| 868 |
mhunt |
1579 |
throw new Exception("queryPackageVersions rset1 null pv_id");
|
| 814 |
mhunt |
1580 |
}
|
|
|
1581 |
|
|
|
1582 |
int pkg_id = rset1.getInt("pkg_id");
|
|
|
1583 |
|
|
|
1584 |
if ( rset1.wasNull() )
|
|
|
1585 |
{
|
|
|
1586 |
mLogger.fatal("queryPackageVersions rset1 null pkg_id " + pv_id);
|
|
|
1587 |
// show stopper
|
| 868 |
mhunt |
1588 |
throw new Exception("queryPackageVersions rset1 null pkg_id " + pv_id);
|
| 814 |
mhunt |
1589 |
}
|
|
|
1590 |
|
|
|
1591 |
String pkg_name = rset1.getString("pkg_name");
|
|
|
1592 |
|
|
|
1593 |
if ( pkg_name == null )
|
|
|
1594 |
{
|
|
|
1595 |
mLogger.fatal("queryPackageVersions rset1 null pkg_name " + pv_id);
|
|
|
1596 |
// show stopper
|
| 868 |
mhunt |
1597 |
throw new Exception("queryPackageVersions rset1 null pkg_name " + pv_id);
|
| 814 |
mhunt |
1598 |
}
|
|
|
1599 |
|
| 4212 |
dpurdie |
1600 |
String pkg_version = rset1.getString("pkg_version");
|
|
|
1601 |
if (pkg_version == null)
|
|
|
1602 |
{
|
|
|
1603 |
pkg_version = "1.0.0000";
|
|
|
1604 |
mLogger.fatal("queryPackageVersions rset1 null pkg_version " + pv_id);
|
|
|
1605 |
// show stopper
|
|
|
1606 |
throw new Exception("queryPackageVersions rset1 null pkg_version " + pv_id);
|
|
|
1607 |
}
|
|
|
1608 |
|
| 814 |
mhunt |
1609 |
String v_ext = rset1.getString("v_ext");
|
|
|
1610 |
|
|
|
1611 |
if ( v_ext == null )
|
|
|
1612 |
{
|
|
|
1613 |
v_ext = "";
|
|
|
1614 |
}
|
|
|
1615 |
|
|
|
1616 |
String change_type = rset1.getString("change_type");
|
|
|
1617 |
|
|
|
1618 |
if ( change_type == null )
|
|
|
1619 |
{
|
|
|
1620 |
change_type = "P";
|
|
|
1621 |
}
|
|
|
1622 |
|
|
|
1623 |
char ct = 'x';
|
|
|
1624 |
|
|
|
1625 |
if ( change_type.compareTo("M") == 0 )
|
|
|
1626 |
{
|
|
|
1627 |
ct = 'M';
|
|
|
1628 |
}
|
|
|
1629 |
else if ( change_type.compareTo("N") == 0 )
|
|
|
1630 |
{
|
|
|
1631 |
ct = 'N';
|
|
|
1632 |
}
|
|
|
1633 |
else if ( change_type.compareTo("P") == 0 )
|
|
|
1634 |
{
|
|
|
1635 |
ct = 'P';
|
|
|
1636 |
}
|
| 4212 |
dpurdie |
1637 |
else if ( change_type.compareTo("F") == 0 )
|
|
|
1638 |
{
|
|
|
1639 |
ct = 'F';
|
|
|
1640 |
}
|
| 814 |
mhunt |
1641 |
|
|
|
1642 |
if ( ct != 'x' )
|
|
|
1643 |
{
|
| 902 |
mhunt |
1644 |
String ripple_field = rset1.getString("ripple_field");
|
|
|
1645 |
|
|
|
1646 |
if ( ripple_field == null )
|
|
|
1647 |
{
|
|
|
1648 |
ripple_field = "b";
|
|
|
1649 |
}
|
|
|
1650 |
else if ( ripple_field.length() == 0 )
|
|
|
1651 |
{
|
|
|
1652 |
ripple_field = "b";
|
|
|
1653 |
}
|
|
|
1654 |
|
|
|
1655 |
int major_limit = rset1.getInt("major_limit");
|
|
|
1656 |
|
|
|
1657 |
if ( rset1.wasNull() )
|
|
|
1658 |
{
|
|
|
1659 |
major_limit = 0;
|
|
|
1660 |
}
|
|
|
1661 |
|
|
|
1662 |
int minor_limit = rset1.getInt("minor_limit");
|
|
|
1663 |
|
|
|
1664 |
if ( rset1.wasNull() )
|
|
|
1665 |
{
|
|
|
1666 |
minor_limit = 0;
|
|
|
1667 |
}
|
|
|
1668 |
|
|
|
1669 |
int patch_limit = rset1.getInt("patch_limit");
|
|
|
1670 |
|
|
|
1671 |
if ( rset1.wasNull() )
|
|
|
1672 |
{
|
|
|
1673 |
patch_limit = 0;
|
|
|
1674 |
}
|
|
|
1675 |
|
|
|
1676 |
int build_number_limit = rset1.getInt("build_number_limit");
|
|
|
1677 |
|
|
|
1678 |
if ( rset1.wasNull() )
|
|
|
1679 |
{
|
|
|
1680 |
build_number_limit = 0;
|
|
|
1681 |
}
|
|
|
1682 |
|
| 924 |
dpurdie |
1683 |
String vcs_tag = rset1.getString("vcsTag");
|
|
|
1684 |
if ( vcs_tag == null )
|
|
|
1685 |
{
|
|
|
1686 |
vcs_tag = "";
|
|
|
1687 |
}
|
|
|
1688 |
|
| 4212 |
dpurdie |
1689 |
Package p = new Package(pv_id, pkg_name, v_ext, pkg_name + v_ext, vcs_tag, ct, ripple_field.charAt(0), pkg_version);
|
| 814 |
mhunt |
1690 |
p.mPid = pkg_id;
|
|
|
1691 |
p.mDirectlyPlanned = true;
|
| 902 |
mhunt |
1692 |
p.mMajorLimit = major_limit;
|
|
|
1693 |
p.mMinorLimit = minor_limit;
|
|
|
1694 |
p.mPatchLimit = patch_limit;
|
|
|
1695 |
p.mBuildLimit = build_number_limit;
|
| 878 |
mhunt |
1696 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
1697 |
|
|
|
1698 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
1699 |
{
|
|
|
1700 |
mLogger.info("queryPackageVersions rset1 no previous planned package " + pv_id);
|
|
|
1701 |
packageCollection.add(p);
|
|
|
1702 |
}
|
| 814 |
mhunt |
1703 |
}
|
|
|
1704 |
}
|
| 830 |
mhunt |
1705 |
|
|
|
1706 |
rset1.close();
|
|
|
1707 |
stmt1.close();
|
| 814 |
mhunt |
1708 |
|
|
|
1709 |
// get planned package dependency info
|
| 4123 |
dpurdie |
1710 |
mLogger.warn("queryPackageVersions: stmt2");
|
| 814 |
mhunt |
1711 |
CallableStatement stmt2 = mConnection.prepareCall(
|
| 878 |
mhunt |
1712 |
"select pl.pv_id, p.pkg_name, dpv.v_ext, pv.modified_stamp " +
|
| 814 |
mhunt |
1713 |
"from release_manager.planned pl, release_manager.package_versions pv, release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p " +
|
|
|
1714 |
"where pl.rtag_id=" + baseline + " and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1715 |
"and pv.pv_id = pl.pv_id and pd.pv_id=pl.pv_id and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id " +
|
| 878 |
mhunt |
1716 |
"order by pv.modified_stamp"
|
| 814 |
mhunt |
1717 |
);
|
|
|
1718 |
ResultSet rset2 = stmt2.executeQuery();
|
|
|
1719 |
|
|
|
1720 |
while( rset2.next() )
|
|
|
1721 |
{
|
|
|
1722 |
boolean ignore = false;
|
|
|
1723 |
|
|
|
1724 |
int pv_id = rset2.getInt("pv_id");
|
|
|
1725 |
|
|
|
1726 |
if ( rset2.wasNull() )
|
|
|
1727 |
{
|
|
|
1728 |
mLogger.fatal("queryPackageVersions rset2 null pv_id");
|
|
|
1729 |
// show stopper
|
| 868 |
mhunt |
1730 |
throw new Exception("queryPackageVersions rset2 null pv_id");
|
| 814 |
mhunt |
1731 |
}
|
|
|
1732 |
|
|
|
1733 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1734 |
|
|
|
1735 |
if ( p == NULL_PACKAGE )
|
|
|
1736 |
{
|
| 878 |
mhunt |
1737 |
mLogger.info("queryPackageVersions rset2 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
1738 |
ignore = true;
|
|
|
1739 |
}
|
|
|
1740 |
|
|
|
1741 |
String pkg_name = rset2.getString("pkg_name");
|
|
|
1742 |
|
|
|
1743 |
if ( pkg_name == null )
|
|
|
1744 |
{
|
|
|
1745 |
mLogger.fatal("queryPackageVersions rset2 null pkg_name " + pv_id);
|
|
|
1746 |
// show stopper
|
| 868 |
mhunt |
1747 |
throw new Exception("queryPackageVersions rset2 null pkg_name " + pv_id);
|
| 814 |
mhunt |
1748 |
}
|
|
|
1749 |
|
|
|
1750 |
String v_ext = rset2.getString("v_ext");
|
|
|
1751 |
|
|
|
1752 |
if ( v_ext == null )
|
|
|
1753 |
{
|
|
|
1754 |
v_ext = "";
|
|
|
1755 |
}
|
|
|
1756 |
|
|
|
1757 |
if ( !ignore )
|
|
|
1758 |
{
|
|
|
1759 |
p.mDependencyCollection.add(pkg_name + v_ext);
|
|
|
1760 |
p.mDependencyIDCollection.add(-1);
|
|
|
1761 |
}
|
|
|
1762 |
}
|
|
|
1763 |
|
| 830 |
mhunt |
1764 |
rset2.close();
|
|
|
1765 |
stmt2.close();
|
|
|
1766 |
|
| 814 |
mhunt |
1767 |
// get planned package build info
|
| 4123 |
dpurdie |
1768 |
mLogger.warn("queryPackageVersions: stmt3");
|
| 814 |
mhunt |
1769 |
CallableStatement stmt3 = mConnection.prepareCall(
|
| 878 |
mhunt |
1770 |
"select pl.pv_id, bm.bm_name, bsa.bsa_name, pv.modified_stamp " +
|
| 814 |
mhunt |
1771 |
"from release_manager.planned pl, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa " +
|
|
|
1772 |
"where pl.rtag_id=" + baseline + " and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1773 |
"and pv.pv_id = pl.pv_id and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id " +
|
| 878 |
mhunt |
1774 |
"order by pv.modified_stamp"
|
| 814 |
mhunt |
1775 |
);
|
|
|
1776 |
ResultSet rset3 = stmt3.executeQuery();
|
|
|
1777 |
|
|
|
1778 |
while( rset3.next() )
|
|
|
1779 |
{
|
|
|
1780 |
boolean ignore = false;
|
|
|
1781 |
int pv_id = rset3.getInt("pv_id");
|
|
|
1782 |
|
|
|
1783 |
if ( rset3.wasNull() )
|
|
|
1784 |
{
|
|
|
1785 |
mLogger.fatal("queryPackageVersions rset3 null pv_id");
|
|
|
1786 |
// show stopper
|
| 868 |
mhunt |
1787 |
throw new Exception("queryPackageVersions rset3 null pv_id");
|
| 814 |
mhunt |
1788 |
}
|
|
|
1789 |
|
|
|
1790 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1791 |
|
|
|
1792 |
if ( p == NULL_PACKAGE )
|
|
|
1793 |
{
|
| 878 |
mhunt |
1794 |
mLogger.info("queryPackageVersions rset3 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
1795 |
ignore = true;
|
|
|
1796 |
}
|
|
|
1797 |
|
|
|
1798 |
String bm_name = rset3.getString("bm_name");
|
|
|
1799 |
|
|
|
1800 |
if ( bm_name == null )
|
|
|
1801 |
{
|
|
|
1802 |
mLogger.fatal("queryPackageVersions rset3 null bm_name " + pv_id);
|
|
|
1803 |
// show stopper
|
| 868 |
mhunt |
1804 |
throw new Exception("queryPackageVersions rset3 null bm_name " + pv_id);
|
| 814 |
mhunt |
1805 |
}
|
|
|
1806 |
|
|
|
1807 |
String bsa_name = rset3.getString("bsa_name");
|
|
|
1808 |
|
|
|
1809 |
if ( bsa_name == null )
|
|
|
1810 |
{
|
|
|
1811 |
mLogger.fatal("queryPackageVersions rset3 null bsa_name " + pv_id);
|
|
|
1812 |
// show stopper
|
| 868 |
mhunt |
1813 |
throw new Exception("queryPackageVersions rset3 null bsa_name " + pv_id);
|
| 814 |
mhunt |
1814 |
}
|
|
|
1815 |
|
|
|
1816 |
if ( !ignore )
|
|
|
1817 |
{
|
| 908 |
mhunt |
1818 |
BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
|
| 814 |
mhunt |
1819 |
|
| 908 |
mhunt |
1820 |
if ( bs.supportedBuildStandard() )
|
| 814 |
mhunt |
1821 |
{
|
|
|
1822 |
p.mBuildStandardCollection.add(bs);
|
|
|
1823 |
}
|
|
|
1824 |
}
|
|
|
1825 |
}
|
| 830 |
mhunt |
1826 |
|
|
|
1827 |
rset3.close();
|
|
|
1828 |
stmt3.close();
|
| 814 |
mhunt |
1829 |
|
|
|
1830 |
// get planned package unit test info
|
| 4123 |
dpurdie |
1831 |
mLogger.warn("queryPackageVersions: stmt4");
|
| 814 |
mhunt |
1832 |
CallableStatement stmt4 = mConnection.prepareCall(
|
| 878 |
mhunt |
1833 |
"select pl.pv_id, tt.test_type_name, pv.modified_stamp " +
|
| 814 |
mhunt |
1834 |
"from release_manager.planned pl, release_manager.package_versions pv, release_manager.unit_tests ut, release_manager.test_types tt " +
|
|
|
1835 |
"where pl.rtag_id=" + baseline + " and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1836 |
"and pv.pv_id = pl.pv_id and ut.pv_id=pv.pv_id and tt.test_type_id=ut.test_types_fk " +
|
| 878 |
mhunt |
1837 |
"order by pv.modified_stamp"
|
| 814 |
mhunt |
1838 |
);
|
|
|
1839 |
ResultSet rset4 = stmt4.executeQuery();
|
|
|
1840 |
|
|
|
1841 |
while( rset4.next() )
|
|
|
1842 |
{
|
|
|
1843 |
boolean ignore = false;
|
|
|
1844 |
|
|
|
1845 |
int pv_id = rset4.getInt("pv_id");
|
|
|
1846 |
|
|
|
1847 |
if ( rset4.wasNull() )
|
|
|
1848 |
{
|
|
|
1849 |
mLogger.fatal("queryPackageVersions rset4 null pv_id");
|
|
|
1850 |
// show stopper
|
| 868 |
mhunt |
1851 |
throw new Exception("queryPackageVersions rset4 null pv_id");
|
| 814 |
mhunt |
1852 |
}
|
|
|
1853 |
|
|
|
1854 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1855 |
|
|
|
1856 |
if ( p == NULL_PACKAGE )
|
|
|
1857 |
{
|
| 878 |
mhunt |
1858 |
mLogger.info("queryPackageVersions rset4 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
1859 |
ignore = true;
|
|
|
1860 |
}
|
|
|
1861 |
|
|
|
1862 |
String test_type_name = rset4.getString("test_type_name");
|
|
|
1863 |
|
|
|
1864 |
if ( test_type_name == null )
|
|
|
1865 |
{
|
|
|
1866 |
mLogger.fatal("queryPackageVersions rset4 null test_type_name " + pv_id);
|
|
|
1867 |
// show stopper
|
| 868 |
mhunt |
1868 |
throw new Exception("queryPackageVersions rset4 null test_type_name " + pv_id);
|
| 814 |
mhunt |
1869 |
}
|
|
|
1870 |
|
|
|
1871 |
if ( !ignore )
|
|
|
1872 |
{
|
|
|
1873 |
if ( test_type_name.compareTo("Autobuild UTF") == 0 )
|
|
|
1874 |
{
|
|
|
1875 |
p.mHasAutomatedUnitTests = true;
|
|
|
1876 |
}
|
|
|
1877 |
}
|
|
|
1878 |
}
|
| 830 |
mhunt |
1879 |
|
|
|
1880 |
rset4.close();
|
|
|
1881 |
stmt4.close();
|
| 814 |
mhunt |
1882 |
|
| 864 |
mhunt |
1883 |
// get planned package build failure info...
|
|
|
1884 |
// global and project wide based
|
| 4123 |
dpurdie |
1885 |
mLogger.warn("queryPackageVersions: stmt50");
|
| 864 |
mhunt |
1886 |
CallableStatement stmt50 = mConnection.prepareCall(
|
| 878 |
mhunt |
1887 |
"select pl.pv_id, pv.modified_stamp " +
|
| 864 |
mhunt |
1888 |
"from release_manager.planned pl, release_manager.release_tags rt, release_manager.package_versions pv " +
|
|
|
1889 |
"where pl.rtag_id=" + baseline + " and rt.rtag_id=pl.rtag_id and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1890 |
"and pv.pv_id = pl.pv_id " +
|
| 878 |
mhunt |
1891 |
"order by pv.modified_stamp"
|
| 864 |
mhunt |
1892 |
);
|
|
|
1893 |
ResultSet rset50 = stmt50.executeQuery();
|
|
|
1894 |
|
|
|
1895 |
while( rset50.next() )
|
|
|
1896 |
{
|
|
|
1897 |
int pv_id = rset50.getInt("pv_id");
|
|
|
1898 |
|
|
|
1899 |
if ( rset50.wasNull() )
|
|
|
1900 |
{
|
|
|
1901 |
mLogger.fatal("queryPackageVersions rset50 null pv_id");
|
|
|
1902 |
// show stopper
|
| 868 |
mhunt |
1903 |
throw new Exception("queryPackageVersions rset50 null pv_id");
|
| 864 |
mhunt |
1904 |
}
|
|
|
1905 |
|
|
|
1906 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1907 |
|
|
|
1908 |
if ( p == NULL_PACKAGE )
|
|
|
1909 |
{
|
| 878 |
mhunt |
1910 |
mLogger.info("queryPackageVersions rset50 package superceded by planned " + pv_id);
|
| 864 |
mhunt |
1911 |
}
|
|
|
1912 |
else
|
|
|
1913 |
{
|
|
|
1914 |
for (Iterator<String> it = globalAndProjectWideBuildFailureEmailCollection.iterator(); it.hasNext(); )
|
|
|
1915 |
{
|
|
|
1916 |
p.addEmail(it.next());
|
|
|
1917 |
}
|
|
|
1918 |
}
|
|
|
1919 |
}
|
|
|
1920 |
|
|
|
1921 |
rset50.close();
|
|
|
1922 |
stmt50.close();
|
|
|
1923 |
|
|
|
1924 |
// view based
|
| 4123 |
dpurdie |
1925 |
mLogger.warn("queryPackageVersions: stmt5");
|
| 814 |
mhunt |
1926 |
CallableStatement stmt5 = mConnection.prepareCall(
|
| 878 |
mhunt |
1927 |
"select pl.pv_id, u.user_email, pv.modified_stamp " +
|
| 814 |
mhunt |
1928 |
"from release_manager.planned pl, release_manager.release_tags rt, release_manager.package_versions pv, release_manager.autobuild_failure af, release_manager.members_group mg, release_manager.users u " +
|
|
|
1929 |
"where pl.rtag_id=" + baseline + " and rt.rtag_id=pl.rtag_id and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1930 |
"and pv.pv_id = pl.pv_id and af.view_id=pl.view_id and mg.group_email_id=af.group_email_id and u.user_id=mg.user_id and af.proj_id=rt.proj_id " +
|
| 878 |
mhunt |
1931 |
"order by pv.modified_stamp"
|
| 814 |
mhunt |
1932 |
);
|
|
|
1933 |
ResultSet rset5 = stmt5.executeQuery();
|
|
|
1934 |
|
|
|
1935 |
while( rset5.next() )
|
|
|
1936 |
{
|
|
|
1937 |
int pv_id = rset5.getInt("pv_id");
|
|
|
1938 |
|
|
|
1939 |
if ( rset5.wasNull() )
|
|
|
1940 |
{
|
|
|
1941 |
mLogger.fatal("queryPackageVersions rset5 null pv_id");
|
|
|
1942 |
// show stopper
|
| 868 |
mhunt |
1943 |
throw new Exception("queryPackageVersions rset5 null pv_id");
|
| 814 |
mhunt |
1944 |
}
|
|
|
1945 |
|
|
|
1946 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1947 |
|
|
|
1948 |
if ( p == NULL_PACKAGE )
|
|
|
1949 |
{
|
| 878 |
mhunt |
1950 |
mLogger.info("queryPackageVersions rset5 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
1951 |
}
|
| 864 |
mhunt |
1952 |
else
|
|
|
1953 |
{
|
|
|
1954 |
String user_email = rset5.getString("user_email");
|
| 814 |
mhunt |
1955 |
|
| 864 |
mhunt |
1956 |
if ( user_email != null )
|
|
|
1957 |
{
|
|
|
1958 |
p.addEmail(user_email);
|
|
|
1959 |
}
|
|
|
1960 |
}
|
|
|
1961 |
}
|
|
|
1962 |
|
|
|
1963 |
rset5.close();
|
|
|
1964 |
stmt5.close();
|
|
|
1965 |
|
|
|
1966 |
// package version
|
| 4123 |
dpurdie |
1967 |
mLogger.warn("queryPackageVersions: stmt51");
|
| 864 |
mhunt |
1968 |
CallableStatement stmt51 = mConnection.prepareCall(
|
| 878 |
mhunt |
1969 |
"select pl.pv_id, u1.user_email, u2.user_email, u3.user_email, pv.modified_stamp " +
|
| 864 |
mhunt |
1970 |
"from release_manager.planned pl, release_manager.release_tags rt, release_manager.package_versions pv, release_manager.users u1, release_manager.users u2, release_manager.users u3 " +
|
|
|
1971 |
"where pl.rtag_id=" + baseline + " and rt.rtag_id=pl.rtag_id and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
1972 |
"and pv.pv_id = pl.pv_id and u1.user_id=pv.creator_id and u2.user_id=pv.owner_id and u3.user_id=pv.modifier_id " +
|
| 878 |
mhunt |
1973 |
"order by pv.modified_stamp"
|
| 864 |
mhunt |
1974 |
);
|
|
|
1975 |
ResultSet rset51 = stmt51.executeQuery();
|
| 814 |
mhunt |
1976 |
|
| 864 |
mhunt |
1977 |
while( rset51.next() )
|
|
|
1978 |
{
|
|
|
1979 |
int pv_id = rset51.getInt("pv_id");
|
|
|
1980 |
|
|
|
1981 |
if ( rset51.wasNull() )
|
| 814 |
mhunt |
1982 |
{
|
| 864 |
mhunt |
1983 |
mLogger.fatal("queryPackageVersions rset51 null pv_id");
|
|
|
1984 |
// show stopper
|
| 868 |
mhunt |
1985 |
throw new Exception("queryPackageVersions rset51 null pv_id");
|
| 814 |
mhunt |
1986 |
}
|
|
|
1987 |
|
| 864 |
mhunt |
1988 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
1989 |
|
|
|
1990 |
if ( p == NULL_PACKAGE )
|
| 814 |
mhunt |
1991 |
{
|
| 878 |
mhunt |
1992 |
mLogger.info("queryPackageVersions rset51 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
1993 |
}
|
| 864 |
mhunt |
1994 |
else
|
|
|
1995 |
{
|
|
|
1996 |
|
|
|
1997 |
// walk the 3 columns of user_email in the resultset
|
|
|
1998 |
// columns 2, 3 and 4, all of the same name, repectively
|
|
|
1999 |
for(int column=2; column<5; column++ )
|
|
|
2000 |
{
|
|
|
2001 |
String user_email = rset51.getString(column);
|
|
|
2002 |
|
|
|
2003 |
if ( user_email != null )
|
|
|
2004 |
{
|
|
|
2005 |
p.addEmail(user_email);
|
|
|
2006 |
}
|
|
|
2007 |
}
|
|
|
2008 |
}
|
| 814 |
mhunt |
2009 |
}
|
| 830 |
mhunt |
2010 |
|
| 864 |
mhunt |
2011 |
rset51.close();
|
|
|
2012 |
stmt51.close();
|
| 814 |
mhunt |
2013 |
|
|
|
2014 |
// get planned package advisory ripple info
|
| 4123 |
dpurdie |
2015 |
mLogger.warn("queryPackageVersions: stmt7");
|
| 814 |
mhunt |
2016 |
CallableStatement stmt7 = mConnection.prepareCall(
|
| 878 |
mhunt |
2017 |
"select pl.pv_id, pv.modified_stamp " +
|
| 814 |
mhunt |
2018 |
"from release_manager.planned pl, release_manager.package_versions pv, release_manager.advisory_ripple ar " +
|
|
|
2019 |
"where pl.rtag_id=" + baseline + " and pv.build_type='A' and pv.dlocked='A' " +
|
|
|
2020 |
"and pv.pv_id = pl.pv_id and ar.rtag_id=pl.rtag_id and ar.pv_id=pl.pv_id " +
|
| 878 |
mhunt |
2021 |
"order by pv.modified_stamp"
|
| 814 |
mhunt |
2022 |
);
|
|
|
2023 |
ResultSet rset7 = stmt7.executeQuery();
|
|
|
2024 |
|
|
|
2025 |
while( rset7.next() )
|
|
|
2026 |
{
|
|
|
2027 |
boolean ignore = false;
|
|
|
2028 |
|
|
|
2029 |
int pv_id = rset7.getInt("pv_id");
|
|
|
2030 |
|
|
|
2031 |
if ( rset7.wasNull() )
|
|
|
2032 |
{
|
|
|
2033 |
mLogger.fatal("queryPackageVersions rset7 null pv_id");
|
|
|
2034 |
// show stopper
|
| 868 |
mhunt |
2035 |
throw new Exception("queryPackageVersions rset7 null pv_id");
|
| 814 |
mhunt |
2036 |
}
|
|
|
2037 |
|
|
|
2038 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2039 |
|
|
|
2040 |
if ( p == NULL_PACKAGE )
|
|
|
2041 |
{
|
| 878 |
mhunt |
2042 |
mLogger.info("queryPackageVersions rset7 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2043 |
ignore = true;
|
|
|
2044 |
}
|
|
|
2045 |
|
|
|
2046 |
if ( !ignore )
|
|
|
2047 |
{
|
|
|
2048 |
p.mAdvisoryRipple = true;
|
|
|
2049 |
}
|
|
|
2050 |
}
|
|
|
2051 |
|
| 830 |
mhunt |
2052 |
rset7.close();
|
|
|
2053 |
stmt7.close();
|
|
|
2054 |
|
| 814 |
mhunt |
2055 |
// get released package info
|
| 4212 |
dpurdie |
2056 |
// Get package information on ALL released packages within the release of interest
|
|
|
2057 |
//
|
| 4123 |
dpurdie |
2058 |
mLogger.warn("queryPackageVersions: stmt8");
|
| 814 |
mhunt |
2059 |
CallableStatement stmt8 = mConnection.prepareCall(
|
| 924 |
dpurdie |
2060 |
"select rc.pv_id, p.pkg_id, p.pkg_name, pv.pkg_version, pv.v_ext," +
|
|
|
2061 |
"pv.ripple_field,pv.major_limit, pv.minor_limit, pv.patch_limit," +
|
|
|
2062 |
"pv.build_number_limit," +
|
|
|
2063 |
"release_manager.PK_RMAPI.return_vcs_tag(rc.pv_id) AS vcsTag" +
|
|
|
2064 |
" from release_manager.release_content rc," +
|
|
|
2065 |
"release_manager.package_versions pv, " +
|
|
|
2066 |
"release_manager.packages p " +
|
|
|
2067 |
" where rc.rtag_id=" + baseline +
|
|
|
2068 |
" and pv.pv_id = rc.pv_id" +
|
|
|
2069 |
" and p.pkg_id = pv.pkg_id" +
|
|
|
2070 |
" order by rc.pv_id"
|
| 814 |
mhunt |
2071 |
);
|
| 4123 |
dpurdie |
2072 |
mLogger.warn("queryPackageVersions: stmt8 Prepared");
|
| 814 |
mhunt |
2073 |
ResultSet rset8 = stmt8.executeQuery();
|
| 4123 |
dpurdie |
2074 |
mLogger.warn("queryPackageVersions: stmt8 Query Done");
|
| 814 |
mhunt |
2075 |
|
|
|
2076 |
while( rset8.next() )
|
|
|
2077 |
{
|
|
|
2078 |
int pv_id = rset8.getInt("pv_id");
|
|
|
2079 |
|
|
|
2080 |
if ( rset8.wasNull() )
|
|
|
2081 |
{
|
|
|
2082 |
mLogger.fatal("queryPackageVersions rset8 null pv_id");
|
|
|
2083 |
// show stopper
|
| 868 |
mhunt |
2084 |
throw new Exception("queryPackageVersions rset8 null pv_id");
|
| 814 |
mhunt |
2085 |
}
|
|
|
2086 |
|
|
|
2087 |
int pkg_id = rset8.getInt("pkg_id");
|
|
|
2088 |
|
|
|
2089 |
if ( rset8.wasNull() )
|
|
|
2090 |
{
|
|
|
2091 |
mLogger.fatal("queryPackageVersions rset8 null pkg_id " + pv_id);
|
|
|
2092 |
// show stopper
|
| 868 |
mhunt |
2093 |
throw new Exception("queryPackageVersions rset8 null pkg_id " + pv_id);
|
| 814 |
mhunt |
2094 |
}
|
|
|
2095 |
|
|
|
2096 |
String pkg_name = rset8.getString("pkg_name");
|
|
|
2097 |
|
|
|
2098 |
if ( pkg_name == null )
|
|
|
2099 |
{
|
|
|
2100 |
mLogger.fatal("queryPackageVersions rset8 null pkg_name " + pv_id);
|
|
|
2101 |
// show stopper
|
| 868 |
mhunt |
2102 |
throw new Exception("queryPackageVersions rset8 null pkg_name " + pv_id);
|
| 814 |
mhunt |
2103 |
}
|
|
|
2104 |
|
|
|
2105 |
String pkg_version = rset8.getString("pkg_version");
|
|
|
2106 |
|
|
|
2107 |
if ( pkg_version == null )
|
|
|
2108 |
{
|
|
|
2109 |
mLogger.fatal("queryPackageVersions rset8 null pkg_version " + pv_id);
|
|
|
2110 |
// show stopper
|
| 868 |
mhunt |
2111 |
throw new Exception("queryPackageVersions rset8 null pkg_version " + pv_id);
|
| 814 |
mhunt |
2112 |
}
|
|
|
2113 |
|
|
|
2114 |
String v_ext = rset8.getString("v_ext");
|
|
|
2115 |
|
|
|
2116 |
if ( v_ext == null )
|
|
|
2117 |
{
|
|
|
2118 |
v_ext = "";
|
|
|
2119 |
}
|
|
|
2120 |
|
|
|
2121 |
String ripple_field = rset8.getString("ripple_field");
|
|
|
2122 |
|
|
|
2123 |
if ( ripple_field == null )
|
|
|
2124 |
{
|
| 902 |
mhunt |
2125 |
ripple_field = "b";
|
| 814 |
mhunt |
2126 |
}
|
|
|
2127 |
else if ( ripple_field.length() == 0 )
|
|
|
2128 |
{
|
| 902 |
mhunt |
2129 |
ripple_field = "b";
|
| 814 |
mhunt |
2130 |
}
|
|
|
2131 |
|
| 874 |
mhunt |
2132 |
int major_limit = rset8.getInt("major_limit");
|
|
|
2133 |
|
|
|
2134 |
if ( rset8.wasNull() )
|
|
|
2135 |
{
|
|
|
2136 |
major_limit = 0;
|
|
|
2137 |
}
|
|
|
2138 |
|
|
|
2139 |
int minor_limit = rset8.getInt("minor_limit");
|
|
|
2140 |
|
|
|
2141 |
if ( rset8.wasNull() )
|
|
|
2142 |
{
|
|
|
2143 |
minor_limit = 0;
|
|
|
2144 |
}
|
|
|
2145 |
|
|
|
2146 |
int patch_limit = rset8.getInt("patch_limit");
|
|
|
2147 |
|
|
|
2148 |
if ( rset8.wasNull() )
|
|
|
2149 |
{
|
|
|
2150 |
patch_limit = 0;
|
|
|
2151 |
}
|
|
|
2152 |
|
|
|
2153 |
int build_number_limit = rset8.getInt("build_number_limit");
|
|
|
2154 |
|
|
|
2155 |
if ( rset8.wasNull() )
|
|
|
2156 |
{
|
|
|
2157 |
build_number_limit = 0;
|
|
|
2158 |
}
|
|
|
2159 |
|
| 924 |
dpurdie |
2160 |
String vcs_tag = rset8.getString("vcsTag");
|
|
|
2161 |
if ( vcs_tag == null )
|
|
|
2162 |
{
|
|
|
2163 |
vcs_tag = "";
|
|
|
2164 |
}
|
|
|
2165 |
|
|
|
2166 |
Package p = new Package(pv_id, pkg_name, pkg_version, v_ext, pkg_name + v_ext, vcs_tag, ripple_field.charAt(0));
|
| 874 |
mhunt |
2167 |
p.mMajorLimit = major_limit;
|
|
|
2168 |
p.mMinorLimit = minor_limit;
|
|
|
2169 |
p.mPatchLimit = patch_limit;
|
|
|
2170 |
p.mBuildLimit = build_number_limit;
|
| 814 |
mhunt |
2171 |
p.mPid = pkg_id;
|
|
|
2172 |
Integer ipv_id = new Integer(pv_id);
|
|
|
2173 |
rippleEngine.mReleasedPvIDCollection.add(ipv_id);
|
|
|
2174 |
Package plannedPackage = findPackage(p.mAlias, packageCollection);
|
|
|
2175 |
|
|
|
2176 |
if ( plannedPackage == NULL_PACKAGE )
|
|
|
2177 |
{
|
|
|
2178 |
mLogger.info("queryPackageVersions rset8 no planned package " + pv_id);
|
|
|
2179 |
packageCollection.add(p);
|
|
|
2180 |
}
|
|
|
2181 |
else
|
|
|
2182 |
{
|
|
|
2183 |
int endindex = pkg_version.length() - v_ext.length();
|
|
|
2184 |
|
|
|
2185 |
if ( endindex > 0 )
|
|
|
2186 |
{
|
|
|
2187 |
pkg_version = pkg_version.substring(0, endindex);
|
|
|
2188 |
}
|
|
|
2189 |
|
|
|
2190 |
plannedPackage.mVersion = pkg_version;
|
|
|
2191 |
}
|
|
|
2192 |
}
|
| 830 |
mhunt |
2193 |
|
| 4123 |
dpurdie |
2194 |
mLogger.warn("queryPackageVersions: stmt8 processing complete");
|
| 830 |
mhunt |
2195 |
rset8.close();
|
|
|
2196 |
stmt8.close();
|
| 814 |
mhunt |
2197 |
|
|
|
2198 |
// get released package dependency info
|
| 884 |
mhunt |
2199 |
// the not exists subquery was added to ignore dependencies for 'pegged' package versions in a release - DEVI 48876
|
|
|
2200 |
// this is the ONLY support for dealing with an inconsistent set of package versions
|
| 4123 |
dpurdie |
2201 |
mLogger.warn("queryPackageVersions: stmt9");
|
| 814 |
mhunt |
2202 |
CallableStatement stmt9 = mConnection.prepareCall(
|
|
|
2203 |
"select rc.pv_id, dpv.pv_id, p.pkg_name, dpv.v_ext " +
|
|
|
2204 |
"from release_manager.release_content rc, release_manager.package_versions pv, release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p " +
|
|
|
2205 |
"where rc.rtag_id=" + baseline +
|
|
|
2206 |
" and pv.pv_id = rc.pv_id and pd.pv_id=pv.pv_id and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id " +
|
| 884 |
mhunt |
2207 |
" and not exists (select pv_id from pegged_versions where pv_id=pv.pv_id and rtag_id=rc.rtag_id) " +
|
| 814 |
mhunt |
2208 |
"order by rc.pv_id"
|
|
|
2209 |
);
|
| 4123 |
dpurdie |
2210 |
mLogger.warn("queryPackageVersions: stmt9 prepared");
|
| 814 |
mhunt |
2211 |
ResultSet rset9 = stmt9.executeQuery();
|
| 4123 |
dpurdie |
2212 |
mLogger.warn("queryPackageVersions: stmt9 query done");
|
| 814 |
mhunt |
2213 |
|
|
|
2214 |
while( rset9.next() )
|
|
|
2215 |
{
|
|
|
2216 |
boolean ignore = false;
|
|
|
2217 |
|
|
|
2218 |
int pv_id = rset9.getInt(1);
|
|
|
2219 |
|
|
|
2220 |
if ( rset9.wasNull() )
|
|
|
2221 |
{
|
|
|
2222 |
mLogger.fatal("queryPackageVersions rset9 null pv_id");
|
|
|
2223 |
// show stopper
|
| 868 |
mhunt |
2224 |
throw new Exception("queryPackageVersions rset9 null pv_id");
|
| 814 |
mhunt |
2225 |
}
|
|
|
2226 |
|
|
|
2227 |
int dpv_id = rset9.getInt(2);
|
|
|
2228 |
|
|
|
2229 |
if ( rset9.wasNull() )
|
|
|
2230 |
{
|
|
|
2231 |
mLogger.fatal("queryPackageVersions rset9 null dpv_id " + pv_id);
|
|
|
2232 |
// show stopper
|
| 868 |
mhunt |
2233 |
throw new Exception("queryPackageVersions rset9 null dpv_id " + pv_id);
|
| 814 |
mhunt |
2234 |
}
|
|
|
2235 |
|
|
|
2236 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2237 |
|
|
|
2238 |
if ( p == NULL_PACKAGE )
|
|
|
2239 |
{
|
| 878 |
mhunt |
2240 |
mLogger.info("queryPackageVersions rset9 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2241 |
ignore = true;
|
|
|
2242 |
}
|
|
|
2243 |
|
|
|
2244 |
String pkg_name = rset9.getString("pkg_name");
|
|
|
2245 |
|
|
|
2246 |
if ( pkg_name == null )
|
|
|
2247 |
{
|
|
|
2248 |
mLogger.fatal("queryPackageVersions rset9 null pkg_name " + pv_id);
|
|
|
2249 |
// show stopper
|
| 868 |
mhunt |
2250 |
throw new Exception("queryPackageVersions rset9 null pkg_name " + pv_id);
|
| 814 |
mhunt |
2251 |
}
|
|
|
2252 |
|
|
|
2253 |
String v_ext = rset9.getString("v_ext");
|
|
|
2254 |
|
|
|
2255 |
if ( v_ext == null )
|
|
|
2256 |
{
|
|
|
2257 |
v_ext = "";
|
|
|
2258 |
}
|
|
|
2259 |
|
|
|
2260 |
if ( !ignore )
|
|
|
2261 |
{
|
|
|
2262 |
p.mDependencyCollection.add(pkg_name + v_ext);
|
|
|
2263 |
p.mDependencyIDCollection.add(dpv_id);
|
|
|
2264 |
}
|
|
|
2265 |
}
|
| 4123 |
dpurdie |
2266 |
mLogger.warn("queryPackageVersions: stmt9 processing complete");
|
|
|
2267 |
|
| 830 |
mhunt |
2268 |
rset9.close();
|
|
|
2269 |
stmt9.close();
|
| 814 |
mhunt |
2270 |
|
|
|
2271 |
// get released package build info
|
| 4123 |
dpurdie |
2272 |
mLogger.warn("queryPackageVersions: stmt10");
|
| 814 |
mhunt |
2273 |
CallableStatement stmt10 = mConnection.prepareCall(
|
|
|
2274 |
"select rc.pv_id, bm.bm_name, bsa.bsa_name " +
|
|
|
2275 |
"from release_manager.release_content rc, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa " +
|
|
|
2276 |
"where rc.rtag_id=" + baseline +
|
|
|
2277 |
" and pv.pv_id = rc.pv_id and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id " +
|
|
|
2278 |
"order by rc.pv_id"
|
|
|
2279 |
);
|
|
|
2280 |
ResultSet rset10 = stmt10.executeQuery();
|
|
|
2281 |
|
|
|
2282 |
while( rset10.next() )
|
|
|
2283 |
{
|
|
|
2284 |
boolean ignore = false;
|
|
|
2285 |
int pv_id = rset10.getInt("pv_id");
|
|
|
2286 |
|
|
|
2287 |
if ( rset10.wasNull() )
|
|
|
2288 |
{
|
|
|
2289 |
mLogger.fatal("queryPackageVersions rset10 null pv_id");
|
|
|
2290 |
// show stopper
|
| 868 |
mhunt |
2291 |
throw new Exception("queryPackageVersions rset10 null pv_id");
|
| 814 |
mhunt |
2292 |
}
|
|
|
2293 |
|
|
|
2294 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2295 |
|
|
|
2296 |
if ( p == NULL_PACKAGE )
|
|
|
2297 |
{
|
| 878 |
mhunt |
2298 |
mLogger.info("queryPackageVersions rset10 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2299 |
ignore = true;
|
|
|
2300 |
}
|
|
|
2301 |
|
|
|
2302 |
String bm_name = rset10.getString("bm_name");
|
|
|
2303 |
|
|
|
2304 |
if ( bm_name == null )
|
|
|
2305 |
{
|
|
|
2306 |
mLogger.fatal("queryPackageVersions rset10 null bm_name " + pv_id);
|
|
|
2307 |
// show stopper
|
| 868 |
mhunt |
2308 |
throw new Exception("queryPackageVersions rset10 null bm_name " + pv_id);
|
| 814 |
mhunt |
2309 |
}
|
|
|
2310 |
|
|
|
2311 |
String bsa_name = rset10.getString("bsa_name");
|
|
|
2312 |
|
|
|
2313 |
if ( bsa_name == null )
|
|
|
2314 |
{
|
|
|
2315 |
mLogger.fatal("queryPackageVersions rset10 null bsa_name " + pv_id);
|
|
|
2316 |
// show stopper
|
| 868 |
mhunt |
2317 |
throw new Exception("queryPackageVersions rset10 null bsa_name " + pv_id);
|
| 814 |
mhunt |
2318 |
}
|
|
|
2319 |
|
|
|
2320 |
if ( !ignore )
|
|
|
2321 |
{
|
| 908 |
mhunt |
2322 |
BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
|
| 814 |
mhunt |
2323 |
|
| 908 |
mhunt |
2324 |
if ( bs.supportedBuildStandard() )
|
| 814 |
mhunt |
2325 |
{
|
|
|
2326 |
p.mBuildStandardCollection.add(bs);
|
|
|
2327 |
}
|
|
|
2328 |
}
|
|
|
2329 |
}
|
| 830 |
mhunt |
2330 |
|
|
|
2331 |
rset10.close();
|
|
|
2332 |
stmt10.close();
|
| 814 |
mhunt |
2333 |
|
|
|
2334 |
// get released package unit test info
|
| 4123 |
dpurdie |
2335 |
mLogger.warn("queryPackageVersions: stmt11");
|
| 814 |
mhunt |
2336 |
CallableStatement stmt11 = mConnection.prepareCall(
|
|
|
2337 |
"select rc.pv_id, tt.test_type_name " +
|
|
|
2338 |
"from release_manager.release_content rc, release_manager.package_versions pv, release_manager.unit_tests ut, release_manager.test_types tt " +
|
|
|
2339 |
"where rc.rtag_id=" + baseline +
|
|
|
2340 |
" and pv.pv_id = rc.pv_id and ut.pv_id=pv.pv_id and tt.test_type_id=ut.test_types_fk " +
|
|
|
2341 |
"order by rc.pv_id"
|
|
|
2342 |
);
|
|
|
2343 |
ResultSet rset11 = stmt11.executeQuery();
|
|
|
2344 |
|
|
|
2345 |
while( rset11.next() )
|
|
|
2346 |
{
|
|
|
2347 |
boolean ignore = false;
|
|
|
2348 |
|
|
|
2349 |
int pv_id = rset11.getInt("pv_id");
|
|
|
2350 |
|
|
|
2351 |
if ( rset11.wasNull() )
|
|
|
2352 |
{
|
|
|
2353 |
mLogger.fatal("queryPackageVersions rset11 null pv_id");
|
|
|
2354 |
// show stopper
|
| 868 |
mhunt |
2355 |
throw new Exception("queryPackageVersions rset11 null pv_id");
|
| 814 |
mhunt |
2356 |
}
|
|
|
2357 |
|
|
|
2358 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2359 |
|
|
|
2360 |
if ( p == NULL_PACKAGE )
|
|
|
2361 |
{
|
| 878 |
mhunt |
2362 |
mLogger.info("queryPackageVersions rset11 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2363 |
ignore = true;
|
|
|
2364 |
}
|
|
|
2365 |
|
|
|
2366 |
String test_type_name = rset11.getString("test_type_name");
|
|
|
2367 |
|
|
|
2368 |
if ( test_type_name == null )
|
|
|
2369 |
{
|
|
|
2370 |
mLogger.fatal("queryPackageVersions rset11 null test_type_name " + pv_id);
|
|
|
2371 |
// show stopper
|
| 868 |
mhunt |
2372 |
throw new Exception("queryPackageVersions rset11 null test_type_name " + pv_id);
|
| 814 |
mhunt |
2373 |
}
|
|
|
2374 |
|
|
|
2375 |
if ( !ignore )
|
|
|
2376 |
{
|
|
|
2377 |
if ( test_type_name.compareTo("Autobuild UTF") == 0 )
|
|
|
2378 |
{
|
|
|
2379 |
p.mHasAutomatedUnitTests = true;
|
|
|
2380 |
}
|
|
|
2381 |
}
|
|
|
2382 |
}
|
| 830 |
mhunt |
2383 |
|
|
|
2384 |
rset11.close();
|
|
|
2385 |
stmt11.close();
|
| 814 |
mhunt |
2386 |
|
| 864 |
mhunt |
2387 |
// get released package build failure info...
|
|
|
2388 |
// global and project wide based
|
| 4123 |
dpurdie |
2389 |
mLogger.warn("queryPackageVersions: stmt120");
|
| 864 |
mhunt |
2390 |
CallableStatement stmt120 = mConnection.prepareCall(
|
|
|
2391 |
"select rc.pv_id " +
|
|
|
2392 |
"from release_manager.release_content rc, release_manager.release_tags rt, release_manager.package_versions pv " +
|
|
|
2393 |
"where rc.rtag_id=" + baseline + " and rt.rtag_id=rc.rtag_id " +
|
|
|
2394 |
"and pv.pv_id = rc.pv_id " +
|
|
|
2395 |
"order by rc.pv_id"
|
|
|
2396 |
);
|
|
|
2397 |
ResultSet rset120 = stmt120.executeQuery();
|
|
|
2398 |
|
|
|
2399 |
while( rset120.next() )
|
|
|
2400 |
{
|
|
|
2401 |
int pv_id = rset120.getInt("pv_id");
|
|
|
2402 |
|
|
|
2403 |
if ( rset120.wasNull() )
|
|
|
2404 |
{
|
|
|
2405 |
mLogger.fatal("queryPackageVersions rset120 null pv_id");
|
|
|
2406 |
// show stopper
|
| 868 |
mhunt |
2407 |
throw new Exception("queryPackageVersions rset120 null pv_id");
|
| 864 |
mhunt |
2408 |
}
|
|
|
2409 |
|
|
|
2410 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2411 |
|
|
|
2412 |
if ( p == NULL_PACKAGE )
|
|
|
2413 |
{
|
| 878 |
mhunt |
2414 |
mLogger.info("queryPackageVersions rset120 package superceded by planned " + pv_id);
|
| 864 |
mhunt |
2415 |
}
|
|
|
2416 |
else
|
|
|
2417 |
{
|
|
|
2418 |
for (Iterator<String> it = globalAndProjectWideBuildFailureEmailCollection.iterator(); it.hasNext(); )
|
|
|
2419 |
{
|
|
|
2420 |
p.addEmail(it.next());
|
|
|
2421 |
}
|
|
|
2422 |
}
|
|
|
2423 |
}
|
|
|
2424 |
|
|
|
2425 |
rset120.close();
|
|
|
2426 |
stmt120.close();
|
|
|
2427 |
|
|
|
2428 |
// view based
|
| 4123 |
dpurdie |
2429 |
mLogger.warn("queryPackageVersions: stmt12");
|
| 814 |
mhunt |
2430 |
CallableStatement stmt12 = mConnection.prepareCall(
|
|
|
2431 |
"select rc.pv_id, u.user_email " +
|
|
|
2432 |
"from release_manager.release_content rc, release_manager.release_tags rt, release_manager.package_versions pv, release_manager.autobuild_failure af, release_manager.members_group mg, release_manager.users u " +
|
|
|
2433 |
"where rc.rtag_id=" + baseline + " and rt.rtag_id=rc.rtag_id " +
|
|
|
2434 |
"and pv.pv_id = rc.pv_id and af.view_id=rc.base_view_id and mg.group_email_id=af.group_email_id and u.user_id=mg.user_id and af.proj_id=rt.proj_id " +
|
|
|
2435 |
"order by rc.pv_id"
|
|
|
2436 |
);
|
|
|
2437 |
ResultSet rset12 = stmt12.executeQuery();
|
|
|
2438 |
|
|
|
2439 |
while( rset12.next() )
|
|
|
2440 |
{
|
|
|
2441 |
int pv_id = rset12.getInt("pv_id");
|
|
|
2442 |
|
|
|
2443 |
if ( rset12.wasNull() )
|
|
|
2444 |
{
|
|
|
2445 |
mLogger.fatal("queryPackageVersions rset12 null pv_id");
|
|
|
2446 |
// show stopper
|
| 868 |
mhunt |
2447 |
throw new Exception("queryPackageVersions rset12 null pv_id");
|
| 814 |
mhunt |
2448 |
}
|
|
|
2449 |
|
|
|
2450 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2451 |
|
|
|
2452 |
if ( p == NULL_PACKAGE )
|
|
|
2453 |
{
|
| 878 |
mhunt |
2454 |
mLogger.info("queryPackageVersions rset12 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2455 |
}
|
| 864 |
mhunt |
2456 |
else
|
| 814 |
mhunt |
2457 |
{
|
| 864 |
mhunt |
2458 |
String user_email = rset12.getString("user_email");
|
| 814 |
mhunt |
2459 |
|
| 864 |
mhunt |
2460 |
if ( user_email != null )
|
|
|
2461 |
{
|
|
|
2462 |
p.addEmail(user_email);
|
|
|
2463 |
}
|
| 814 |
mhunt |
2464 |
}
|
|
|
2465 |
}
|
| 830 |
mhunt |
2466 |
|
|
|
2467 |
rset12.close();
|
|
|
2468 |
stmt12.close();
|
| 814 |
mhunt |
2469 |
|
|
|
2470 |
// get released advisory ripple info
|
| 4123 |
dpurdie |
2471 |
mLogger.warn("queryPackageVersions: stmt14");
|
| 814 |
mhunt |
2472 |
CallableStatement stmt14 = mConnection.prepareCall(
|
|
|
2473 |
"select rc.pv_id " +
|
|
|
2474 |
"from release_manager.release_content rc, release_manager.package_versions pv, release_manager.advisory_ripple ar " +
|
|
|
2475 |
"where rc.rtag_id=" + baseline +
|
|
|
2476 |
" and pv.pv_id = rc.pv_id and ar.rtag_id=rc.rtag_id and ar.pv_id=rc.pv_id " +
|
|
|
2477 |
"order by rc.pv_id"
|
|
|
2478 |
);
|
|
|
2479 |
ResultSet rset14 = stmt14.executeQuery();
|
|
|
2480 |
|
|
|
2481 |
while( rset14.next() )
|
|
|
2482 |
{
|
|
|
2483 |
boolean ignore = false;
|
|
|
2484 |
|
|
|
2485 |
int pv_id = rset14.getInt("pv_id");
|
|
|
2486 |
|
|
|
2487 |
if ( rset14.wasNull() )
|
|
|
2488 |
{
|
|
|
2489 |
mLogger.fatal("queryPackageVersions rset14 null pv_id");
|
|
|
2490 |
// show stopper
|
| 868 |
mhunt |
2491 |
throw new Exception("queryPackageVersions rset14 null pv_id");
|
| 814 |
mhunt |
2492 |
}
|
|
|
2493 |
|
|
|
2494 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2495 |
|
|
|
2496 |
if ( p == NULL_PACKAGE )
|
|
|
2497 |
{
|
| 878 |
mhunt |
2498 |
mLogger.info("queryPackageVersions rset14 package superceded by planned " + pv_id);
|
| 814 |
mhunt |
2499 |
ignore = true;
|
|
|
2500 |
}
|
|
|
2501 |
|
|
|
2502 |
if ( !ignore )
|
|
|
2503 |
{
|
|
|
2504 |
p.mAdvisoryRipple = true;
|
|
|
2505 |
}
|
|
|
2506 |
}
|
| 830 |
mhunt |
2507 |
|
|
|
2508 |
rset14.close();
|
|
|
2509 |
stmt14.close();
|
| 908 |
mhunt |
2510 |
|
|
|
2511 |
// force ripple info
|
|
|
2512 |
// an op code of 0 means force ripple
|
|
|
2513 |
MutableInt instruction = new MutableInt();
|
|
|
2514 |
instruction.value = 0;
|
|
|
2515 |
MutableInt pvid = new MutableInt();
|
|
|
2516 |
MutableInt userid = new MutableInt();
|
|
|
2517 |
|
|
|
2518 |
while ( getDaemonInst( baseline, instruction, 0, pvid, userid ) )
|
|
|
2519 |
{
|
|
|
2520 |
Package p = findPackage(pvid.value, packageCollection);
|
|
|
2521 |
|
|
|
2522 |
if ( p != NULL_PACKAGE )
|
|
|
2523 |
{
|
|
|
2524 |
mLogger.info("queryPackageVersions forced ripple data " + pvid.value);
|
|
|
2525 |
p.mForcedRippleInstruction = instruction.value;
|
|
|
2526 |
}
|
|
|
2527 |
else
|
|
|
2528 |
{
|
|
|
2529 |
// discard
|
|
|
2530 |
markDaemonInstCompleted( instruction.value );
|
|
|
2531 |
}
|
|
|
2532 |
}
|
|
|
2533 |
|
|
|
2534 |
// test build info
|
|
|
2535 |
// bare minimal data collection - last thing needed is more data to collect
|
|
|
2536 |
// the approach...
|
|
|
2537 |
// query all test build instructions for this baseline
|
|
|
2538 |
// for each, query its build information
|
|
|
2539 |
// store them in "mTestBuild" Package attributes as follows:
|
|
|
2540 |
// - mTestBuildInstruction (default 0)
|
|
|
2541 |
// - mTestBuildEmail (default "null")
|
| 924 |
dpurdie |
2542 |
// - mTestBuildVcsTag (default "null")
|
| 908 |
mhunt |
2543 |
// - mTestBuildStandardCollection
|
|
|
2544 |
// - mTestBuildDependencyCollection
|
|
|
2545 |
// additionally, trust nothing - these are wips that at any time may have:
|
|
|
2546 |
// - no build location
|
|
|
2547 |
// - no build label
|
|
|
2548 |
// - an empty build standard collection
|
|
|
2549 |
// proceed with defaults above if necessary (the build will subsequently fail)
|
|
|
2550 |
// in all cases, build a meaningful email body to inform the user
|
|
|
2551 |
// of the snapshot of build information that applied to the build and store in:
|
|
|
2552 |
// - mTestBuildEmailBody
|
|
|
2553 |
|
|
|
2554 |
// an op code of 1 means test build
|
| 4123 |
dpurdie |
2555 |
mLogger.warn("queryPackageVersions: stmt141");
|
| 908 |
mhunt |
2556 |
instruction.value = 0;
|
|
|
2557 |
while ( getDaemonInst( baseline, instruction, 1, pvid, userid ) )
|
|
|
2558 |
{
|
|
|
2559 |
// can only do one test build at a time - others will be discarded until future cycle
|
|
|
2560 |
boolean discard = false;
|
|
|
2561 |
mLogger.info("queryPackageVersions test build data " + pvid.value);
|
|
|
2562 |
int testBuildPvId = pvid.value;
|
|
|
2563 |
int testBuildInstruction = instruction.value;
|
|
|
2564 |
String testBuildEmail = "";
|
|
|
2565 |
CallableStatement stmt141 = mConnection.prepareCall(
|
|
|
2566 |
"select user_email from release_manager.users where user_id=" + userid.value);
|
|
|
2567 |
ResultSet rset141 = stmt141.executeQuery();
|
|
|
2568 |
|
|
|
2569 |
while( rset141.next() )
|
|
|
2570 |
{
|
|
|
2571 |
testBuildEmail = rset141.getString("user_email");
|
|
|
2572 |
|
|
|
2573 |
if ( testBuildEmail == null )
|
|
|
2574 |
{
|
|
|
2575 |
// no one to inform - discard
|
|
|
2576 |
discard = true;
|
|
|
2577 |
}
|
|
|
2578 |
}
|
|
|
2579 |
|
|
|
2580 |
rset141.close();
|
|
|
2581 |
stmt141.close();
|
|
|
2582 |
|
|
|
2583 |
if ( discard )
|
|
|
2584 |
{
|
|
|
2585 |
mLogger.error("queryPackageVersions rset141 null user_email " + userid.value);
|
|
|
2586 |
markDaemonInstCompleted( instruction.value );
|
|
|
2587 |
}
|
|
|
2588 |
else
|
|
|
2589 |
{
|
|
|
2590 |
String pkg_name = "";
|
|
|
2591 |
String pkg_ext = "";
|
| 924 |
dpurdie |
2592 |
String testBuildVcsTag = "null";
|
|
|
2593 |
|
| 908 |
mhunt |
2594 |
// get wip package info
|
| 4123 |
dpurdie |
2595 |
mLogger.warn("queryPackageVersions: stmt15");
|
| 908 |
mhunt |
2596 |
CallableStatement stmt15 = mConnection.prepareCall(
|
| 924 |
dpurdie |
2597 |
"select p.pkg_name, pv.v_ext, release_manager.PK_RMAPI.return_vcs_tag(pv.pv_id) AS vcsTag " +
|
|
|
2598 |
" from release_manager.work_in_progress wip," +
|
|
|
2599 |
"release_manager.package_versions pv," +
|
|
|
2600 |
"release_manager.packages p" +
|
|
|
2601 |
" where wip.rtag_id=" + baseline +
|
|
|
2602 |
" and pv.pv_id=" + testBuildPvId +
|
|
|
2603 |
" and wip.pv_id=" + testBuildPvId +
|
|
|
2604 |
" and p.pkg_id=pv.pkg_id "
|
| 908 |
mhunt |
2605 |
);
|
|
|
2606 |
ResultSet rset15 = stmt15.executeQuery();
|
|
|
2607 |
|
|
|
2608 |
int rsetSize = 0;
|
|
|
2609 |
|
|
|
2610 |
while( rset15.next() )
|
|
|
2611 |
{
|
|
|
2612 |
rsetSize++;
|
|
|
2613 |
pkg_name = rset15.getString("pkg_name");
|
|
|
2614 |
|
|
|
2615 |
if ( pkg_name == null )
|
|
|
2616 |
{
|
|
|
2617 |
mLogger.fatal("queryPackageVersions rset15 null pkg_name " + testBuildPvId);
|
|
|
2618 |
// show stopper
|
|
|
2619 |
throw new Exception("queryPackageVersions rset15 null pkg_name " + testBuildPvId);
|
|
|
2620 |
}
|
|
|
2621 |
|
|
|
2622 |
pkg_ext = rset15.getString("v_ext");
|
|
|
2623 |
|
|
|
2624 |
if ( pkg_ext == null )
|
|
|
2625 |
{
|
|
|
2626 |
pkg_ext = "";
|
|
|
2627 |
}
|
| 924 |
dpurdie |
2628 |
|
|
|
2629 |
testBuildVcsTag = rset15.getString("vcsTag");
|
|
|
2630 |
if ( testBuildVcsTag == null )
|
| 908 |
mhunt |
2631 |
{
|
| 924 |
dpurdie |
2632 |
testBuildVcsTag = "null";
|
| 908 |
mhunt |
2633 |
}
|
|
|
2634 |
}
|
|
|
2635 |
|
|
|
2636 |
rset15.close();
|
|
|
2637 |
stmt15.close();
|
| 924 |
dpurdie |
2638 |
|
| 4123 |
dpurdie |
2639 |
mLogger.warn("queryPackageVersions: stmt16");
|
| 908 |
mhunt |
2640 |
if ( rsetSize == 0 )
|
|
|
2641 |
{
|
|
|
2642 |
mLogger.error("queryPackageVersions rset15 no wip found " + instruction.value);
|
|
|
2643 |
markDaemonInstCompleted( instruction.value );
|
|
|
2644 |
}
|
|
|
2645 |
else
|
|
|
2646 |
{
|
|
|
2647 |
Package q = findPackage(pkg_name + pkg_ext, packageCollection);
|
|
|
2648 |
|
|
|
2649 |
if ( q == NULL_PACKAGE )
|
|
|
2650 |
{
|
|
|
2651 |
// wip package alias does not exist in this release (planned or released packages)
|
| 924 |
dpurdie |
2652 |
q = new Package( pkg_name, pkg_ext, pkg_name + pkg_ext, testBuildVcsTag, testBuildInstruction, testBuildEmail);
|
| 908 |
mhunt |
2653 |
packageCollection.add(q);
|
|
|
2654 |
}
|
|
|
2655 |
else
|
|
|
2656 |
{
|
|
|
2657 |
// avoid interaction with real versions
|
|
|
2658 |
q.mVersion = "0.0.0000";
|
| 924 |
dpurdie |
2659 |
q.mTestBuildVcsTag = testBuildVcsTag;
|
| 908 |
mhunt |
2660 |
q.mTestBuildInstruction = testBuildInstruction;
|
|
|
2661 |
q.mTestBuildEmail = testBuildEmail;
|
|
|
2662 |
}
|
|
|
2663 |
|
|
|
2664 |
// get wip package dependency info
|
|
|
2665 |
CallableStatement stmt16 = mConnection.prepareCall(
|
|
|
2666 |
"select p.pkg_name, dpv.v_ext " +
|
|
|
2667 |
"from release_manager.work_in_progress wip, release_manager.package_versions pv, " +
|
|
|
2668 |
"release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p " +
|
|
|
2669 |
"where wip.rtag_id=" + baseline +
|
|
|
2670 |
" and pv.pv_id=" + testBuildPvId +
|
|
|
2671 |
" and wip.pv_id=" + testBuildPvId +
|
|
|
2672 |
" and pd.pv_id=" + testBuildPvId +
|
|
|
2673 |
" and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id "
|
|
|
2674 |
);
|
|
|
2675 |
ResultSet rset16 = stmt16.executeQuery();
|
|
|
2676 |
|
|
|
2677 |
while( rset16.next() )
|
|
|
2678 |
{
|
|
|
2679 |
String dpkg_name = rset16.getString("pkg_name");
|
|
|
2680 |
|
|
|
2681 |
if ( dpkg_name == null )
|
|
|
2682 |
{
|
|
|
2683 |
mLogger.fatal("queryPackageVersions rset16 null pkg_name " + testBuildPvId);
|
|
|
2684 |
// show stopper
|
|
|
2685 |
throw new Exception("queryPackageVersions rset16 null pkg_name " + testBuildPvId);
|
|
|
2686 |
}
|
|
|
2687 |
|
|
|
2688 |
String v_ext = rset16.getString("v_ext");
|
|
|
2689 |
|
|
|
2690 |
if ( v_ext == null )
|
|
|
2691 |
{
|
|
|
2692 |
v_ext = "";
|
|
|
2693 |
}
|
|
|
2694 |
|
|
|
2695 |
q.mTestBuildDependencyCollection.add(dpkg_name + v_ext);
|
|
|
2696 |
}
|
|
|
2697 |
|
|
|
2698 |
rset16.close();
|
|
|
2699 |
stmt16.close();
|
|
|
2700 |
|
|
|
2701 |
// get planned package build info
|
| 4123 |
dpurdie |
2702 |
mLogger.warn("queryPackageVersions: stmt17");
|
| 908 |
mhunt |
2703 |
CallableStatement stmt17 = mConnection.prepareCall(
|
|
|
2704 |
"select bm.bm_name, bsa.bsa_name " +
|
|
|
2705 |
"from release_manager.work_in_progress wip, release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa " +
|
|
|
2706 |
"where wip.rtag_id=" + baseline +
|
|
|
2707 |
" and wip.pv_id=" + testBuildPvId +
|
|
|
2708 |
" and pv.pv_id=" + testBuildPvId +
|
|
|
2709 |
" and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id "
|
|
|
2710 |
);
|
|
|
2711 |
ResultSet rset17 = stmt17.executeQuery();
|
|
|
2712 |
|
|
|
2713 |
while( rset17.next() )
|
|
|
2714 |
{
|
|
|
2715 |
String bm_name = rset17.getString("bm_name");
|
|
|
2716 |
|
|
|
2717 |
if ( bm_name == null )
|
|
|
2718 |
{
|
|
|
2719 |
mLogger.fatal("queryPackageVersions rset17 null bm_name " + testBuildPvId);
|
|
|
2720 |
// show stopper
|
|
|
2721 |
throw new Exception("queryPackageVersions rset17 null bm_name " + testBuildPvId);
|
|
|
2722 |
}
|
|
|
2723 |
|
|
|
2724 |
String bsa_name = rset17.getString("bsa_name");
|
|
|
2725 |
|
|
|
2726 |
if ( bsa_name == null )
|
|
|
2727 |
{
|
|
|
2728 |
mLogger.fatal("queryPackageVersions rset17 null bsa_name " + testBuildPvId);
|
|
|
2729 |
// show stopper
|
|
|
2730 |
throw new Exception("queryPackageVersions rset17 null bsa_name " + testBuildPvId);
|
|
|
2731 |
}
|
|
|
2732 |
|
|
|
2733 |
BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
|
|
|
2734 |
|
|
|
2735 |
if ( bs.supportedBuildStandard() )
|
|
|
2736 |
{
|
|
|
2737 |
q.mTestBuildStandardCollection.add(bs);
|
|
|
2738 |
}
|
|
|
2739 |
}
|
|
|
2740 |
|
|
|
2741 |
rset17.close();
|
|
|
2742 |
stmt17.close();
|
|
|
2743 |
}
|
|
|
2744 |
}
|
|
|
2745 |
}
|
| 814 |
mhunt |
2746 |
}
|
|
|
2747 |
else
|
|
|
2748 |
{
|
|
|
2749 |
// get released product info
|
| 4123 |
dpurdie |
2750 |
mLogger.warn("queryPackageVersions: stmt18");
|
| 814 |
mhunt |
2751 |
CallableStatement stmt = mConnection.prepareCall(
|
| 924 |
dpurdie |
2752 |
"select oc.prod_id, p.pkg_name, pv.pkg_version, pv.v_ext," +
|
|
|
2753 |
"release_manager.PK_RMAPI.return_vcs_tag(pv.pv_id) AS vcsTag" +
|
|
|
2754 |
" from deployment_manager.bom_contents bc," +
|
|
|
2755 |
"deployment_manager.operating_systems os," +
|
|
|
2756 |
"deployment_manager.os_contents oc," +
|
|
|
2757 |
"release_manager.package_versions pv," +
|
|
|
2758 |
"release_manager.packages p" +
|
|
|
2759 |
" where bc.bom_id=" + baseline +
|
|
|
2760 |
" and os.node_id=bc.node_id" +
|
|
|
2761 |
" and oc.os_id=os.os_id" +
|
|
|
2762 |
" and pv.pv_id=oc.prod_id" +
|
|
|
2763 |
" and p.pkg_id=pv.pkg_id" +
|
|
|
2764 |
" order by oc.prod_id"
|
| 814 |
mhunt |
2765 |
);
|
|
|
2766 |
ResultSet rset = stmt.executeQuery();
|
|
|
2767 |
|
|
|
2768 |
while( rset.next() )
|
|
|
2769 |
{
|
|
|
2770 |
int pv_id = rset.getInt("prod_id");
|
|
|
2771 |
|
|
|
2772 |
if ( rset.wasNull() )
|
|
|
2773 |
{
|
|
|
2774 |
mLogger.fatal("queryPackageVersions rset null prod_id");
|
|
|
2775 |
// show stopper
|
| 868 |
mhunt |
2776 |
throw new Exception("queryPackageVersions rset null prod_id");
|
| 814 |
mhunt |
2777 |
}
|
|
|
2778 |
|
|
|
2779 |
String pkg_name = rset.getString("pkg_name");
|
|
|
2780 |
|
|
|
2781 |
if ( pkg_name == null )
|
|
|
2782 |
{
|
|
|
2783 |
mLogger.fatal("queryPackageVersions rset null pkg_name " + pv_id);
|
|
|
2784 |
// show stopper
|
| 868 |
mhunt |
2785 |
throw new Exception("queryPackageVersions rset null pkg_name " + pv_id);
|
| 814 |
mhunt |
2786 |
}
|
|
|
2787 |
|
|
|
2788 |
String pkg_version = rset.getString("pkg_version");
|
|
|
2789 |
|
|
|
2790 |
if ( pkg_version == null )
|
|
|
2791 |
{
|
|
|
2792 |
mLogger.fatal("queryPackageVersions rset null pkg_version " + pv_id);
|
|
|
2793 |
// show stopper
|
| 868 |
mhunt |
2794 |
throw new Exception("queryPackageVersions rset null pkg_version " + pv_id);
|
| 814 |
mhunt |
2795 |
}
|
|
|
2796 |
|
|
|
2797 |
String v_ext = rset.getString("v_ext");
|
|
|
2798 |
|
|
|
2799 |
if ( v_ext == null )
|
|
|
2800 |
{
|
|
|
2801 |
v_ext = "";
|
|
|
2802 |
}
|
| 924 |
dpurdie |
2803 |
|
|
|
2804 |
String vcs_tag = rset.getString("vcsTag");
|
|
|
2805 |
if ( vcs_tag == null )
|
| 814 |
mhunt |
2806 |
{
|
| 924 |
dpurdie |
2807 |
vcs_tag = "";
|
| 814 |
mhunt |
2808 |
}
|
|
|
2809 |
|
| 834 |
mhunt |
2810 |
Package p = findPackage(pv_id, packageCollection);
|
|
|
2811 |
|
|
|
2812 |
if ( p == NULL_PACKAGE )
|
|
|
2813 |
{
|
| 924 |
dpurdie |
2814 |
Package q = new Package(pv_id, pkg_name, pkg_version, v_ext, pkg_name + "." + pkg_version, vcs_tag, 'x');
|
| 834 |
mhunt |
2815 |
packageCollection.add(q);
|
|
|
2816 |
}
|
| 814 |
mhunt |
2817 |
}
|
| 830 |
mhunt |
2818 |
|
|
|
2819 |
rset.close();
|
|
|
2820 |
stmt.close();
|
| 814 |
mhunt |
2821 |
}
|
|
|
2822 |
}
|
|
|
2823 |
catch ( SQLException e )
|
|
|
2824 |
{
|
|
|
2825 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
2826 |
{
|
|
|
2827 |
mLogger.error("queryPackageVersions database access error only");
|
|
|
2828 |
throw new SQLException();
|
|
|
2829 |
}
|
|
|
2830 |
else
|
|
|
2831 |
{
|
|
|
2832 |
mLogger.fatal("queryPackageVersions show stopper");
|
| 868 |
mhunt |
2833 |
throw new Exception("queryPackageVersions show stopper");
|
| 814 |
mhunt |
2834 |
}
|
|
|
2835 |
}
|
|
|
2836 |
}
|
|
|
2837 |
|
|
|
2838 |
if (!daemonMode)
|
|
|
2839 |
{
|
|
|
2840 |
// use a ListIterator as it allows traverseDependencies to modify the packageCollection
|
| 864 |
mhunt |
2841 |
for (ListIterator<Package> it = packageCollection.listIterator(); it.hasNext(); )
|
| 814 |
mhunt |
2842 |
{
|
| 864 |
mhunt |
2843 |
Package p = it.next();
|
| 814 |
mhunt |
2844 |
traverseDependencies(packageCollection, p, false, it);
|
|
|
2845 |
}
|
|
|
2846 |
|
| 864 |
mhunt |
2847 |
for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
2848 |
{
|
| 864 |
mhunt |
2849 |
Package p = it.next();
|
| 814 |
mhunt |
2850 |
queryBuildInfo(rippleEngine, p);
|
|
|
2851 |
}
|
|
|
2852 |
}
|
|
|
2853 |
|
|
|
2854 |
}
|
|
|
2855 |
|
|
|
2856 |
/**only used in daemon mode
|
| 882 |
mhunt |
2857 |
* select config from release_manager.build_service_config where service='MAIL SERVER';
|
| 814 |
mhunt |
2858 |
* returns the configured service
|
|
|
2859 |
*/
|
|
|
2860 |
String queryMailServer() throws SQLException, Exception
|
|
|
2861 |
{
|
|
|
2862 |
mLogger.debug("queryMailServer");
|
|
|
2863 |
String retVal = new String();
|
|
|
2864 |
|
|
|
2865 |
if ( !mUseDatabase )
|
|
|
2866 |
{
|
|
|
2867 |
mLogger.info("queryMailServer !mUseDatabase");
|
|
|
2868 |
// a highly likely mail server
|
| 894 |
mhunt |
2869 |
retVal = "auperadom10.aupera.erggroup.com";
|
| 814 |
mhunt |
2870 |
}
|
|
|
2871 |
else
|
|
|
2872 |
{
|
|
|
2873 |
try
|
|
|
2874 |
{
|
|
|
2875 |
CallableStatement stmt = mConnection.prepareCall("select config from release_manager.build_service_config where service='MAIL SERVER'");
|
|
|
2876 |
ResultSet rset = stmt.executeQuery();
|
|
|
2877 |
|
|
|
2878 |
while( rset.next() )
|
|
|
2879 |
{
|
|
|
2880 |
String config = rset.getString("config");
|
|
|
2881 |
|
|
|
2882 |
if ( config != null )
|
|
|
2883 |
{
|
|
|
2884 |
retVal += config;
|
|
|
2885 |
}
|
|
|
2886 |
}
|
| 830 |
mhunt |
2887 |
|
|
|
2888 |
rset.close();
|
|
|
2889 |
stmt.close();
|
| 814 |
mhunt |
2890 |
}
|
|
|
2891 |
catch ( SQLException e )
|
|
|
2892 |
{
|
|
|
2893 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
2894 |
{
|
|
|
2895 |
mLogger.error("queryMailServer database access error only");
|
|
|
2896 |
throw new SQLException();
|
|
|
2897 |
}
|
|
|
2898 |
else
|
|
|
2899 |
{
|
|
|
2900 |
mLogger.fatal("queryMailServer show stopper");
|
| 868 |
mhunt |
2901 |
throw new Exception("queryMailServer show stopper");
|
| 814 |
mhunt |
2902 |
}
|
|
|
2903 |
}
|
|
|
2904 |
}
|
|
|
2905 |
|
|
|
2906 |
mLogger.info("queryMailServer returned " + retVal);
|
|
|
2907 |
return retVal;
|
|
|
2908 |
}
|
|
|
2909 |
|
|
|
2910 |
/**only used in daemon mode
|
| 882 |
mhunt |
2911 |
* select config from release_manager.build_service_config where service='BUILD FAILURE MAIL SENDER';
|
| 814 |
mhunt |
2912 |
* returns the configured service
|
|
|
2913 |
*/
|
|
|
2914 |
String queryMailSender() throws SQLException, Exception
|
|
|
2915 |
{
|
|
|
2916 |
mLogger.debug("queryMailSender");
|
|
|
2917 |
String retVal = new String();
|
|
|
2918 |
|
|
|
2919 |
if ( !mUseDatabase )
|
|
|
2920 |
{
|
|
|
2921 |
mLogger.info("queryMailSender !mUseDatabase");
|
|
|
2922 |
// a highly likely mail sender
|
|
|
2923 |
retVal = "buildadm@erggroup.com";
|
|
|
2924 |
}
|
|
|
2925 |
else
|
|
|
2926 |
{
|
|
|
2927 |
try
|
|
|
2928 |
{
|
|
|
2929 |
CallableStatement stmt = mConnection.prepareCall("select config from release_manager.build_service_config where service='BUILD FAILURE MAIL SENDER'");
|
|
|
2930 |
ResultSet rset = stmt.executeQuery();
|
|
|
2931 |
|
|
|
2932 |
while( rset.next() )
|
|
|
2933 |
{
|
|
|
2934 |
String config = rset.getString("config");
|
|
|
2935 |
|
|
|
2936 |
if ( config != null )
|
|
|
2937 |
{
|
|
|
2938 |
retVal += config;
|
|
|
2939 |
}
|
|
|
2940 |
}
|
| 830 |
mhunt |
2941 |
|
|
|
2942 |
rset.close();
|
|
|
2943 |
stmt.close();
|
| 814 |
mhunt |
2944 |
}
|
|
|
2945 |
catch ( SQLException e )
|
|
|
2946 |
{
|
|
|
2947 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
2948 |
{
|
|
|
2949 |
mLogger.error("queryMailSender database access error only");
|
|
|
2950 |
throw new SQLException();
|
|
|
2951 |
}
|
|
|
2952 |
else
|
|
|
2953 |
{
|
|
|
2954 |
mLogger.fatal("queryMailSender show stopper");
|
| 868 |
mhunt |
2955 |
throw new Exception("queryMailSender show stopper");
|
| 814 |
mhunt |
2956 |
}
|
|
|
2957 |
}
|
|
|
2958 |
}
|
|
|
2959 |
|
|
|
2960 |
mLogger.debug("queryMailSender returned " + retVal);
|
|
|
2961 |
return retVal;
|
|
|
2962 |
}
|
|
|
2963 |
|
| 868 |
mhunt |
2964 |
/**only used in daemon mode
|
| 882 |
mhunt |
2965 |
* select u.user_email from release_manager.build_service_config bsc, release_manager.users u
|
| 868 |
mhunt |
2966 |
* where bsc.service='GLOBAL EMAIL ADDRESS LIST' and u.full_name=bsc.config
|
|
|
2967 |
* returns the configured global email addresses
|
|
|
2968 |
*/
|
|
|
2969 |
String queryGlobalAddresses() throws SQLException, Exception
|
|
|
2970 |
{
|
|
|
2971 |
mLogger.debug("queryGlobalAddresses");
|
|
|
2972 |
String retVal = new String();
|
|
|
2973 |
|
|
|
2974 |
if ( !mUseDatabase )
|
|
|
2975 |
{
|
|
|
2976 |
mLogger.info("queryGlobalAddresses !mUseDatabase");
|
|
|
2977 |
// a highly unlikely address
|
|
|
2978 |
retVal = "buildadm@erggroup.com";
|
|
|
2979 |
}
|
|
|
2980 |
else
|
|
|
2981 |
{
|
|
|
2982 |
try
|
|
|
2983 |
{
|
|
|
2984 |
CallableStatement stmt = mConnection.prepareCall(
|
| 882 |
mhunt |
2985 |
"select u.user_email from release_manager.build_service_config bsc, release_manager.users u " +
|
| 868 |
mhunt |
2986 |
"where bsc.service='GLOBAL EMAIL ADDRESS LIST' and u.full_name=bsc.config"
|
|
|
2987 |
);
|
|
|
2988 |
ResultSet rset = stmt.executeQuery();
|
|
|
2989 |
|
|
|
2990 |
while( rset.next() )
|
|
|
2991 |
{
|
|
|
2992 |
String email = rset.getString("user_email");
|
|
|
2993 |
|
|
|
2994 |
if ( email != null )
|
|
|
2995 |
{
|
|
|
2996 |
retVal += email;
|
|
|
2997 |
}
|
|
|
2998 |
}
|
|
|
2999 |
|
|
|
3000 |
rset.close();
|
|
|
3001 |
stmt.close();
|
|
|
3002 |
}
|
|
|
3003 |
catch ( SQLException e )
|
|
|
3004 |
{
|
|
|
3005 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3006 |
{
|
|
|
3007 |
mLogger.error("queryGlobalAddresses database access error only");
|
|
|
3008 |
throw new SQLException();
|
|
|
3009 |
}
|
|
|
3010 |
else
|
|
|
3011 |
{
|
|
|
3012 |
mLogger.fatal("queryGlobalAddresses show stopper");
|
|
|
3013 |
throw new Exception("queryGlobalAddresses show stopper");
|
|
|
3014 |
}
|
|
|
3015 |
}
|
|
|
3016 |
}
|
|
|
3017 |
|
|
|
3018 |
mLogger.debug("queryGlobalAddresses returned " + retVal);
|
|
|
3019 |
return retVal;
|
|
|
3020 |
}
|
|
|
3021 |
|
| 814 |
mhunt |
3022 |
/**called only in escrow mode
|
|
|
3023 |
* if checkCollection is true, checks the pv_id is in the packageCollection
|
|
|
3024 |
* if checkCollection is false, or the pv_id is not in the collection
|
|
|
3025 |
* 1 traverses the pv_id package dependencies
|
| 924 |
dpurdie |
3026 |
* select dpv.pv_id, p.pkg_name, dpv.pkg_version, dpv.v_ext
|
| 814 |
mhunt |
3027 |
* from release_manager.package_versions pv, release_manager.package_dependencies pd, release_manager.package_versions dpv, release_manager.packages p
|
|
|
3028 |
* where pv.pv_id = <pv_id> and pd.pv_id=pv.pv_id and dpv.pv_id=pd.dpv_id and p.pkg_id=dpv.pkg_id
|
|
|
3029 |
* order by pv.pv_id;
|
|
|
3030 |
* 2 for each dpv.pv_id in the resultset
|
|
|
3031 |
* call traverseDependencies( packageCollection, dpv.pv_id, true )
|
|
|
3032 |
* if the pv_id is not in the collection, add it
|
|
|
3033 |
*
|
|
|
3034 |
*/
|
| 864 |
mhunt |
3035 |
private void traverseDependencies(Vector<Package> packageCollection, Package pkg,
|
| 814 |
mhunt |
3036 |
boolean checkCollection,
|
| 864 |
mhunt |
3037 |
ListIterator<Package> listIterator) throws SQLException, Exception
|
| 814 |
mhunt |
3038 |
{
|
|
|
3039 |
mLogger.debug("traverseDependencies " + checkCollection);
|
|
|
3040 |
boolean pvIdInCollection = false;
|
|
|
3041 |
|
|
|
3042 |
if ( checkCollection )
|
|
|
3043 |
{
|
| 864 |
mhunt |
3044 |
for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
3045 |
{
|
| 864 |
mhunt |
3046 |
Package p = it.next();
|
| 814 |
mhunt |
3047 |
|
|
|
3048 |
if ( p.mId == pkg.mId )
|
|
|
3049 |
{
|
|
|
3050 |
pvIdInCollection = true;
|
|
|
3051 |
break;
|
|
|
3052 |
}
|
|
|
3053 |
}
|
|
|
3054 |
}
|
|
|
3055 |
|
|
|
3056 |
if ( !pvIdInCollection )
|
|
|
3057 |
{
|
| 864 |
mhunt |
3058 |
Vector<Package> resultset = new Vector<Package>();
|
| 814 |
mhunt |
3059 |
|
|
|
3060 |
if ( !mUseDatabase )
|
|
|
3061 |
{
|
|
|
3062 |
mLogger.info("traverseDependencies !mUseDatabase");
|
|
|
3063 |
|
|
|
3064 |
if ( pkg.mId == 8 || pkg.mId == 10 || pkg.mId == 13 )
|
|
|
3065 |
{
|
| 924 |
dpurdie |
3066 |
Package p = new Package(9, "CommonDependency", "1.0.0000.tim", ".tim", "CommonDependency.1.0.0000.tim", "CC::/vob/CommonDependency::CommonDependency_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
3067 |
resultset.add(p);
|
|
|
3068 |
pkg.mDependencyCollection.add(p.mAlias);
|
|
|
3069 |
}
|
|
|
3070 |
else if ( pkg.mId == 9 )
|
|
|
3071 |
{
|
| 924 |
dpurdie |
3072 |
Package p = new Package(7, "CotsWithFunnyVersion", "hoopla2_x.cots", ".cots", "CotsWithFunnyVersion.hoopla2_x.cots", "CC::/vob/CotsWithFunnyVersion::CotsWithFunnyVersion_hoopla2_x.cots", 'x');
|
| 814 |
mhunt |
3073 |
resultset.add(p);
|
|
|
3074 |
pkg.mDependencyCollection.add(p.mAlias);
|
|
|
3075 |
}
|
|
|
3076 |
else if ( pkg.mId == 11 )
|
|
|
3077 |
{
|
| 924 |
dpurdie |
3078 |
Package p = new Package(14, "AdvisoryDependency", "1.0.0000.tim", ".tim", "AdvisoryDependency.1.0.0000.tim", "CC::/vob/AdvisoryDependency::AdvisoryDependency_1.0.0000.tim", 'x');
|
| 814 |
mhunt |
3079 |
resultset.add(p);
|
|
|
3080 |
pkg.mDependencyCollection.add(p.mAlias);
|
|
|
3081 |
}
|
|
|
3082 |
}
|
|
|
3083 |
else
|
|
|
3084 |
{
|
|
|
3085 |
try
|
|
|
3086 |
{
|
|
|
3087 |
CallableStatement stmt = mConnection.prepareCall(
|
| 924 |
dpurdie |
3088 |
"select dpv.pv_id," +
|
|
|
3089 |
"p.pkg_name," +
|
|
|
3090 |
"dpv.pkg_version," +
|
|
|
3091 |
"dpv.v_ext," +
|
| 928 |
dpurdie |
3092 |
"release_manager.PK_RMAPI.return_vcs_tag(dpv.pv_id) AS vcsTag" +
|
| 924 |
dpurdie |
3093 |
" from release_manager.package_versions pv," +
|
|
|
3094 |
"release_manager.package_dependencies pd," +
|
|
|
3095 |
"release_manager.package_versions dpv," +
|
|
|
3096 |
"release_manager.packages p" +
|
|
|
3097 |
" where pv.pv_id=" + pkg.mId +
|
|
|
3098 |
" and pd.pv_id=pv.pv_id" +
|
|
|
3099 |
" and dpv.pv_id=pd.dpv_id" +
|
|
|
3100 |
" and p.pkg_id=dpv.pkg_id" +
|
|
|
3101 |
" order by pv.pv_id"
|
| 814 |
mhunt |
3102 |
);
|
|
|
3103 |
ResultSet rset = stmt.executeQuery();
|
|
|
3104 |
|
|
|
3105 |
while( rset.next() )
|
|
|
3106 |
{
|
|
|
3107 |
int pv_id = rset.getInt("pv_id");
|
|
|
3108 |
|
|
|
3109 |
if ( rset.wasNull() )
|
|
|
3110 |
{
|
|
|
3111 |
mLogger.fatal("traverseDependencies null pv_id");
|
|
|
3112 |
// show stopper
|
| 868 |
mhunt |
3113 |
throw new Exception("traverseDependencies null pv_id");
|
| 814 |
mhunt |
3114 |
}
|
|
|
3115 |
|
|
|
3116 |
String pkg_name = rset.getString("pkg_name");
|
|
|
3117 |
|
|
|
3118 |
if ( pkg_name == null )
|
|
|
3119 |
{
|
|
|
3120 |
mLogger.fatal("traverseDependencies null pkg_name " + pv_id);
|
|
|
3121 |
// show stopper
|
| 868 |
mhunt |
3122 |
throw new Exception("traverseDependencies null pkg_name " + pv_id);
|
| 814 |
mhunt |
3123 |
}
|
|
|
3124 |
|
|
|
3125 |
String pkg_version = rset.getString("pkg_version");
|
|
|
3126 |
|
|
|
3127 |
if ( pkg_version == null )
|
|
|
3128 |
{
|
|
|
3129 |
mLogger.fatal("traverseDependencies null pkg_version " + pv_id);
|
|
|
3130 |
// show stopper
|
| 868 |
mhunt |
3131 |
throw new Exception("traverseDependencies null pkg_version " + pv_id);
|
| 814 |
mhunt |
3132 |
}
|
|
|
3133 |
|
|
|
3134 |
String v_ext = rset.getString("v_ext");
|
|
|
3135 |
|
|
|
3136 |
if ( v_ext == null )
|
|
|
3137 |
{
|
|
|
3138 |
v_ext = "";
|
|
|
3139 |
}
|
| 924 |
dpurdie |
3140 |
|
|
|
3141 |
String vcs_tag = rset.getString("vcsTag");
|
|
|
3142 |
if ( vcs_tag == null )
|
| 814 |
mhunt |
3143 |
{
|
| 924 |
dpurdie |
3144 |
vcs_tag = "";
|
| 814 |
mhunt |
3145 |
}
|
| 924 |
dpurdie |
3146 |
|
|
|
3147 |
Package p = new Package(pv_id, pkg_name, pkg_version, v_ext, pkg_name + "." + pkg_version, vcs_tag, 'x');
|
| 814 |
mhunt |
3148 |
resultset.add(p);
|
|
|
3149 |
pkg.mDependencyCollection.add(p.mAlias);
|
|
|
3150 |
}
|
| 830 |
mhunt |
3151 |
|
|
|
3152 |
rset.close();
|
|
|
3153 |
stmt.close();
|
| 814 |
mhunt |
3154 |
}
|
|
|
3155 |
catch ( SQLException e )
|
|
|
3156 |
{
|
|
|
3157 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3158 |
{
|
|
|
3159 |
mLogger.fatal("traverseDependencies database access error only");
|
|
|
3160 |
throw new SQLException();
|
|
|
3161 |
}
|
|
|
3162 |
else
|
|
|
3163 |
{
|
|
|
3164 |
mLogger.fatal("traverseDependencies show stopper");
|
| 868 |
mhunt |
3165 |
throw new Exception("traverseDependencies show stopper");
|
| 814 |
mhunt |
3166 |
}
|
|
|
3167 |
}
|
|
|
3168 |
}
|
|
|
3169 |
|
| 864 |
mhunt |
3170 |
for (Iterator<Package> it = resultset.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
3171 |
{
|
| 864 |
mhunt |
3172 |
Package r = it.next();
|
| 814 |
mhunt |
3173 |
traverseDependencies(packageCollection, r, true, listIterator);
|
|
|
3174 |
|
|
|
3175 |
pvIdInCollection = false;
|
|
|
3176 |
|
| 864 |
mhunt |
3177 |
for (Iterator<Package> it2 = packageCollection.iterator(); it2.hasNext(); )
|
| 814 |
mhunt |
3178 |
{
|
| 864 |
mhunt |
3179 |
Package p = it2.next();
|
| 814 |
mhunt |
3180 |
|
|
|
3181 |
if ( p.mId == r.mId )
|
|
|
3182 |
{
|
|
|
3183 |
pvIdInCollection = true;
|
|
|
3184 |
break;
|
|
|
3185 |
}
|
|
|
3186 |
}
|
|
|
3187 |
|
|
|
3188 |
if (!pvIdInCollection)
|
|
|
3189 |
{
|
|
|
3190 |
// insert the Package immediately before the next Package returned by next
|
|
|
3191 |
// this does not change the next Package (if any) to be returned by next
|
|
|
3192 |
listIterator.add(r);
|
|
|
3193 |
}
|
|
|
3194 |
|
|
|
3195 |
}
|
|
|
3196 |
}
|
|
|
3197 |
}
|
|
|
3198 |
|
|
|
3199 |
/**returns the Package with the matching mID or NULL_PACKAGE if no package has the mID
|
|
|
3200 |
*/
|
| 864 |
mhunt |
3201 |
private Package findPackage(int id, Vector<Package> packageCollection)
|
| 814 |
mhunt |
3202 |
{
|
|
|
3203 |
mLogger.debug("findPackage 1 id " + id);
|
|
|
3204 |
Package retVal = NULL_PACKAGE;
|
|
|
3205 |
|
| 864 |
mhunt |
3206 |
for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
3207 |
{
|
| 864 |
mhunt |
3208 |
Package p = it.next();
|
| 814 |
mhunt |
3209 |
|
|
|
3210 |
if ( p.mId == id )
|
|
|
3211 |
{
|
|
|
3212 |
retVal = p;
|
|
|
3213 |
break;
|
|
|
3214 |
}
|
|
|
3215 |
}
|
|
|
3216 |
|
|
|
3217 |
mLogger.debug("findPackage 1 returned " + retVal.mName);
|
|
|
3218 |
return retVal;
|
|
|
3219 |
}
|
|
|
3220 |
|
|
|
3221 |
/**called only in escrow mode to add build info to the Package
|
|
|
3222 |
* select bm.bm_name, bsa.bsa_name
|
|
|
3223 |
* from release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa
|
|
|
3224 |
* where pv.pv_id = <p.pv_id> and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id
|
|
|
3225 |
* order by pv.pv_id;
|
|
|
3226 |
*/
|
|
|
3227 |
private void queryBuildInfo(RippleEngine rippleEngine, Package p) throws SQLException, Exception
|
|
|
3228 |
{
|
|
|
3229 |
mLogger.debug("queryBuildInfo");
|
|
|
3230 |
if ( !mUseDatabase )
|
|
|
3231 |
{
|
|
|
3232 |
mLogger.info("queryBuildInfo !mUseDatabase");
|
|
|
3233 |
|
|
|
3234 |
if (p.mId == 7)
|
|
|
3235 |
{
|
|
|
3236 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3237 |
bs.setSolaris();
|
|
|
3238 |
bs.setDebug();
|
|
|
3239 |
p.mBuildStandardCollection.add(bs);
|
|
|
3240 |
}
|
|
|
3241 |
else if (p.mId == 9)
|
|
|
3242 |
{
|
|
|
3243 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3244 |
bs.setLinux();
|
|
|
3245 |
bs.setDebug();
|
|
|
3246 |
p.mBuildStandardCollection.add(bs);
|
|
|
3247 |
bs = new BuildStandard(rippleEngine);
|
|
|
3248 |
bs.setSolaris();
|
|
|
3249 |
bs.setDebug();
|
|
|
3250 |
p.mBuildStandardCollection.add(bs);
|
|
|
3251 |
bs = new BuildStandard(rippleEngine);
|
|
|
3252 |
bs.setWin32();
|
|
|
3253 |
bs.setProduction();
|
|
|
3254 |
p.mBuildStandardCollection.add(bs);
|
|
|
3255 |
}
|
|
|
3256 |
else if (p.mId == 10)
|
|
|
3257 |
{
|
|
|
3258 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3259 |
bs.setSolaris();
|
|
|
3260 |
bs.set1_4();
|
|
|
3261 |
p.mBuildStandardCollection.add(bs);
|
|
|
3262 |
}
|
|
|
3263 |
else if (p.mId == 11)
|
|
|
3264 |
{
|
|
|
3265 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3266 |
bs.setLinux();
|
|
|
3267 |
bs.setAll();
|
|
|
3268 |
p.mBuildStandardCollection.add(bs);
|
|
|
3269 |
}
|
|
|
3270 |
else if (p.mId == 12)
|
|
|
3271 |
{
|
|
|
3272 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3273 |
bs.setWin32();
|
|
|
3274 |
bs.set1_6();
|
|
|
3275 |
p.mBuildStandardCollection.add(bs);
|
|
|
3276 |
}
|
|
|
3277 |
else if (p.mId == 13)
|
|
|
3278 |
{
|
|
|
3279 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3280 |
bs.setGeneric();
|
|
|
3281 |
bs.set1_4();
|
|
|
3282 |
p.mBuildStandardCollection.add(bs);
|
|
|
3283 |
}
|
|
|
3284 |
else if (p.mId == 14)
|
|
|
3285 |
{
|
|
|
3286 |
BuildStandard bs = new BuildStandard(rippleEngine);
|
|
|
3287 |
bs.setLinux();
|
|
|
3288 |
bs.setDebug();
|
|
|
3289 |
p.mBuildStandardCollection.add(bs);
|
|
|
3290 |
}
|
|
|
3291 |
|
|
|
3292 |
}
|
|
|
3293 |
else
|
|
|
3294 |
{
|
|
|
3295 |
try
|
|
|
3296 |
{
|
|
|
3297 |
CallableStatement stmt = mConnection.prepareCall(
|
|
|
3298 |
"select bm.bm_name, bsa.bsa_name " +
|
|
|
3299 |
"from release_manager.package_versions pv, release_manager.package_build_info pbi, release_manager.build_machines bm, release_manager.build_standards_addendum bsa " +
|
|
|
3300 |
"where pv.pv_id=" + p.mId + " and pbi.pv_id=pv.pv_id and bm.bm_id=pbi.bm_id and bsa.bsa_id=pbi.bsa_id " +
|
|
|
3301 |
"order by pv.pv_id"
|
|
|
3302 |
);
|
|
|
3303 |
ResultSet rset = stmt.executeQuery();
|
|
|
3304 |
|
|
|
3305 |
while( rset.next() )
|
|
|
3306 |
{
|
|
|
3307 |
String bm_name = rset.getString("bm_name");
|
|
|
3308 |
|
|
|
3309 |
if ( bm_name == null )
|
|
|
3310 |
{
|
|
|
3311 |
mLogger.fatal("queryBuildInfo null bm_name " + p.mId);
|
|
|
3312 |
// show stopper
|
| 868 |
mhunt |
3313 |
throw new Exception("queryBuildInfo null bm_name " + p.mId);
|
| 814 |
mhunt |
3314 |
}
|
| 908 |
mhunt |
3315 |
|
| 814 |
mhunt |
3316 |
String bsa_name = rset.getString("bsa_name");
|
| 908 |
mhunt |
3317 |
|
| 814 |
mhunt |
3318 |
if ( bsa_name == null )
|
|
|
3319 |
{
|
|
|
3320 |
mLogger.fatal("queryBuildInfo null bsa_name " + p.mId);
|
|
|
3321 |
// show stopper
|
| 868 |
mhunt |
3322 |
throw new Exception("queryBuildInfo null bsa_name " + p.mId);
|
| 814 |
mhunt |
3323 |
}
|
| 908 |
mhunt |
3324 |
|
|
|
3325 |
BuildStandard bs = new BuildStandard(rippleEngine, bm_name, bsa_name);
|
| 814 |
mhunt |
3326 |
|
| 908 |
mhunt |
3327 |
if ( bs.supportedBuildStandard() )
|
| 814 |
mhunt |
3328 |
{
|
|
|
3329 |
p.mBuildStandardCollection.add(bs);
|
|
|
3330 |
}
|
|
|
3331 |
}
|
| 830 |
mhunt |
3332 |
|
|
|
3333 |
rset.close();
|
|
|
3334 |
stmt.close();
|
| 814 |
mhunt |
3335 |
}
|
|
|
3336 |
catch ( SQLException e )
|
|
|
3337 |
{
|
|
|
3338 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3339 |
{
|
|
|
3340 |
mLogger.error("queryBuildInfo database access error only");
|
|
|
3341 |
throw new SQLException();
|
|
|
3342 |
}
|
|
|
3343 |
else
|
|
|
3344 |
{
|
|
|
3345 |
mLogger.fatal("queryBuildInfo show stopper");
|
| 868 |
mhunt |
3346 |
throw new Exception("queryBuildInfo show stopper");
|
| 814 |
mhunt |
3347 |
}
|
|
|
3348 |
}
|
|
|
3349 |
}
|
|
|
3350 |
}
|
|
|
3351 |
|
|
|
3352 |
/**returns the Package with the matching mAlias or NULL_PACKAGE if no package has the mAlias
|
|
|
3353 |
*/
|
| 864 |
mhunt |
3354 |
private Package findPackage(String alias, Vector<Package> packageCollection)
|
| 814 |
mhunt |
3355 |
{
|
|
|
3356 |
mLogger.debug("findPackage 2 alias " + alias);
|
|
|
3357 |
Package retVal = NULL_PACKAGE;
|
|
|
3358 |
|
| 864 |
mhunt |
3359 |
for (Iterator<Package> it = packageCollection.iterator(); it.hasNext(); )
|
| 814 |
mhunt |
3360 |
{
|
| 864 |
mhunt |
3361 |
Package p = it.next();
|
| 814 |
mhunt |
3362 |
|
|
|
3363 |
if ( p.mAlias.compareTo( alias ) == 0 )
|
|
|
3364 |
{
|
|
|
3365 |
retVal = p;
|
|
|
3366 |
break;
|
|
|
3367 |
}
|
|
|
3368 |
}
|
| 844 |
dpurdie |
3369 |
|
| 814 |
mhunt |
3370 |
mLogger.info("findPackage 2 returned " + retVal.mName);
|
|
|
3371 |
return retVal;
|
|
|
3372 |
}
|
|
|
3373 |
|
|
|
3374 |
/**essentially locks the row in the BUILD_SERVICE_CONFIG table with a service of MUTEX
|
| 898 |
mhunt |
3375 |
* for the duration of the transaction
|
| 814 |
mhunt |
3376 |
* this prevents other MasterThreads from generating build files in parallel
|
|
|
3377 |
* and hence prevents planned version numbering contention
|
| 882 |
mhunt |
3378 |
* select CONFIG from release_manager.BUILD_SERVICE_CONFIG WHERE SERVICE='MUTEX' FOR UPDATE
|
| 814 |
mhunt |
3379 |
*/
|
|
|
3380 |
public void claimMutex() throws SQLException, Exception
|
|
|
3381 |
{
|
|
|
3382 |
mLogger.debug("claimMutex");
|
| 924 |
dpurdie |
3383 |
if ( mUseDatabase && mUseMutex )
|
| 814 |
mhunt |
3384 |
{
|
|
|
3385 |
try
|
|
|
3386 |
{
|
|
|
3387 |
CallableStatement stmt = mConnection.prepareCall("select CONFIG from release_manager.BUILD_SERVICE_CONFIG WHERE SERVICE='MUTEX' FOR UPDATE");
|
| 916 |
mhunt |
3388 |
mLogger.fatal("claimMutex calling stmt.executeUpdate");
|
| 814 |
mhunt |
3389 |
stmt.executeUpdate();
|
| 916 |
mhunt |
3390 |
mLogger.fatal("claimMutex called stmt.executeUpdate");
|
| 844 |
dpurdie |
3391 |
stmt.close();
|
| 898 |
mhunt |
3392 |
mDoNotCommit = true;
|
| 814 |
mhunt |
3393 |
}
|
|
|
3394 |
catch ( SQLException e )
|
|
|
3395 |
{
|
|
|
3396 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3397 |
{
|
|
|
3398 |
mLogger.error("claimMutex database access error only");
|
|
|
3399 |
throw new SQLException();
|
|
|
3400 |
}
|
|
|
3401 |
else
|
|
|
3402 |
{
|
|
|
3403 |
mLogger.fatal("claimMutex show stopper");
|
| 868 |
mhunt |
3404 |
throw new Exception("claimMutex show stopper");
|
| 814 |
mhunt |
3405 |
}
|
|
|
3406 |
}
|
| 896 |
mhunt |
3407 |
// about to start the planning process again, discard previous
|
|
|
3408 |
discardVersions();
|
| 814 |
mhunt |
3409 |
}
|
|
|
3410 |
}
|
|
|
3411 |
|
| 898 |
mhunt |
3412 |
/**essentially unlocks the row in the BUILD_SERVICE_CONFIG table with a service of MUTEX
|
|
|
3413 |
*/
|
|
|
3414 |
public void releaseMutex() throws SQLException, Exception
|
|
|
3415 |
{
|
|
|
3416 |
mLogger.debug("releaseMutex");
|
|
|
3417 |
if ( mUseDatabase )
|
|
|
3418 |
{
|
|
|
3419 |
try
|
|
|
3420 |
{
|
|
|
3421 |
mDoNotCommit = false;
|
| 916 |
mhunt |
3422 |
mLogger.fatal("releaseMutex calling commit");
|
| 898 |
mhunt |
3423 |
commit();
|
| 916 |
mhunt |
3424 |
mLogger.fatal("releaseMutex called commit");
|
| 898 |
mhunt |
3425 |
}
|
|
|
3426 |
catch ( SQLException e )
|
|
|
3427 |
{
|
|
|
3428 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3429 |
{
|
|
|
3430 |
mLogger.error("releaseMutex database access error only");
|
|
|
3431 |
throw new SQLException();
|
|
|
3432 |
}
|
|
|
3433 |
else
|
|
|
3434 |
{
|
|
|
3435 |
mLogger.fatal("releaseMutex show stopper");
|
|
|
3436 |
throw new Exception("releaseMutex show stopper");
|
|
|
3437 |
}
|
|
|
3438 |
}
|
|
|
3439 |
}
|
|
|
3440 |
}
|
|
|
3441 |
|
|
|
3442 |
/**central commit protection
|
|
|
3443 |
*/
|
|
|
3444 |
private void commit() throws SQLException, Exception
|
|
|
3445 |
{
|
|
|
3446 |
mLogger.debug("commit");
|
|
|
3447 |
if ( mUseDatabase )
|
|
|
3448 |
{
|
|
|
3449 |
if ( mDoNotCommit )
|
|
|
3450 |
{
|
|
|
3451 |
mLogger.error("commit attempted commit with mDoNotCommit set, this is a programming error");
|
|
|
3452 |
}
|
|
|
3453 |
else
|
|
|
3454 |
{
|
|
|
3455 |
mConnection.commit();
|
|
|
3456 |
}
|
|
|
3457 |
}
|
|
|
3458 |
}
|
|
|
3459 |
|
| 814 |
mhunt |
3460 |
/**sets CURRENT_BUILD_FILES to NULL for the rcon_id
|
| 882 |
mhunt |
3461 |
* update release_manager.run_level set current_build_files=null where rcon_id=<rcon_id>
|
| 814 |
mhunt |
3462 |
*/
|
| 882 |
mhunt |
3463 |
public void clearBuildFile(int rcon_id) throws SQLException, Exception
|
| 814 |
mhunt |
3464 |
{
|
|
|
3465 |
mLogger.debug("clearBuildFile");
|
|
|
3466 |
|
|
|
3467 |
try
|
|
|
3468 |
{
|
|
|
3469 |
connect();
|
| 882 |
mhunt |
3470 |
|
|
|
3471 |
if ( isRconIdConfigured( rcon_id ))
|
|
|
3472 |
{
|
|
|
3473 |
CallableStatement stmt = mConnection.prepareCall("update release_manager.run_level set current_build_files=null where rcon_id=" + rcon_id);
|
|
|
3474 |
stmt.executeUpdate();
|
|
|
3475 |
stmt.close();
|
| 898 |
mhunt |
3476 |
commit();
|
| 882 |
mhunt |
3477 |
}
|
| 814 |
mhunt |
3478 |
}
|
|
|
3479 |
catch ( SQLException e )
|
|
|
3480 |
{
|
|
|
3481 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3482 |
{
|
|
|
3483 |
mLogger.error("clearBuildFile database access error only");
|
|
|
3484 |
throw new SQLException();
|
|
|
3485 |
}
|
|
|
3486 |
else
|
|
|
3487 |
{
|
|
|
3488 |
mLogger.fatal("clearBuildFile show stopper");
|
| 868 |
mhunt |
3489 |
throw new Exception("clearBuildFile show stopper");
|
| 814 |
mhunt |
3490 |
}
|
|
|
3491 |
}
|
| 898 |
mhunt |
3492 |
finally
|
|
|
3493 |
{
|
|
|
3494 |
// this block is executed regardless of what happens in the try block
|
|
|
3495 |
// even if an exception is thrown
|
|
|
3496 |
// ensure disconnect
|
|
|
3497 |
disconnect();
|
|
|
3498 |
}
|
| 814 |
mhunt |
3499 |
}
|
|
|
3500 |
|
|
|
3501 |
/**updates the CURRENT_BUILD_FILES for the rtag_id
|
|
|
3502 |
* update (
|
| 882 |
mhunt |
3503 |
* select current_build_files from release_manager.release_manager.run_level rl, release_manager.release_manager.release_config rc
|
| 814 |
mhunt |
3504 |
* where rc.rtag_id=<rtag_id> and rl.rcon_id=rc.rcon_id
|
|
|
3505 |
* ) set current_build_files=<buildFile>
|
|
|
3506 |
*/
|
| 882 |
mhunt |
3507 |
public void publishBuildFile(int rtag_id, String buildFile) throws SQLException, Exception
|
| 814 |
mhunt |
3508 |
{
|
|
|
3509 |
mLogger.debug("publishBuildFile publishing a build file of length " + buildFile.length());
|
|
|
3510 |
|
|
|
3511 |
try
|
|
|
3512 |
{
|
|
|
3513 |
connect();
|
| 882 |
mhunt |
3514 |
|
|
|
3515 |
if ( isRtagIdConfigured( rtag_id ) )
|
|
|
3516 |
{
|
|
|
3517 |
PreparedStatement stmt = mConnection.prepareStatement(
|
|
|
3518 |
"update (" +
|
|
|
3519 |
"select current_build_files from release_manager.run_level rl, release_manager.release_config rc " +
|
|
|
3520 |
"where rc.rtag_id=? and rl.rcon_id=rc.rcon_id" +
|
|
|
3521 |
") set current_build_files=?");
|
|
|
3522 |
stmt.setInt(1, rtag_id);
|
|
|
3523 |
stmt.setString(2, buildFile);
|
|
|
3524 |
stmt.executeUpdate();
|
|
|
3525 |
stmt.close();
|
| 898 |
mhunt |
3526 |
commit();
|
| 882 |
mhunt |
3527 |
}
|
| 814 |
mhunt |
3528 |
}
|
|
|
3529 |
catch ( SQLException e )
|
|
|
3530 |
{
|
|
|
3531 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3532 |
{
|
|
|
3533 |
mLogger.error("publishBuildFile database access error only");
|
|
|
3534 |
throw new SQLException();
|
|
|
3535 |
}
|
|
|
3536 |
else
|
|
|
3537 |
{
|
|
|
3538 |
mLogger.fatal("publishBuildFile show stopper");
|
| 868 |
mhunt |
3539 |
throw new Exception("publishBuildFile show stopper");
|
| 814 |
mhunt |
3540 |
}
|
|
|
3541 |
}
|
|
|
3542 |
catch ( Exception e )
|
|
|
3543 |
{
|
|
|
3544 |
// this catch and rethrow is historical
|
|
|
3545 |
// problems were found using CallableStatement when updating a CLOB column with data > 4000 bytes
|
|
|
3546 |
mLogger.fatal("publishBuildFile caught Exception " + e.getMessage());
|
| 868 |
mhunt |
3547 |
throw new Exception("publishBuildFile caught Exception " + e.getMessage());
|
| 814 |
mhunt |
3548 |
}
|
| 898 |
mhunt |
3549 |
finally
|
|
|
3550 |
{
|
|
|
3551 |
// this block is executed regardless of what happens in the try block
|
|
|
3552 |
// even if an exception is thrown
|
|
|
3553 |
// ensure disconnect
|
|
|
3554 |
disconnect();
|
|
|
3555 |
}
|
| 814 |
mhunt |
3556 |
}
|
|
|
3557 |
|
|
|
3558 |
/**ensures a run_level_schedule row with a non null indefinite_pause column exists
|
|
|
3559 |
* this is aimed at stopping all daemons dead
|
|
|
3560 |
* it is raised when handling an unsupported exception case in either the main or slave daemons
|
|
|
3561 |
* typically an SQLException other than a database connection related one
|
|
|
3562 |
*/
|
| 896 |
mhunt |
3563 |
public void indefinitePause()
|
| 814 |
mhunt |
3564 |
{
|
|
|
3565 |
mLogger.debug("indefinitePause");
|
| 924 |
dpurdie |
3566 |
if ( mUseDatabase && mUseMutex )
|
| 814 |
mhunt |
3567 |
{
|
| 836 |
mhunt |
3568 |
try
|
|
|
3569 |
{
|
| 896 |
mhunt |
3570 |
connect();
|
|
|
3571 |
CallableStatement stmt = mConnection.prepareCall( "begin PK_BUILDAPI.SET_INFINITE_PAUSE(); end;" );
|
|
|
3572 |
stmt.executeUpdate();
|
|
|
3573 |
stmt.close();
|
| 898 |
mhunt |
3574 |
commit();
|
| 836 |
mhunt |
3575 |
}
|
|
|
3576 |
catch( SQLException e )
|
|
|
3577 |
{
|
|
|
3578 |
// do not throw Exception
|
|
|
3579 |
// this is part of Exception handling
|
|
|
3580 |
mLogger.fatal( "indefinitePause caught SQLException " + e.getMessage() );
|
|
|
3581 |
}
|
|
|
3582 |
catch( Exception e )
|
|
|
3583 |
{
|
|
|
3584 |
mLogger.fatal( "indefinitePause caught Exception " + e.getMessage() );
|
|
|
3585 |
}
|
| 898 |
mhunt |
3586 |
finally
|
|
|
3587 |
{
|
|
|
3588 |
// this block is executed regardless of what happens in the try block
|
|
|
3589 |
// even if an exception is thrown
|
|
|
3590 |
// ensure disconnect
|
|
|
3591 |
try
|
|
|
3592 |
{
|
|
|
3593 |
disconnect();
|
|
|
3594 |
}
|
|
|
3595 |
catch( SQLException e )
|
|
|
3596 |
{
|
|
|
3597 |
// do not throw Exception
|
|
|
3598 |
// this is part of Exception handling
|
|
|
3599 |
mLogger.fatal( "indefinitePause2 caught SQLException " + e.getMessage() );
|
|
|
3600 |
}
|
|
|
3601 |
catch( Exception e )
|
|
|
3602 |
{
|
|
|
3603 |
mLogger.fatal( "indefinitePause2 caught Exception " + e.getMessage() );
|
|
|
3604 |
}
|
|
|
3605 |
}
|
| 814 |
mhunt |
3606 |
}
|
|
|
3607 |
}
|
|
|
3608 |
|
| 896 |
mhunt |
3609 |
/**ensures a run_level_schedule row with a non null indefinite_pause column does not exist
|
|
|
3610 |
* this is aimed at resuming all daemons
|
|
|
3611 |
*/
|
|
|
3612 |
private void resume() throws SQLException, Exception
|
|
|
3613 |
{
|
|
|
3614 |
mLogger.debug("resume");
|
|
|
3615 |
if ( mUseDatabase )
|
|
|
3616 |
{
|
|
|
3617 |
try
|
|
|
3618 |
{
|
|
|
3619 |
CallableStatement stmt = mConnection.prepareCall( "begin PK_BUILDAPI.SET_RESUME(); end;" );
|
|
|
3620 |
stmt.executeUpdate();
|
|
|
3621 |
stmt.close();
|
| 898 |
mhunt |
3622 |
commit();
|
| 896 |
mhunt |
3623 |
}
|
|
|
3624 |
catch ( SQLException e )
|
|
|
3625 |
{
|
|
|
3626 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3627 |
{
|
|
|
3628 |
mLogger.error("resume database access error only");
|
|
|
3629 |
throw new SQLException();
|
|
|
3630 |
}
|
|
|
3631 |
else
|
|
|
3632 |
{
|
|
|
3633 |
mLogger.fatal("resume show stopper");
|
|
|
3634 |
throw new Exception("resume show stopper");
|
|
|
3635 |
}
|
|
|
3636 |
}
|
|
|
3637 |
}
|
|
|
3638 |
}
|
|
|
3639 |
|
| 814 |
mhunt |
3640 |
/**only used in daemon mode to determine version existence in the database
|
| 882 |
mhunt |
3641 |
* 1 select pkg_id from release_manager.package_versions where pkg_id=<pkg_id> and pkg_version=<pkg_version>;
|
|
|
3642 |
* 2 select pkg_id from release_manager.planned_versions where pkg_id=<pkg_id> and pkg_version=<pkg_version>;
|
| 814 |
mhunt |
3643 |
* returns true if either resultset contains one record to indicate it already exists
|
|
|
3644 |
*/
|
|
|
3645 |
boolean queryPackageVersions(int pkg_id, String pkg_version) throws SQLException, Exception
|
|
|
3646 |
{
|
|
|
3647 |
mLogger.debug("queryPackageVersions");
|
|
|
3648 |
boolean retVal = false;
|
|
|
3649 |
|
|
|
3650 |
if ( mUseDatabase )
|
|
|
3651 |
{
|
|
|
3652 |
try
|
|
|
3653 |
{
|
|
|
3654 |
mLogger.info("queryPackageVersions release_manager.package_versions");
|
|
|
3655 |
CallableStatement stmt1 = mConnection.prepareCall("select pkg_id from release_manager.package_versions where pkg_id=" + pkg_id + " and pkg_version='" + pkg_version + "'");
|
|
|
3656 |
ResultSet rset1 = stmt1.executeQuery();
|
|
|
3657 |
int rsetSize = 0;
|
|
|
3658 |
|
|
|
3659 |
while( rset1.next() )
|
|
|
3660 |
{
|
|
|
3661 |
rsetSize++;
|
|
|
3662 |
}
|
| 830 |
mhunt |
3663 |
|
|
|
3664 |
rset1.close();
|
|
|
3665 |
stmt1.close();
|
| 814 |
mhunt |
3666 |
|
|
|
3667 |
if ( rsetSize > 1 )
|
|
|
3668 |
{
|
|
|
3669 |
mLogger.fatal("queryPackageVersions rsetSize > 1 " + pkg_id + " " + pkg_version);
|
|
|
3670 |
// show stopper
|
| 868 |
mhunt |
3671 |
throw new Exception("queryPackageVersions rsetSize > 1 " + pkg_id + " " + pkg_version);
|
| 814 |
mhunt |
3672 |
}
|
|
|
3673 |
|
|
|
3674 |
if ( rsetSize == 1 )
|
|
|
3675 |
{
|
|
|
3676 |
retVal = true;
|
|
|
3677 |
}
|
|
|
3678 |
else
|
|
|
3679 |
{
|
|
|
3680 |
mLogger.info("queryPackageVersions release_manager.planned_versions");
|
|
|
3681 |
CallableStatement stmt2 = mConnection.prepareCall("select pkg_id from release_manager.planned_versions where pkg_id=" + pkg_id + " and pkg_version='" + pkg_version + "'");
|
|
|
3682 |
ResultSet rset2 = stmt2.executeQuery();
|
|
|
3683 |
rsetSize = 0;
|
|
|
3684 |
|
|
|
3685 |
while( rset2.next() )
|
|
|
3686 |
{
|
|
|
3687 |
rsetSize++;
|
|
|
3688 |
}
|
| 830 |
mhunt |
3689 |
|
|
|
3690 |
rset2.close();
|
|
|
3691 |
stmt2.close();
|
| 814 |
mhunt |
3692 |
|
|
|
3693 |
if ( rsetSize > 1 )
|
|
|
3694 |
{
|
|
|
3695 |
mLogger.fatal("queryPackageVersions rsetSize > 1 " + pkg_id + " " + pkg_version);
|
|
|
3696 |
// show stopper
|
| 868 |
mhunt |
3697 |
throw new Exception("queryPackageVersions rsetSize > 1 " + pkg_id + " " + pkg_version);
|
| 814 |
mhunt |
3698 |
}
|
|
|
3699 |
|
|
|
3700 |
if ( rsetSize == 1 )
|
|
|
3701 |
{
|
|
|
3702 |
retVal = true;
|
|
|
3703 |
}
|
|
|
3704 |
}
|
|
|
3705 |
}
|
|
|
3706 |
catch ( SQLException e )
|
|
|
3707 |
{
|
|
|
3708 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3709 |
{
|
|
|
3710 |
mLogger.error("queryPackageVersions database access error only");
|
|
|
3711 |
throw new SQLException();
|
|
|
3712 |
}
|
|
|
3713 |
else
|
|
|
3714 |
{
|
|
|
3715 |
mLogger.fatal("queryPackageVersions show stopper");
|
| 868 |
mhunt |
3716 |
throw new Exception("queryPackageVersions show stopper");
|
| 814 |
mhunt |
3717 |
}
|
|
|
3718 |
}
|
|
|
3719 |
}
|
|
|
3720 |
|
|
|
3721 |
mLogger.info("queryPackageVersions returned " + retVal);
|
|
|
3722 |
return retVal;
|
|
|
3723 |
}
|
|
|
3724 |
|
|
|
3725 |
/**only used in daemon mode
|
| 882 |
mhunt |
3726 |
* insert into release_manager.planned_versions (pkg_id, pkg_version) values (<pkg_id>, <pkg_version>);
|
| 814 |
mhunt |
3727 |
* update
|
|
|
3728 |
* (
|
| 882 |
mhunt |
3729 |
* select current_pkg_id_being_built from release_manager.run_level rl, release_manager.release_config rc
|
| 814 |
mhunt |
3730 |
* where rc.rtag_id=<rtag_id> and rl.rcon_id=rc.rcon_id
|
|
|
3731 |
* )
|
|
|
3732 |
* set current_pkg_id_being_built=<pkg_id>
|
|
|
3733 |
*/
|
|
|
3734 |
void claimVersion(int pkg_id, String pkg_version, int rtag_id) throws SQLException, Exception
|
|
|
3735 |
{
|
|
|
3736 |
mLogger.debug("claimVersion " + pkg_id + " " + pkg_version);
|
|
|
3737 |
if ( mUseDatabase )
|
|
|
3738 |
{
|
|
|
3739 |
try
|
|
|
3740 |
{
|
| 882 |
mhunt |
3741 |
if (isRtagIdConfigured( rtag_id ))
|
|
|
3742 |
{
|
| 896 |
mhunt |
3743 |
CallableStatement stmt3 = mConnection.prepareCall("insert into release_manager.planned_versions (pkg_id, pkg_version, planned_time) values (" + pkg_id + ", '" + pkg_version + "', sysdate)");
|
| 882 |
mhunt |
3744 |
stmt3.executeUpdate();
|
|
|
3745 |
stmt3.close();
|
|
|
3746 |
CallableStatement stmt4 = mConnection.prepareCall(
|
|
|
3747 |
"update " +
|
|
|
3748 |
"(" +
|
|
|
3749 |
"select current_pkg_id_being_built from release_manager.run_level rl, release_manager.release_config rc " +
|
|
|
3750 |
"where rc.rtag_id=" + rtag_id + " and rl.rcon_id=rc.rcon_id" +
|
|
|
3751 |
")" +
|
|
|
3752 |
"set current_pkg_id_being_built=" + pkg_id);
|
|
|
3753 |
stmt4.executeUpdate();
|
|
|
3754 |
stmt4.close();
|
| 896 |
mhunt |
3755 |
mPlannedPkgId = new String();
|
|
|
3756 |
mPlannedPkgId += pkg_id;
|
|
|
3757 |
mPlannedPkgVersion = new String( pkg_version );
|
| 882 |
mhunt |
3758 |
}
|
| 814 |
mhunt |
3759 |
}
|
|
|
3760 |
catch ( SQLException e )
|
|
|
3761 |
{
|
|
|
3762 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3763 |
{
|
|
|
3764 |
mLogger.error("claimVersion database access error only");
|
|
|
3765 |
throw new SQLException();
|
|
|
3766 |
}
|
|
|
3767 |
else
|
|
|
3768 |
{
|
|
|
3769 |
mLogger.fatal("claimVersion show stopper");
|
| 868 |
mhunt |
3770 |
throw new Exception("claimVersion show stopper");
|
| 814 |
mhunt |
3771 |
}
|
|
|
3772 |
}
|
|
|
3773 |
}
|
|
|
3774 |
}
|
|
|
3775 |
|
| 818 |
mhunt |
3776 |
/**only used in daemon mode
|
| 896 |
mhunt |
3777 |
* delete from release_manager.planned_versions where pkg_id=<pkg_id> and pkg_version=<pkg_version>;
|
|
|
3778 |
*/
|
|
|
3779 |
public void discardVersion() throws SQLException, Exception
|
|
|
3780 |
{
|
|
|
3781 |
mLogger.debug("discardVersion");
|
|
|
3782 |
if ( mPlannedPkgId != null && mPlannedPkgVersion != null )
|
|
|
3783 |
{
|
|
|
3784 |
try
|
|
|
3785 |
{
|
|
|
3786 |
CallableStatement stmt = mConnection.prepareCall("delete from release_manager.planned_versions where pkg_id=" + mPlannedPkgId + " and pkg_version='" + mPlannedPkgVersion + "'");
|
|
|
3787 |
stmt.executeUpdate();
|
|
|
3788 |
stmt.close();
|
| 898 |
mhunt |
3789 |
commit();
|
| 896 |
mhunt |
3790 |
mPlannedPkgId = null;
|
|
|
3791 |
mPlannedPkgVersion = null;
|
|
|
3792 |
}
|
|
|
3793 |
catch ( SQLException e )
|
|
|
3794 |
{
|
|
|
3795 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3796 |
{
|
|
|
3797 |
mLogger.error("discardVersion database access error only");
|
|
|
3798 |
throw new SQLException();
|
|
|
3799 |
}
|
|
|
3800 |
else
|
|
|
3801 |
{
|
|
|
3802 |
mLogger.fatal("discardVersion show stopper");
|
|
|
3803 |
throw new Exception("discardVersion show stopper");
|
|
|
3804 |
}
|
|
|
3805 |
}
|
|
|
3806 |
}
|
|
|
3807 |
}
|
|
|
3808 |
|
|
|
3809 |
/**only used in daemon mode
|
|
|
3810 |
* delete planned versions over 24 hours old (rounded to the nearest hour that is)
|
|
|
3811 |
* delete from release_manager.planned_versions where planned_time < trunc(sysdate, 'hh') - 1");
|
|
|
3812 |
*/
|
|
|
3813 |
private void discardVersions() throws SQLException, Exception
|
|
|
3814 |
{
|
|
|
3815 |
mLogger.debug("discardVersions");
|
|
|
3816 |
try
|
|
|
3817 |
{
|
|
|
3818 |
// housekeep whilst the daemon has the mutex
|
|
|
3819 |
// trunc(sysdate, 'hh') returns the time now rounded to the nearest hour
|
|
|
3820 |
// trunc(sysdate, 'hh') - 1 returns the time 24 hours ago rounded to the nearest hour
|
|
|
3821 |
// this statement does not return any rows when planned_time is null, though this should never be the case
|
|
|
3822 |
CallableStatement stmt = mConnection.prepareCall("delete from release_manager.planned_versions where planned_time < trunc(sysdate, 'hh') - 1");
|
|
|
3823 |
stmt.executeUpdate();
|
|
|
3824 |
stmt.close();
|
|
|
3825 |
}
|
|
|
3826 |
catch ( SQLException e )
|
|
|
3827 |
{
|
|
|
3828 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3829 |
{
|
|
|
3830 |
mLogger.error("discardVersions database access error only");
|
|
|
3831 |
throw new SQLException();
|
|
|
3832 |
}
|
|
|
3833 |
else
|
|
|
3834 |
{
|
|
|
3835 |
mLogger.fatal("discardVersions show stopper");
|
|
|
3836 |
throw new Exception("discardVersions show stopper");
|
|
|
3837 |
}
|
|
|
3838 |
}
|
|
|
3839 |
}
|
|
|
3840 |
|
|
|
3841 |
/**only used in daemon mode
|
| 818 |
mhunt |
3842 |
* update
|
|
|
3843 |
* (
|
| 882 |
mhunt |
3844 |
* select current_pkg_id_being_built from release_manager.run_level
|
| 818 |
mhunt |
3845 |
* where rcon_id=<rcon_id>
|
|
|
3846 |
* )
|
|
|
3847 |
* set current_pkg_id_being_built=null
|
|
|
3848 |
*/
|
|
|
3849 |
public void clearCurrentPackageBeingBuilt(int rcon_id) throws SQLException, Exception
|
|
|
3850 |
{
|
|
|
3851 |
mLogger.debug("clearCurrentPackageBeingBuilt " + rcon_id);
|
|
|
3852 |
if ( mUseDatabase )
|
|
|
3853 |
{
|
|
|
3854 |
try
|
|
|
3855 |
{
|
| 820 |
mhunt |
3856 |
connect();
|
| 882 |
mhunt |
3857 |
|
|
|
3858 |
if ( isRconIdConfigured( rcon_id ))
|
|
|
3859 |
{
|
|
|
3860 |
CallableStatement stmt4 = mConnection.prepareCall(
|
|
|
3861 |
"update " +
|
|
|
3862 |
"(" +
|
|
|
3863 |
"select current_pkg_id_being_built from release_manager.run_level " +
|
|
|
3864 |
"where rcon_id=" + rcon_id +
|
|
|
3865 |
")" +
|
|
|
3866 |
"set current_pkg_id_being_built=null" );
|
|
|
3867 |
stmt4.executeUpdate();
|
|
|
3868 |
stmt4.close();
|
| 898 |
mhunt |
3869 |
commit();
|
| 882 |
mhunt |
3870 |
}
|
| 818 |
mhunt |
3871 |
}
|
|
|
3872 |
catch ( SQLException e )
|
|
|
3873 |
{
|
|
|
3874 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3875 |
{
|
|
|
3876 |
mLogger.error("clearCurrentPackageBeingBuilt database access error only");
|
|
|
3877 |
throw new SQLException();
|
|
|
3878 |
}
|
|
|
3879 |
else
|
|
|
3880 |
{
|
|
|
3881 |
mLogger.fatal("clearCurrentPackageBeingBuilt show stopper");
|
| 868 |
mhunt |
3882 |
throw new Exception("clearCurrentPackageBeingBuilt show stopper");
|
| 818 |
mhunt |
3883 |
}
|
|
|
3884 |
}
|
| 898 |
mhunt |
3885 |
finally
|
|
|
3886 |
{
|
|
|
3887 |
// this block is executed regardless of what happens in the try block
|
|
|
3888 |
// even if an exception is thrown
|
|
|
3889 |
// ensure disconnect
|
|
|
3890 |
disconnect();
|
|
|
3891 |
}
|
| 818 |
mhunt |
3892 |
}
|
|
|
3893 |
}
|
|
|
3894 |
|
| 814 |
mhunt |
3895 |
/**handles database connection/disconnection
|
|
|
3896 |
* executes the AutoMakeRelease stored procedure with the passed parameters
|
|
|
3897 |
*/
|
| 2541 |
dpurdie |
3898 |
public boolean autoMakeRelease(String rtagId,
|
| 924 |
dpurdie |
3899 |
String packageName,
|
| 814 |
mhunt |
3900 |
String packageExtension,
|
| 924 |
dpurdie |
3901 |
String packageVersion,
|
|
|
3902 |
String packageVcsTag,
|
|
|
3903 |
String packageDepends,
|
|
|
3904 |
String isRipple) throws SQLException, Exception
|
| 814 |
mhunt |
3905 |
{
|
| 2541 |
dpurdie |
3906 |
mAutoMakeReleaseCause = null;
|
| 814 |
mhunt |
3907 |
mLogger.debug("autoMakeRelease " + packageName);
|
|
|
3908 |
if ( mUseDatabase )
|
|
|
3909 |
{
|
|
|
3910 |
try
|
|
|
3911 |
{
|
|
|
3912 |
connect();
|
| 924 |
dpurdie |
3913 |
CallableStatement stmt = mConnection.prepareCall( "begin ? := PK_RMAPI.AUTO_MAKE_VCSRELEASE(?,?,?,?,?,?,?,?); end;" );
|
| 814 |
mhunt |
3914 |
stmt.registerOutParameter( 1, Types.INTEGER);
|
|
|
3915 |
stmt.setString( 2, rtagId );
|
|
|
3916 |
stmt.setString( 3, packageName );
|
|
|
3917 |
stmt.setString( 4, packageExtension );
|
|
|
3918 |
stmt.setString( 5, packageVersion );
|
| 924 |
dpurdie |
3919 |
stmt.setString( 6, packageVcsTag );
|
| 814 |
mhunt |
3920 |
stmt.setString( 7, packageDepends );
|
|
|
3921 |
stmt.setString( 8, isRipple );
|
|
|
3922 |
stmt.setString( 9, "buildadm" );
|
|
|
3923 |
stmt.executeUpdate();
|
|
|
3924 |
int result = stmt.getInt( 1 );
|
| 2541 |
dpurdie |
3925 |
|
|
|
3926 |
//
|
|
|
3927 |
// Return values
|
|
|
3928 |
// >0 PVID of package
|
|
|
3929 |
// -1 Package not found
|
|
|
3930 |
// -2 Package already exists
|
|
|
3931 |
// -3 Not approved for auto build
|
|
|
3932 |
// -4 Package Migrated to SVN being built from CC tag
|
|
|
3933 |
// Sql Application Errors cause an SQLException
|
|
|
3934 |
// Rtagid is NULL
|
|
|
3935 |
// No Package Name
|
|
|
3936 |
// No Package Version
|
|
|
3937 |
// No Package VCS
|
|
|
3938 |
// Bad IsRipple value
|
|
|
3939 |
// No User Name
|
|
|
3940 |
// Malformed VCS Tag
|
|
|
3941 |
// Database missing VCS tag
|
|
|
3942 |
// Invalid UserName
|
|
|
3943 |
//
|
|
|
3944 |
|
|
|
3945 |
//
|
|
|
3946 |
// Report per-package errors directly
|
|
|
3947 |
// Exceptions are for errors that need to halt the entire system
|
|
|
3948 |
//
|
|
|
3949 |
if ( result <= 0 )
|
| 814 |
mhunt |
3950 |
{
|
| 2541 |
dpurdie |
3951 |
mLogger.fatal("autoMakeRelease PK_RMAPI.AUTO_MAKE_RELEASE failed, returned " + result);
|
|
|
3952 |
if ( result == -4 ) {
|
|
|
3953 |
mAutoMakeReleaseCause = "Package migrated to SVN being built from CC tag";
|
|
|
3954 |
} else if ( result == -3 ) {
|
|
|
3955 |
mAutoMakeReleaseCause = "Package not approved for autobuild";
|
|
|
3956 |
} else if ( result == -2 ) {
|
|
|
3957 |
// This is OK
|
|
|
3958 |
} else {
|
|
|
3959 |
// Don't know this error - so its fatal
|
|
|
3960 |
throw new Exception("autoMakeRelease show stopper PK_RMAPI.AUTO_MAKE_RELEASE failed, returned " + result);
|
|
|
3961 |
}
|
| 814 |
mhunt |
3962 |
}
|
| 844 |
dpurdie |
3963 |
stmt.close();
|
| 898 |
mhunt |
3964 |
commit();
|
| 814 |
mhunt |
3965 |
}
|
|
|
3966 |
catch( SQLException e )
|
|
|
3967 |
{
|
|
|
3968 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
3969 |
{
|
|
|
3970 |
mLogger.error("autoMakeRelease database access error only");
|
|
|
3971 |
throw new SQLException();
|
|
|
3972 |
}
|
|
|
3973 |
else
|
| 2541 |
dpurdie |
3974 |
|
| 814 |
mhunt |
3975 |
{
|
|
|
3976 |
mLogger.fatal("autoMakeRelease show stopper");
|
| 868 |
mhunt |
3977 |
throw new Exception("autoMakeRelease show stopper");
|
| 814 |
mhunt |
3978 |
}
|
|
|
3979 |
}
|
| 898 |
mhunt |
3980 |
finally
|
|
|
3981 |
{
|
|
|
3982 |
// this block is executed regardless of what happens in the try block
|
|
|
3983 |
// even if an exception is thrown
|
|
|
3984 |
// ensure disconnect
|
|
|
3985 |
disconnect();
|
|
|
3986 |
}
|
| 814 |
mhunt |
3987 |
}
|
| 2541 |
dpurdie |
3988 |
|
|
|
3989 |
return (mAutoMakeReleaseCause != null);
|
| 814 |
mhunt |
3990 |
}
|
|
|
3991 |
|
|
|
3992 |
/**handles database connection/disconnection
|
| 834 |
mhunt |
3993 |
* executes the insertPackageMetrics stored procedure with the passed parameters
|
|
|
3994 |
*/
|
|
|
3995 |
public void insertPackageMetrics(String rtagId, String packageName,
|
|
|
3996 |
String packageExtension, String metrics) throws SQLException, Exception
|
|
|
3997 |
{
|
|
|
3998 |
mLogger.debug("insertPackageMetrics " + packageName);
|
|
|
3999 |
if ( mUseDatabase )
|
|
|
4000 |
{
|
|
|
4001 |
try
|
|
|
4002 |
{
|
|
|
4003 |
connect();
|
|
|
4004 |
CallableStatement stmt = mConnection.prepareCall( "begin ? := PK_RMAPI.INSERT_PACKAGE_METRICS(?,?,?,?); end;" );
|
|
|
4005 |
stmt.registerOutParameter( 1, Types.INTEGER);
|
|
|
4006 |
stmt.setString( 2, rtagId );
|
|
|
4007 |
stmt.setString( 3, packageName );
|
|
|
4008 |
stmt.setString( 4, packageExtension );
|
|
|
4009 |
stmt.setString( 5, metrics );
|
|
|
4010 |
stmt.executeUpdate();
|
|
|
4011 |
int result = stmt.getInt( 1 );
|
|
|
4012 |
|
| 836 |
mhunt |
4013 |
if ( result != 0 )
|
| 834 |
mhunt |
4014 |
{
|
|
|
4015 |
// flag build failure
|
|
|
4016 |
mLogger.fatal("insertPackageMetrics show stopper PK_RMAPI.INSERT_PACKAGE_METRICS failed, returned" + result);
|
| 868 |
mhunt |
4017 |
throw new Exception("insertPackageMetrics show stopper PK_RMAPI.INSERT_PACKAGE_METRICS failed, returned" + result);
|
| 834 |
mhunt |
4018 |
}
|
| 844 |
dpurdie |
4019 |
stmt.close();
|
| 898 |
mhunt |
4020 |
commit();
|
| 834 |
mhunt |
4021 |
}
|
|
|
4022 |
catch( SQLException e )
|
|
|
4023 |
{
|
|
|
4024 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4025 |
{
|
|
|
4026 |
mLogger.error("insertPackageMetrics database access error only");
|
|
|
4027 |
throw new SQLException();
|
|
|
4028 |
}
|
|
|
4029 |
else
|
|
|
4030 |
{
|
|
|
4031 |
mLogger.fatal("insertPackageMetrics show stopper");
|
| 868 |
mhunt |
4032 |
throw new Exception("insertPackageMetrics show stopper");
|
| 834 |
mhunt |
4033 |
}
|
|
|
4034 |
}
|
| 898 |
mhunt |
4035 |
finally
|
|
|
4036 |
{
|
|
|
4037 |
// this block is executed regardless of what happens in the try block
|
|
|
4038 |
// even if an exception is thrown
|
|
|
4039 |
// ensure disconnect
|
|
|
4040 |
disconnect();
|
|
|
4041 |
}
|
| 834 |
mhunt |
4042 |
}
|
|
|
4043 |
}
|
|
|
4044 |
|
| 900 |
mhunt |
4045 |
/**attempts to execute the Exclude_Indirect_From_Build stored procedure
|
|
|
4046 |
* NB Execute_Indirect_From_Build will delete matching do_not_ripple rows prior to an insertion
|
|
|
4047 |
* this is crucial!!
|
|
|
4048 |
*
|
|
|
4049 |
* parameters:
|
|
|
4050 |
* packageVersionId IN passed to Exclude_Indirect_From_Build
|
|
|
4051 |
* packageVersion IN passed to Exclude_Indirect_From_Build
|
|
|
4052 |
* rtagId IN passed to Exclude_Indirect_From_Build
|
|
|
4053 |
* rootPvId IN passed to Exclude_Indirect_From_Build
|
|
|
4054 |
* rootCause IN passed to Exclude_Indirect_From_Build
|
|
|
4055 |
* rootFile IN passed to Exclude_Indirect_From_Build
|
|
|
4056 |
* supercede IN checks for a row with a matching packageVersionId and rtagId when false
|
|
|
4057 |
* such a row will prevent the execution of Exclude_Indirect_From_Build
|
| 908 |
mhunt |
4058 |
* testBuildInstruction IN will prevent the execution of Exclude_Indirect_From_Build when > 0
|
| 900 |
mhunt |
4059 |
*
|
|
|
4060 |
* returns:
|
|
|
4061 |
* none
|
| 814 |
mhunt |
4062 |
*/
|
|
|
4063 |
public void excludeFromBuild(String packageVersionId,
|
| 866 |
mhunt |
4064 |
String packageVersion, String rtagId, String rootPvId,
|
| 908 |
mhunt |
4065 |
String rootCause, String rootFile,
|
|
|
4066 |
boolean supercede, int testBuildInstruction) throws SQLException, Exception
|
| 814 |
mhunt |
4067 |
{
|
|
|
4068 |
mLogger.debug("excludeFromBuild " + packageVersionId);
|
| 908 |
mhunt |
4069 |
if ( testBuildInstruction > 0 )
|
|
|
4070 |
{
|
|
|
4071 |
return;
|
|
|
4072 |
}
|
|
|
4073 |
|
| 814 |
mhunt |
4074 |
if ( mUseDatabase )
|
|
|
4075 |
{
|
|
|
4076 |
try
|
|
|
4077 |
{
|
| 908 |
mhunt |
4078 |
connect();
|
| 898 |
mhunt |
4079 |
|
| 896 |
mhunt |
4080 |
boolean exist = false;
|
|
|
4081 |
|
| 900 |
mhunt |
4082 |
if ( !supercede )
|
| 814 |
mhunt |
4083 |
{
|
| 900 |
mhunt |
4084 |
// do not exclude a package already excluded ie let the first build failure count
|
|
|
4085 |
// there is a window of opportunity here, but it is worth doing
|
|
|
4086 |
// scenario 1
|
|
|
4087 |
// 1 this query indicates no build failure exists on this version
|
|
|
4088 |
// 2 another build machine reports a build failure on this version
|
|
|
4089 |
// 3 this is then overridden by this thread
|
|
|
4090 |
// does not matter
|
|
|
4091 |
// doing this works well for the following
|
|
|
4092 |
// scenario 2
|
|
|
4093 |
// 1 this query (run by a slave) indicates no build failure exists on this version
|
|
|
4094 |
// 2 build failure is reported
|
|
|
4095 |
// 3 master build machine detects slave in state waiting
|
|
|
4096 |
// 4 master daemon discovers slave did not deliver artifacts
|
|
|
4097 |
// 5 master daemon is prevented from overriding the build failure
|
|
|
4098 |
CallableStatement stmt = mConnection.prepareCall("select pv_id from release_manager.do_not_ripple where pv_id=" + packageVersionId + "and rtag_id=" + rtagId);
|
|
|
4099 |
ResultSet rset = stmt.executeQuery();
|
|
|
4100 |
|
|
|
4101 |
while( rset.next() )
|
|
|
4102 |
{
|
|
|
4103 |
exist = true;
|
|
|
4104 |
break;
|
|
|
4105 |
}
|
|
|
4106 |
|
|
|
4107 |
rset.close();
|
|
|
4108 |
stmt.close();
|
| 814 |
mhunt |
4109 |
}
|
| 896 |
mhunt |
4110 |
|
|
|
4111 |
if ( !exist )
|
|
|
4112 |
{
|
| 900 |
mhunt |
4113 |
CallableStatement stmt = mConnection.prepareCall( "begin ? := PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD(?,?,?,?,?,?,?); end;" );
|
| 896 |
mhunt |
4114 |
stmt.registerOutParameter( 1, Types.INTEGER);
|
|
|
4115 |
stmt.setString( 2, packageVersionId );
|
|
|
4116 |
stmt.setString( 3, packageVersion );
|
|
|
4117 |
stmt.setString( 4, rtagId );
|
|
|
4118 |
stmt.setString( 5, "buildadm" );
|
|
|
4119 |
stmt.setString( 6, rootPvId);
|
|
|
4120 |
stmt.setString( 7, rootCause);
|
|
|
4121 |
stmt.setString( 8, rootFile);
|
|
|
4122 |
stmt.executeUpdate();
|
|
|
4123 |
int result = stmt.getInt( 1 );
|
|
|
4124 |
|
|
|
4125 |
if ( result != 0 )
|
|
|
4126 |
{
|
|
|
4127 |
// flag build failure
|
|
|
4128 |
mLogger.fatal( "excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result );
|
|
|
4129 |
throw new Exception("excludeFromBuild show stopper PK_RMAPI.EXCLUDE_INDIRECT_FROM_BUILD failed, returned " + result);
|
|
|
4130 |
}
|
|
|
4131 |
stmt.close();
|
| 908 |
mhunt |
4132 |
commit();
|
| 896 |
mhunt |
4133 |
}
|
| 814 |
mhunt |
4134 |
}
|
|
|
4135 |
catch( SQLException e )
|
|
|
4136 |
{
|
|
|
4137 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4138 |
{
|
|
|
4139 |
mLogger.error("excludeFromBuild database access error only");
|
|
|
4140 |
throw new SQLException();
|
|
|
4141 |
}
|
|
|
4142 |
else
|
|
|
4143 |
{
|
|
|
4144 |
mLogger.fatal("excludeFromBuild show stopper");
|
| 868 |
mhunt |
4145 |
throw new Exception("excludeFromBuild show stopper");
|
| 814 |
mhunt |
4146 |
}
|
|
|
4147 |
}
|
| 898 |
mhunt |
4148 |
finally
|
|
|
4149 |
{
|
|
|
4150 |
// this block is executed regardless of what happens in the try block
|
|
|
4151 |
// even if an exception is thrown
|
|
|
4152 |
// ensure disconnect
|
| 908 |
mhunt |
4153 |
disconnect();
|
|
|
4154 |
}
|
|
|
4155 |
}
|
|
|
4156 |
}
|
|
|
4157 |
|
|
|
4158 |
/**executes the get_daemon_inst function with the passed parameters
|
|
|
4159 |
* returns true when an instruction exists
|
|
|
4160 |
*/
|
|
|
4161 |
private boolean getDaemonInst(final int rtagId, MutableInt instruction,
|
|
|
4162 |
final int opCode, MutableInt pvId, MutableInt userId ) throws SQLException, Exception
|
|
|
4163 |
{
|
|
|
4164 |
mLogger.debug("getDaemonInst " + instruction);
|
|
|
4165 |
boolean retVal = false;
|
|
|
4166 |
|
|
|
4167 |
if ( mUseDatabase )
|
|
|
4168 |
{
|
|
|
4169 |
try
|
|
|
4170 |
{
|
|
|
4171 |
CallableStatement stmt = mConnection.prepareCall( "begin ? := PK_BUILDAPI.GET_DAEMON_INST(?,?,?,?,?,?); end;" );
|
|
|
4172 |
stmt.registerOutParameter(1, Types.INTEGER);
|
|
|
4173 |
stmt.registerOutParameter(3, Types.INTEGER);
|
|
|
4174 |
stmt.registerOutParameter(4, Types.INTEGER);
|
|
|
4175 |
stmt.registerOutParameter(5, Types.INTEGER);
|
|
|
4176 |
stmt.registerOutParameter(6, Types.INTEGER);
|
|
|
4177 |
stmt.registerOutParameter(7, Types.INTEGER);
|
|
|
4178 |
stmt.setInt(2, rtagId );
|
|
|
4179 |
stmt.setInt( 3, instruction.value );
|
|
|
4180 |
stmt.setInt( 4, opCode );
|
|
|
4181 |
stmt.execute();
|
|
|
4182 |
int result = stmt.getInt( 1 );
|
|
|
4183 |
|
|
|
4184 |
if ( result == 1 )
|
| 898 |
mhunt |
4185 |
{
|
| 908 |
mhunt |
4186 |
retVal = true;
|
|
|
4187 |
instruction.value = stmt.getInt( 3 );
|
|
|
4188 |
pvId.value = stmt.getInt( 5 );
|
|
|
4189 |
userId.value = stmt.getInt( 6 );
|
| 898 |
mhunt |
4190 |
}
|
| 908 |
mhunt |
4191 |
|
|
|
4192 |
stmt.close();
|
| 898 |
mhunt |
4193 |
}
|
| 908 |
mhunt |
4194 |
catch( SQLException e )
|
|
|
4195 |
{
|
|
|
4196 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4197 |
{
|
|
|
4198 |
mLogger.error("getDaemonInst database access error only");
|
|
|
4199 |
throw new SQLException();
|
|
|
4200 |
}
|
|
|
4201 |
else
|
|
|
4202 |
{
|
|
|
4203 |
mLogger.fatal("getDaemonInst show stopper");
|
|
|
4204 |
throw new Exception("getDaemonInst show stopper");
|
|
|
4205 |
}
|
|
|
4206 |
}
|
| 814 |
mhunt |
4207 |
}
|
| 908 |
mhunt |
4208 |
|
|
|
4209 |
return retVal;
|
| 814 |
mhunt |
4210 |
}
|
|
|
4211 |
|
| 908 |
mhunt |
4212 |
/**executes the mark_daemon_inst_in_progress function with the passed parameters
|
|
|
4213 |
*/
|
|
|
4214 |
public void markDaemonInstInProgress(final int instruction) throws SQLException, Exception
|
|
|
4215 |
{
|
|
|
4216 |
mLogger.debug("markDaemonInstInProgress " + instruction);
|
|
|
4217 |
|
|
|
4218 |
if ( mUseDatabase )
|
|
|
4219 |
{
|
|
|
4220 |
try
|
|
|
4221 |
{
|
|
|
4222 |
CallableStatement stmt = mConnection.prepareCall( "call PK_BUILDAPI.MARK_DAEMON_INST_IN_PROGRESS(?)" );
|
|
|
4223 |
stmt.setInt( 1, instruction );
|
|
|
4224 |
stmt.executeUpdate();
|
|
|
4225 |
stmt.close();
|
|
|
4226 |
}
|
|
|
4227 |
catch( SQLException e )
|
|
|
4228 |
{
|
|
|
4229 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4230 |
{
|
|
|
4231 |
mLogger.error("markDaemonInstInProgress database access error only");
|
|
|
4232 |
throw new SQLException();
|
|
|
4233 |
}
|
|
|
4234 |
else
|
|
|
4235 |
{
|
|
|
4236 |
mLogger.fatal("markDaemonInstInProgress show stopper");
|
|
|
4237 |
throw new Exception("markDaemonInstInProgress show stopper");
|
|
|
4238 |
}
|
|
|
4239 |
}
|
|
|
4240 |
}
|
|
|
4241 |
}
|
|
|
4242 |
|
|
|
4243 |
/**executes the mark_daemon_inst_completed function with the passed parameters
|
|
|
4244 |
*/
|
|
|
4245 |
public void markDaemonInstCompleted(final int instruction) throws SQLException, Exception
|
|
|
4246 |
{
|
|
|
4247 |
mLogger.debug("markDaemonInstCompleted " + instruction);
|
|
|
4248 |
|
|
|
4249 |
if ( mUseDatabase )
|
|
|
4250 |
{
|
|
|
4251 |
try
|
|
|
4252 |
{
|
|
|
4253 |
CallableStatement stmt = mConnection.prepareCall( "call PK_BUILDAPI.MARK_DAEMON_INST_COMPLETED(?)" );
|
|
|
4254 |
stmt.setInt( 1, instruction );
|
|
|
4255 |
stmt.executeUpdate();
|
|
|
4256 |
stmt.close();
|
|
|
4257 |
}
|
|
|
4258 |
catch( SQLException e )
|
|
|
4259 |
{
|
|
|
4260 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4261 |
{
|
|
|
4262 |
mLogger.error("markDaemonInstCompleted database access error only");
|
|
|
4263 |
throw new SQLException();
|
|
|
4264 |
}
|
|
|
4265 |
else
|
|
|
4266 |
{
|
|
|
4267 |
mLogger.fatal("markDaemonInstCompleted show stopper");
|
|
|
4268 |
throw new Exception("markDaemonInstCompleted show stopper");
|
|
|
4269 |
}
|
|
|
4270 |
}
|
|
|
4271 |
}
|
|
|
4272 |
}
|
|
|
4273 |
|
|
|
4274 |
/**handles database connection/disconnection
|
|
|
4275 |
* executes the mark_daemon_inst_completed function with the passed parameters
|
|
|
4276 |
*/
|
|
|
4277 |
public void markDaemonInstCompletedConnect(final int instruction) throws SQLException, Exception
|
|
|
4278 |
{
|
|
|
4279 |
mLogger.debug("markDaemonInstCompletedConnect " + instruction);
|
|
|
4280 |
|
|
|
4281 |
try
|
|
|
4282 |
{
|
|
|
4283 |
connect();
|
|
|
4284 |
markDaemonInstCompleted(instruction);
|
|
|
4285 |
commit();
|
|
|
4286 |
}
|
|
|
4287 |
catch( SQLException e )
|
|
|
4288 |
{
|
|
|
4289 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4290 |
{
|
|
|
4291 |
mLogger.error("markDaemonInstCompletedConnect database access error only");
|
|
|
4292 |
throw new SQLException();
|
|
|
4293 |
}
|
|
|
4294 |
else
|
|
|
4295 |
{
|
|
|
4296 |
mLogger.fatal("markDaemonInstCompletedConnect show stopper");
|
|
|
4297 |
throw new Exception("markDaemonInstCompletedConnect show stopper");
|
|
|
4298 |
}
|
|
|
4299 |
}
|
|
|
4300 |
finally
|
|
|
4301 |
{
|
|
|
4302 |
// this block is executed regardless of what happens in the try block
|
|
|
4303 |
// even if an exception is thrown
|
|
|
4304 |
// ensure disconnect
|
|
|
4305 |
disconnect();
|
|
|
4306 |
}
|
|
|
4307 |
}
|
|
|
4308 |
|
| 866 |
mhunt |
4309 |
/**removes an excluded package from the do_not_ripple table
|
|
|
4310 |
*/
|
|
|
4311 |
public void includeToBuild(String packageVersionId, String rtagId) throws SQLException, Exception
|
|
|
4312 |
{
|
|
|
4313 |
mLogger.debug("includeToBuild " + packageVersionId);
|
|
|
4314 |
if ( mUseDatabase )
|
|
|
4315 |
{
|
|
|
4316 |
try
|
|
|
4317 |
{
|
|
|
4318 |
CallableStatement stmt = mConnection.prepareCall("delete from release_manager.do_not_ripple where rtag_id=" + rtagId + " and pv_id=" + packageVersionId);
|
|
|
4319 |
stmt.executeUpdate();
|
|
|
4320 |
stmt.close();
|
|
|
4321 |
}
|
|
|
4322 |
catch( SQLException e )
|
|
|
4323 |
{
|
|
|
4324 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4325 |
{
|
|
|
4326 |
mLogger.error("includeToBuild database access error only");
|
|
|
4327 |
throw new SQLException();
|
|
|
4328 |
}
|
|
|
4329 |
else
|
|
|
4330 |
{
|
|
|
4331 |
mLogger.fatal("includeToBuild show stopper");
|
| 868 |
mhunt |
4332 |
throw new Exception("includeToBuild show stopper");
|
| 866 |
mhunt |
4333 |
}
|
|
|
4334 |
}
|
|
|
4335 |
}
|
|
|
4336 |
}
|
|
|
4337 |
|
| 814 |
mhunt |
4338 |
/**Representation of a row in the RELEASE_CONFIG table
|
|
|
4339 |
*/
|
|
|
4340 |
private class ReleaseConfig
|
|
|
4341 |
{
|
|
|
4342 |
/**rtag_id column value
|
|
|
4343 |
* @attribute
|
|
|
4344 |
*/
|
|
|
4345 |
private int mRtag_id;
|
|
|
4346 |
|
|
|
4347 |
/**rcon_id column value
|
|
|
4348 |
* @attribute
|
|
|
4349 |
*/
|
|
|
4350 |
private int mRcon_id;
|
|
|
4351 |
|
|
|
4352 |
/**daemon_mode column value
|
|
|
4353 |
* @attribute
|
|
|
4354 |
*/
|
|
|
4355 |
private char mDaemon_mode;
|
|
|
4356 |
|
|
|
4357 |
/**constructor
|
|
|
4358 |
*/
|
| 896 |
mhunt |
4359 |
ReleaseConfig(int rtag_id, int rcon_id, char daemon_mode)
|
| 814 |
mhunt |
4360 |
{
|
| 896 |
mhunt |
4361 |
mLogger.debug("ReleaseConfig rtag_id " + rtag_id + " rcon_id " + rcon_id + " daemon_mode " + daemon_mode );
|
| 814 |
mhunt |
4362 |
mRtag_id = rtag_id;
|
|
|
4363 |
mRcon_id = rcon_id;
|
|
|
4364 |
mDaemon_mode = daemon_mode;
|
|
|
4365 |
}
|
|
|
4366 |
|
|
|
4367 |
/**accessor method
|
|
|
4368 |
*/
|
|
|
4369 |
int get_rtag_id()
|
|
|
4370 |
{
|
|
|
4371 |
mLogger.debug("get_rtag_id");
|
|
|
4372 |
mLogger.info("get_rtag_id returned " + mRtag_id);
|
|
|
4373 |
return mRtag_id;
|
|
|
4374 |
}
|
|
|
4375 |
|
|
|
4376 |
/**accessor method
|
|
|
4377 |
*/
|
|
|
4378 |
int get_rcon_id()
|
|
|
4379 |
{
|
|
|
4380 |
mLogger.debug("get_rcon_id");
|
|
|
4381 |
mLogger.info("get_rcon_id returned " + mRcon_id);
|
|
|
4382 |
return mRcon_id;
|
|
|
4383 |
}
|
|
|
4384 |
|
|
|
4385 |
/**accessor method
|
|
|
4386 |
*/
|
|
|
4387 |
char get_daemon_mode()
|
|
|
4388 |
{
|
|
|
4389 |
mLogger.debug("get_daemon_mode");
|
|
|
4390 |
mLogger.info("get_daemon_mode returned " + mDaemon_mode);
|
|
|
4391 |
return mDaemon_mode;
|
|
|
4392 |
}
|
|
|
4393 |
}
|
|
|
4394 |
|
|
|
4395 |
/**Representation of a row in the RUN_LEVEL table
|
|
|
4396 |
*/
|
|
|
4397 |
private class RunLevel
|
|
|
4398 |
{
|
|
|
4399 |
/**rcon_id column value
|
|
|
4400 |
* @attribute
|
|
|
4401 |
*/
|
|
|
4402 |
private int mRcon_id;
|
|
|
4403 |
|
|
|
4404 |
/**current_build_files column value
|
|
|
4405 |
* @attribute
|
|
|
4406 |
*/
|
|
|
4407 |
private String mCurrent_build_file;
|
|
|
4408 |
|
|
|
4409 |
/**current_run_level column value
|
|
|
4410 |
* @attribute
|
|
|
4411 |
*/
|
|
|
4412 |
private int mCurrent_run_level;
|
|
|
4413 |
|
|
|
4414 |
/**pause column value
|
|
|
4415 |
* @attribute
|
|
|
4416 |
*/
|
|
|
4417 |
private boolean mPause;
|
|
|
4418 |
|
|
|
4419 |
/**constructor
|
|
|
4420 |
*/
|
|
|
4421 |
RunLevel(int rcon_id, String current_build_file, int current_run_level,
|
|
|
4422 |
boolean pause)
|
|
|
4423 |
{
|
|
|
4424 |
mLogger.debug("RunLevel");
|
|
|
4425 |
mRcon_id = rcon_id;
|
|
|
4426 |
mCurrent_build_file = current_build_file;
|
|
|
4427 |
mCurrent_run_level = current_run_level;
|
|
|
4428 |
mPause = pause;
|
|
|
4429 |
}
|
|
|
4430 |
|
|
|
4431 |
/**accessor method
|
|
|
4432 |
*/
|
|
|
4433 |
int get_rcon_id()
|
|
|
4434 |
{
|
|
|
4435 |
mLogger.debug("get_rcon_id");
|
|
|
4436 |
mLogger.info("get_rcon_id returned " + mRcon_id);
|
|
|
4437 |
return mRcon_id;
|
|
|
4438 |
}
|
|
|
4439 |
|
|
|
4440 |
/**accessor method
|
|
|
4441 |
*/
|
|
|
4442 |
String get_current_build_file()
|
|
|
4443 |
{
|
|
|
4444 |
mLogger.debug("get_current_build_file");
|
|
|
4445 |
mLogger.info("get_current_build_file returned " + mCurrent_build_file);
|
|
|
4446 |
return mCurrent_build_file;
|
|
|
4447 |
}
|
|
|
4448 |
|
|
|
4449 |
/**accessor method
|
|
|
4450 |
*/
|
|
|
4451 |
int get_current_run_level()
|
|
|
4452 |
{
|
|
|
4453 |
mLogger.debug("get_current_run_level");
|
|
|
4454 |
mLogger.info("get_current_run_level returned " + mCurrent_run_level);
|
|
|
4455 |
return mCurrent_run_level;
|
|
|
4456 |
}
|
|
|
4457 |
|
|
|
4458 |
/**accessor method
|
|
|
4459 |
*/
|
|
|
4460 |
boolean get_pause()
|
|
|
4461 |
{
|
|
|
4462 |
mLogger.debug("get_pause");
|
|
|
4463 |
mLogger.debug("get_pause returned " + mPause);
|
|
|
4464 |
return mPause;
|
|
|
4465 |
}
|
|
|
4466 |
|
|
|
4467 |
}
|
|
|
4468 |
|
|
|
4469 |
/**constructor
|
|
|
4470 |
*/
|
|
|
4471 |
public ReleaseManager(final String connectionString, final String username,
|
|
|
4472 |
final String password)
|
|
|
4473 |
{
|
|
|
4474 |
mLogger.debug("ReleaseManager " + connectionString);
|
|
|
4475 |
mConnectionString = connectionString;
|
|
|
4476 |
mUsername = username;
|
|
|
4477 |
mPassword = password;
|
| 924 |
dpurdie |
4478 |
|
|
|
4479 |
String gbeBtDebug = System.getenv("GBE_BUILDTOOL_DEBUG");
|
|
|
4480 |
if ( gbeBtDebug != null )
|
|
|
4481 |
{
|
|
|
4482 |
mLogger.fatal("GBE_BUILDTOOL_DEBUG set - Use of database mutex supressed");
|
|
|
4483 |
mUseMutex = false;
|
|
|
4484 |
}
|
| 814 |
mhunt |
4485 |
}
|
|
|
4486 |
|
|
|
4487 |
/**constructor used when schema information is unknown eg location, username, password
|
|
|
4488 |
*/
|
|
|
4489 |
public ReleaseManager()
|
|
|
4490 |
{
|
|
|
4491 |
// inherit mConnectionString, mUsername, mPassword
|
|
|
4492 |
mLogger.debug("ReleaseManager");
|
|
|
4493 |
}
|
|
|
4494 |
|
|
|
4495 |
/**connect to oracle
|
|
|
4496 |
*/
|
|
|
4497 |
public void connect() throws SQLException, Exception
|
|
|
4498 |
{
|
|
|
4499 |
mLogger.debug("connect");
|
| 920 |
mhunt |
4500 |
mNonPlanningConnection = connect( mSession, mNonPlanningConnection );
|
| 918 |
mhunt |
4501 |
}
|
|
|
4502 |
|
|
|
4503 |
/**connect to oracle
|
|
|
4504 |
*/
|
|
|
4505 |
public void connectForPlanning( boolean priority ) throws SQLException, Exception
|
|
|
4506 |
{
|
|
|
4507 |
mLogger.debug("connectForPlanning");
|
|
|
4508 |
|
|
|
4509 |
if ( !priority )
|
| 898 |
mhunt |
4510 |
{
|
| 918 |
mhunt |
4511 |
// limit only one thread with a low priority build requirement to connect
|
|
|
4512 |
if ( mLowPriorityQueue.isHeldByCurrentThread() )
|
|
|
4513 |
{
|
|
|
4514 |
// by design a thread must NOT connect multiple times
|
|
|
4515 |
// this is to ensure the lock is claimed only once
|
|
|
4516 |
mLogger.error("connectForPlanning thread already has the lock");
|
|
|
4517 |
}
|
|
|
4518 |
else
|
|
|
4519 |
{
|
|
|
4520 |
mLogger.warn("connectForPlanning calling lock");
|
|
|
4521 |
mLowPriorityQueue.lock();
|
|
|
4522 |
mLogger.warn("connectForPlanning called lock");
|
|
|
4523 |
}
|
|
|
4524 |
}
|
|
|
4525 |
|
|
|
4526 |
// threads with a high priority build requirement are not subject to the mLowPriorityQueue
|
| 920 |
mhunt |
4527 |
mPlanningConnection = connect( mPlanningSession, mPlanningConnection );
|
| 918 |
mhunt |
4528 |
}
|
|
|
4529 |
|
|
|
4530 |
/**connect to oracle
|
|
|
4531 |
*/
|
| 920 |
mhunt |
4532 |
private Connection connect( ReentrantLock session, Connection connection ) throws SQLException, Exception
|
| 918 |
mhunt |
4533 |
{
|
|
|
4534 |
mLogger.debug("connect");
|
| 920 |
mhunt |
4535 |
|
|
|
4536 |
try
|
| 918 |
mhunt |
4537 |
{
|
| 920 |
mhunt |
4538 |
if ( session.isHeldByCurrentThread() )
|
|
|
4539 |
{
|
|
|
4540 |
// by design a thread must NOT connect multiple times
|
|
|
4541 |
// this is to ensure the lock is claimed only once
|
|
|
4542 |
mLogger.error("connect thread already has the lock");
|
|
|
4543 |
}
|
|
|
4544 |
else
|
|
|
4545 |
{
|
|
|
4546 |
mLogger.warn("connect calling lock");
|
|
|
4547 |
session.lock();
|
|
|
4548 |
mLogger.warn("connect called lock");
|
|
|
4549 |
}
|
| 838 |
mhunt |
4550 |
|
| 920 |
mhunt |
4551 |
if ( !mUseDatabase )
|
| 814 |
mhunt |
4552 |
{
|
| 920 |
mhunt |
4553 |
mLogger.info("connect !mUseDatabase");
|
|
|
4554 |
}
|
|
|
4555 |
else
|
|
|
4556 |
{
|
|
|
4557 |
// DEVI 46868
|
|
|
4558 |
// loop indefinitely until a connection attempt succeeds
|
|
|
4559 |
// unless the failure is on the first attempt
|
|
|
4560 |
boolean problemConnecting;
|
| 838 |
mhunt |
4561 |
|
| 920 |
mhunt |
4562 |
do
|
| 836 |
mhunt |
4563 |
{
|
| 920 |
mhunt |
4564 |
mLogger.warn("connect check connection");
|
|
|
4565 |
problemConnecting = false;
|
|
|
4566 |
|
| 838 |
mhunt |
4567 |
try
|
|
|
4568 |
{
|
| 920 |
mhunt |
4569 |
if ( connection == null || ( connection != null && !connection.isValid(10) ) )
|
|
|
4570 |
{
|
|
|
4571 |
mLogger.warn("connect calling getConnection");
|
|
|
4572 |
connection = DriverManager.getConnection(mConnectionString, mUsername, mPassword);
|
|
|
4573 |
// when connection to the database is established, the connection, by default, is in auto-commit mode
|
|
|
4574 |
// to adhere to the design in the use of select for update, it is crucial to turn auto-commit off
|
|
|
4575 |
// this also improves performance
|
|
|
4576 |
connection.setAutoCommit(false);
|
|
|
4577 |
}
|
| 838 |
mhunt |
4578 |
}
|
| 920 |
mhunt |
4579 |
catch(SQLException e)
|
| 838 |
mhunt |
4580 |
{
|
| 920 |
mhunt |
4581 |
mLogger.warn("connect determined problem connecting");
|
|
|
4582 |
problemConnecting = true;
|
|
|
4583 |
try
|
|
|
4584 |
{
|
|
|
4585 |
// sleep 30 secs
|
|
|
4586 |
mLogger.warn("connect getConnection failed. sleep 30secs");
|
|
|
4587 |
Thread.sleep(30000);
|
|
|
4588 |
}
|
|
|
4589 |
catch (InterruptedException f)
|
|
|
4590 |
{
|
|
|
4591 |
mLogger.warn("connect caught InterruptedException");
|
|
|
4592 |
}
|
|
|
4593 |
|
|
|
4594 |
if ( connection == null )
|
|
|
4595 |
{
|
|
|
4596 |
// failed on first connection attempt - unlikely due to database loading - likely bad connection parameters
|
|
|
4597 |
throw new SQLException();
|
|
|
4598 |
}
|
| 838 |
mhunt |
4599 |
}
|
| 920 |
mhunt |
4600 |
} while ( problemConnecting );
|
| 2541 |
dpurdie |
4601 |
mLogger.warn("connect checked connection");
|
| 920 |
mhunt |
4602 |
}
|
| 814 |
mhunt |
4603 |
}
|
| 920 |
mhunt |
4604 |
finally
|
|
|
4605 |
{
|
|
|
4606 |
mConnection = connection;
|
| 2541 |
dpurdie |
4607 |
mLogger.warn("connect finally connection");
|
| 920 |
mhunt |
4608 |
}
|
|
|
4609 |
return connection;
|
| 844 |
dpurdie |
4610 |
|
| 814 |
mhunt |
4611 |
}
|
|
|
4612 |
|
|
|
4613 |
/**disconnect from oracle
|
|
|
4614 |
*/
|
| 836 |
mhunt |
4615 |
public void disconnect() throws Exception
|
| 814 |
mhunt |
4616 |
{
|
|
|
4617 |
mLogger.debug("disconnect");
|
| 918 |
mhunt |
4618 |
|
|
|
4619 |
disconnect( mSession );
|
|
|
4620 |
}
|
|
|
4621 |
|
|
|
4622 |
/**disconnect from oracle
|
|
|
4623 |
*/
|
|
|
4624 |
public void disconnectForPlanning( boolean priority ) throws Exception
|
|
|
4625 |
{
|
| 4123 |
dpurdie |
4626 |
mLogger.warn("disconnectForPlanning");
|
| 918 |
mhunt |
4627 |
|
|
|
4628 |
if ( !priority )
|
| 814 |
mhunt |
4629 |
{
|
| 918 |
mhunt |
4630 |
// allow another low priority thread to connect
|
|
|
4631 |
mLowPriorityQueue.unlock();
|
|
|
4632 |
}
|
| 898 |
mhunt |
4633 |
|
| 918 |
mhunt |
4634 |
disconnect( mPlanningSession );
|
|
|
4635 |
}
|
|
|
4636 |
|
|
|
4637 |
/**disconnect from oracle
|
|
|
4638 |
*/
|
|
|
4639 |
private void disconnect( ReentrantLock session ) throws Exception
|
|
|
4640 |
{
|
|
|
4641 |
mLogger.debug("disconnect");
|
|
|
4642 |
|
| 898 |
mhunt |
4643 |
// by design, a thread may call disconnect multiple times
|
|
|
4644 |
// this is a technique used in finally blocks
|
|
|
4645 |
// it is to ensure the lock is released in all cases
|
|
|
4646 |
// only unlock if it is held by this thread
|
|
|
4647 |
// when unlock is called on a ReentrantLock held by this thread
|
|
|
4648 |
// the hold count is decremented
|
|
|
4649 |
// connect should only let the hold count be incremented to 1
|
|
|
4650 |
// when the hold count is 0 the lock is released
|
|
|
4651 |
// and the ReentrantLock is no longer held by this thread
|
|
|
4652 |
// only call unlock when the lock is held by this thread
|
| 918 |
mhunt |
4653 |
if ( session.isHeldByCurrentThread() )
|
| 898 |
mhunt |
4654 |
{
|
|
|
4655 |
mLogger.warn("disconnected calling unlock");
|
| 918 |
mhunt |
4656 |
session.unlock();
|
| 898 |
mhunt |
4657 |
mLogger.warn("disconnected called unlock");
|
|
|
4658 |
}
|
| 814 |
mhunt |
4659 |
}
|
|
|
4660 |
|
|
|
4661 |
/**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id of the first element
|
|
|
4662 |
*/
|
|
|
4663 |
public boolean getFirstReleaseConfig(MutableInt rcon_id)
|
|
|
4664 |
{
|
|
|
4665 |
mLogger.debug("getFirstReleaseConfig 1");
|
|
|
4666 |
boolean retVal = true;
|
|
|
4667 |
|
|
|
4668 |
try
|
|
|
4669 |
{
|
|
|
4670 |
mReleaseConfigIndex = 0;
|
| 864 |
mhunt |
4671 |
ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
|
| 814 |
mhunt |
4672 |
rcon_id.value = rc.get_rcon_id();
|
|
|
4673 |
}
|
|
|
4674 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4675 |
{
|
|
|
4676 |
retVal = false;
|
|
|
4677 |
}
|
|
|
4678 |
|
|
|
4679 |
mLogger.info("getFirstReleaseConfig 1 returning " + retVal);
|
|
|
4680 |
return retVal;
|
|
|
4681 |
}
|
|
|
4682 |
|
|
|
4683 |
/**returns true if the mReleaseConfigCollection is not empty and returns the rcon_id, rtag_id, daemon_mode and gbebuildfilter of the first element
|
|
|
4684 |
*/
|
|
|
4685 |
public boolean getFirstReleaseConfig(MutableInt rtag_id,
|
|
|
4686 |
MutableInt rcon_id,
|
| 896 |
mhunt |
4687 |
MutableChar daemon_mode)
|
| 814 |
mhunt |
4688 |
{
|
|
|
4689 |
mLogger.debug("getFirstReleaseConfig 2");
|
|
|
4690 |
boolean retVal = true;
|
|
|
4691 |
|
|
|
4692 |
try
|
|
|
4693 |
{
|
|
|
4694 |
mReleaseConfigIndex = 0;
|
| 864 |
mhunt |
4695 |
ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
|
| 814 |
mhunt |
4696 |
rtag_id.value = rc.get_rtag_id();
|
|
|
4697 |
rcon_id.value = rc.get_rcon_id();
|
|
|
4698 |
daemon_mode.value = rc.get_daemon_mode();
|
|
|
4699 |
}
|
|
|
4700 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4701 |
{
|
|
|
4702 |
retVal = false;
|
|
|
4703 |
}
|
|
|
4704 |
|
|
|
4705 |
mLogger.info("getFirstReleaseConfig 2 returning " + retVal);
|
|
|
4706 |
return retVal;
|
|
|
4707 |
}
|
|
|
4708 |
|
|
|
4709 |
/**returns true if the mRunLevelCollection is not empty and returns the rcon_id and current_run_level of the first element
|
|
|
4710 |
*/
|
|
|
4711 |
public boolean getFirstRunLevel(MutableInt rcon_id,
|
|
|
4712 |
MutableInt current_run_level)
|
|
|
4713 |
{
|
|
|
4714 |
mLogger.debug("getFirstRunLevel");
|
|
|
4715 |
boolean retVal = true;
|
|
|
4716 |
|
|
|
4717 |
try
|
|
|
4718 |
{
|
|
|
4719 |
mRunLevelIndex = 0;
|
| 864 |
mhunt |
4720 |
RunLevel rl = mRunLevelCollection.get( mRunLevelIndex );
|
| 814 |
mhunt |
4721 |
rcon_id.value = rl.get_rcon_id();
|
|
|
4722 |
current_run_level.value = rl.get_current_run_level();
|
|
|
4723 |
}
|
|
|
4724 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4725 |
{
|
|
|
4726 |
retVal = false;
|
|
|
4727 |
}
|
|
|
4728 |
|
|
|
4729 |
mLogger.info("getFirstRunLevel returning " + retVal);
|
|
|
4730 |
return retVal;
|
|
|
4731 |
}
|
|
|
4732 |
|
|
|
4733 |
/**returns true if the mReleaseConfigCollection contains a next element and returns the rcon_id of the next element
|
|
|
4734 |
*/
|
|
|
4735 |
public boolean getNextReleaseConfig(MutableInt rcon_id)
|
|
|
4736 |
{
|
|
|
4737 |
mLogger.debug("getNextReleaseConfig 1");
|
|
|
4738 |
boolean retVal = true;
|
|
|
4739 |
|
|
|
4740 |
try
|
|
|
4741 |
{
|
|
|
4742 |
mReleaseConfigIndex++;
|
| 864 |
mhunt |
4743 |
ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
|
| 814 |
mhunt |
4744 |
rcon_id.value = rc.get_rcon_id();
|
|
|
4745 |
}
|
|
|
4746 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4747 |
{
|
|
|
4748 |
retVal = false;
|
|
|
4749 |
}
|
|
|
4750 |
|
|
|
4751 |
mLogger.info("getNextReleaseConfig 1 returning " + retVal);
|
|
|
4752 |
return retVal;
|
|
|
4753 |
}
|
|
|
4754 |
|
|
|
4755 |
/**returns true if the mReleaseConfigCollection contains a next element and returns the rcon_id, rtag_id, daemon_mode and gbebuildfilter of the next element
|
|
|
4756 |
*/
|
|
|
4757 |
public boolean getNextReleaseConfig(MutableInt rtag_id,
|
|
|
4758 |
MutableInt rcon_id,
|
| 896 |
mhunt |
4759 |
MutableChar daemon_mode)
|
| 814 |
mhunt |
4760 |
{
|
|
|
4761 |
mLogger.debug("getNextReleaseConfig 2");
|
|
|
4762 |
boolean retVal = true;
|
|
|
4763 |
|
|
|
4764 |
try
|
|
|
4765 |
{
|
|
|
4766 |
mReleaseConfigIndex++;
|
| 864 |
mhunt |
4767 |
ReleaseConfig rc = mReleaseConfigCollection.get( mReleaseConfigIndex );
|
| 814 |
mhunt |
4768 |
rtag_id.value = rc.get_rtag_id();
|
|
|
4769 |
rcon_id.value = rc.get_rcon_id();
|
|
|
4770 |
daemon_mode.value = rc.get_daemon_mode();
|
|
|
4771 |
}
|
|
|
4772 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4773 |
{
|
|
|
4774 |
retVal = false;
|
|
|
4775 |
}
|
|
|
4776 |
|
|
|
4777 |
mLogger.info("getNextReleaseConfig 2 returning " + retVal);
|
|
|
4778 |
return retVal;
|
|
|
4779 |
}
|
|
|
4780 |
|
|
|
4781 |
/**returns true if the mRunLevelCollection contains a next element and returns the rcon_id and current_run_level of the next element
|
|
|
4782 |
*/
|
|
|
4783 |
public boolean getNextRunLevel(MutableInt rcon_id,
|
|
|
4784 |
MutableInt current_run_level)
|
|
|
4785 |
{
|
|
|
4786 |
mLogger.debug("getNextRunLevel");
|
|
|
4787 |
boolean retVal = true;
|
|
|
4788 |
|
|
|
4789 |
try
|
|
|
4790 |
{
|
|
|
4791 |
mRunLevelIndex++;
|
| 864 |
mhunt |
4792 |
RunLevel rl = mRunLevelCollection.get( mRunLevelIndex );
|
| 814 |
mhunt |
4793 |
rcon_id.value = rl.get_rcon_id();
|
|
|
4794 |
current_run_level.value = rl.get_current_run_level();
|
|
|
4795 |
}
|
|
|
4796 |
catch( ArrayIndexOutOfBoundsException e )
|
|
|
4797 |
{
|
|
|
4798 |
retVal = false;
|
|
|
4799 |
}
|
|
|
4800 |
|
|
|
4801 |
mLogger.info("getNextRunLevel returning " + retVal);
|
|
|
4802 |
return retVal;
|
|
|
4803 |
}
|
|
|
4804 |
|
|
|
4805 |
/**queries the RUN_LEVEL table using the rcon_id primary key
|
|
|
4806 |
* returns false if the query returns a result set containing one row with a non NULL pause column
|
| 882 |
mhunt |
4807 |
* returns false if the rcon_id is no longer configured
|
| 814 |
mhunt |
4808 |
* (indicating intent to pause the thread)
|
|
|
4809 |
* refer to sequence diagram allowed to proceed
|
|
|
4810 |
*/
|
|
|
4811 |
public boolean queryDirectedRunLevel(final int rcon_id) throws SQLException, Exception
|
|
|
4812 |
{
|
|
|
4813 |
mLogger.debug("queryDirectedRunLevel " + rcon_id);
|
|
|
4814 |
boolean retVal = true;
|
|
|
4815 |
|
|
|
4816 |
if ( mUseDatabase )
|
|
|
4817 |
{
|
|
|
4818 |
try
|
|
|
4819 |
{
|
| 882 |
mhunt |
4820 |
if ( isRconIdConfigured( rcon_id ))
|
| 814 |
mhunt |
4821 |
{
|
| 882 |
mhunt |
4822 |
CallableStatement stmt = mConnection.prepareCall("select pause from release_manager.run_level where rcon_id=" + rcon_id);
|
|
|
4823 |
ResultSet rset = stmt.executeQuery();
|
|
|
4824 |
int rsetSize = 0;
|
| 814 |
mhunt |
4825 |
|
| 882 |
mhunt |
4826 |
while( rset.next() )
|
| 814 |
mhunt |
4827 |
{
|
| 882 |
mhunt |
4828 |
rsetSize++;
|
|
|
4829 |
rset.getInt("pause");
|
|
|
4830 |
|
|
|
4831 |
if ( !rset.wasNull() )
|
|
|
4832 |
{
|
|
|
4833 |
retVal = false;
|
|
|
4834 |
}
|
| 814 |
mhunt |
4835 |
}
|
| 882 |
mhunt |
4836 |
|
|
|
4837 |
rset.close();
|
|
|
4838 |
stmt.close();
|
|
|
4839 |
|
|
|
4840 |
if ( rsetSize > 1 )
|
|
|
4841 |
{
|
|
|
4842 |
mLogger.fatal("queryDirectedRunLevel rsetSize > 1");
|
|
|
4843 |
// show stopper
|
|
|
4844 |
throw new Exception("queryDirectedRunLevel rsetSize > 1");
|
|
|
4845 |
}
|
| 814 |
mhunt |
4846 |
}
|
| 882 |
mhunt |
4847 |
else
|
| 814 |
mhunt |
4848 |
{
|
| 882 |
mhunt |
4849 |
retVal = false;
|
| 814 |
mhunt |
4850 |
}
|
|
|
4851 |
}
|
|
|
4852 |
catch ( SQLException e )
|
|
|
4853 |
{
|
|
|
4854 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4855 |
{
|
|
|
4856 |
mLogger.error("queryDirectedRunLevel database access error only");
|
|
|
4857 |
throw new SQLException();
|
|
|
4858 |
}
|
|
|
4859 |
else
|
|
|
4860 |
{
|
|
|
4861 |
mLogger.fatal("queryDirectedRunLevel show stopper");
|
| 868 |
mhunt |
4862 |
throw new Exception("queryDirectedRunLevel show stopper");
|
| 814 |
mhunt |
4863 |
}
|
|
|
4864 |
}
|
|
|
4865 |
}
|
|
|
4866 |
|
|
|
4867 |
mLogger.info("queryDirectedRunLevel returning " + retVal);
|
|
|
4868 |
return retVal;
|
|
|
4869 |
}
|
|
|
4870 |
|
| 896 |
mhunt |
4871 |
/**queries the RELEASE_CONFIG table using the rcon_id primary key, rtag_id, daemon_hostname, daemon_mode
|
| 814 |
mhunt |
4872 |
* return true if the query contains a result set containing one row
|
| 896 |
mhunt |
4873 |
* (indicating the rcon_id is still configured and its configuration is unchanged, aside from the gbe_buildfilter)
|
|
|
4874 |
* the gbe_buildfilter is queried prior to usage
|
| 814 |
mhunt |
4875 |
* refer to sequence diagram allowed to proceed
|
|
|
4876 |
*/
|
|
|
4877 |
public boolean queryReleaseConfig(final int rtag_id, final int rcon_id,
|
|
|
4878 |
final String daemon_hostname,
|
| 896 |
mhunt |
4879 |
final char daemon_mode) throws SQLException, Exception
|
| 814 |
mhunt |
4880 |
{
|
|
|
4881 |
mLogger.debug("queryReleaseConfig 1");
|
|
|
4882 |
boolean retVal = false;
|
|
|
4883 |
|
|
|
4884 |
if ( !mUseDatabase )
|
|
|
4885 |
{
|
|
|
4886 |
mLogger.info("queryReleaseConfig 1 !mUseDatabase");
|
|
|
4887 |
|
|
|
4888 |
if ( mConnectionString.compareTo("unit test exit") != 0 )
|
|
|
4889 |
{
|
|
|
4890 |
retVal = true;
|
|
|
4891 |
}
|
|
|
4892 |
}
|
|
|
4893 |
else
|
|
|
4894 |
{
|
|
|
4895 |
try
|
|
|
4896 |
{
|
| 1313 |
dpurdie |
4897 |
String sql = new String(
|
|
|
4898 |
"select rc.gbe_buildfilter, rl.pause " +
|
|
|
4899 |
"from release_manager.release_config rc, release_manager.release_tags rt, release_manager.run_level rl " +
|
|
|
4900 |
" where rc.rtag_id=" + rtag_id +
|
|
|
4901 |
" and rc.rcon_id=" + rcon_id +
|
|
|
4902 |
" and rc.daemon_hostname='" + daemon_hostname + "'" +
|
|
|
4903 |
" and rc.daemon_mode='" + daemon_mode + "'" +
|
|
|
4904 |
" and rl.rcon_id=" + rcon_id +
|
|
|
4905 |
" and rt.rtag_id=rc.rtag_id and (rt.official = 'N' or rt.official='R' or rt.official='C')" );
|
|
|
4906 |
|
| 814 |
mhunt |
4907 |
CallableStatement stmt = mConnection.prepareCall( sql );
|
|
|
4908 |
ResultSet rset = stmt.executeQuery();
|
|
|
4909 |
int rsetSize = 0;
|
|
|
4910 |
|
|
|
4911 |
while( rset.next() )
|
|
|
4912 |
{
|
|
|
4913 |
rsetSize++;
|
| 1313 |
dpurdie |
4914 |
|
|
|
4915 |
//
|
|
|
4916 |
// Pause: null -> 0 == Run
|
|
|
4917 |
// 1 == Pause
|
|
|
4918 |
// 2 == Disabled
|
|
|
4919 |
//
|
|
|
4920 |
int pause = rset.getInt("pause");
|
|
|
4921 |
if ( rset.wasNull() )
|
|
|
4922 |
{
|
|
|
4923 |
pause = 0;
|
|
|
4924 |
}
|
|
|
4925 |
mLogger.info("queryReleaseConfig 1: " + rtag_id + ", " + rcon_id + ", "+ daemon_mode + ", " + pause );
|
|
|
4926 |
|
|
|
4927 |
|
|
|
4928 |
if ( pause <= 1 )
|
|
|
4929 |
{
|
|
|
4930 |
retVal = true;
|
|
|
4931 |
}
|
| 814 |
mhunt |
4932 |
}
|
| 830 |
mhunt |
4933 |
|
|
|
4934 |
rset.close();
|
|
|
4935 |
stmt.close();
|
| 814 |
mhunt |
4936 |
|
|
|
4937 |
if ( rsetSize > 1 )
|
|
|
4938 |
{
|
|
|
4939 |
mLogger.fatal("queryReleaseConfig 1 rsetSize > 1");
|
|
|
4940 |
// show stopper
|
| 868 |
mhunt |
4941 |
throw new Exception("queryReleaseConfig 1 rsetSize > 1");
|
| 814 |
mhunt |
4942 |
}
|
|
|
4943 |
}
|
|
|
4944 |
catch ( SQLException e )
|
|
|
4945 |
{
|
|
|
4946 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
4947 |
{
|
|
|
4948 |
mLogger.error("queryReleaseConfig 1 database access error only");
|
|
|
4949 |
throw new SQLException();
|
|
|
4950 |
}
|
|
|
4951 |
else
|
|
|
4952 |
{
|
|
|
4953 |
mLogger.fatal("queryReleaseConfig 1 show stopper");
|
| 868 |
mhunt |
4954 |
throw new Exception("queryReleaseConfig 1 show stopper");
|
| 814 |
mhunt |
4955 |
}
|
|
|
4956 |
}
|
|
|
4957 |
}
|
|
|
4958 |
|
|
|
4959 |
mLogger.info("queryReleaseConfig 1 returning " + retVal);
|
|
|
4960 |
return retVal;
|
|
|
4961 |
}
|
|
|
4962 |
|
| 896 |
mhunt |
4963 |
/**queries the RELEASE_CONFIG table using the rcon_id primary key for the gbebuildfilter
|
|
|
4964 |
*/
|
|
|
4965 |
public void queryBuildFilter(final int rcon_id,
|
|
|
4966 |
MutableString gbebuildfilter) throws SQLException, Exception
|
|
|
4967 |
{
|
|
|
4968 |
mLogger.debug("queryBuildFilter");
|
|
|
4969 |
|
|
|
4970 |
if ( !mUseDatabase )
|
|
|
4971 |
{
|
|
|
4972 |
mLogger.info("queryBuildFilter !mUseDatabase");
|
|
|
4973 |
}
|
|
|
4974 |
else
|
|
|
4975 |
{
|
|
|
4976 |
try
|
|
|
4977 |
{
|
| 898 |
mhunt |
4978 |
connect();
|
| 896 |
mhunt |
4979 |
String sql = new String("select gbe_buildfilter from release_manager.release_config where rcon_id=" + rcon_id );
|
|
|
4980 |
CallableStatement stmt = mConnection.prepareCall( sql );
|
|
|
4981 |
ResultSet rset = stmt.executeQuery();
|
|
|
4982 |
int rsetSize = 0;
|
|
|
4983 |
|
|
|
4984 |
while( rset.next() )
|
|
|
4985 |
{
|
|
|
4986 |
rsetSize++;
|
|
|
4987 |
gbebuildfilter.value = rset.getString("gbe_buildfilter");
|
|
|
4988 |
}
|
|
|
4989 |
|
|
|
4990 |
rset.close();
|
|
|
4991 |
stmt.close();
|
|
|
4992 |
|
|
|
4993 |
if ( rsetSize > 1 )
|
|
|
4994 |
{
|
|
|
4995 |
mLogger.fatal("queryBuildFilter rsetSize > 1");
|
|
|
4996 |
// show stopper
|
|
|
4997 |
throw new Exception("queryBuildFilter rsetSize > 1");
|
|
|
4998 |
}
|
|
|
4999 |
}
|
|
|
5000 |
catch ( SQLException e )
|
|
|
5001 |
{
|
|
|
5002 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5003 |
{
|
|
|
5004 |
mLogger.error("queryBuildFilter database access error only");
|
|
|
5005 |
throw new SQLException();
|
|
|
5006 |
}
|
|
|
5007 |
else
|
|
|
5008 |
{
|
|
|
5009 |
mLogger.fatal("queryBuildFilter show stopper");
|
|
|
5010 |
throw new Exception("queryBuildFilter show stopper");
|
|
|
5011 |
}
|
|
|
5012 |
}
|
| 898 |
mhunt |
5013 |
finally
|
|
|
5014 |
{
|
|
|
5015 |
// this block is executed regardless of what happens in the try block
|
|
|
5016 |
// even if an exception is thrown
|
|
|
5017 |
// ensure disconnect
|
|
|
5018 |
disconnect();
|
|
|
5019 |
}
|
| 896 |
mhunt |
5020 |
}
|
|
|
5021 |
}
|
|
|
5022 |
|
| 814 |
mhunt |
5023 |
/**removes all elements from the mReleaseConfigCollection
|
|
|
5024 |
* handles database connection and disconnection
|
|
|
5025 |
* queries the RELEASE_CONFIG table using the rtag_id
|
|
|
5026 |
* populates the mReleaseConfigCollection with the query result set
|
|
|
5027 |
* partially implements the sequence diagrams coordinate slave threads generate build files
|
|
|
5028 |
*/
|
|
|
5029 |
public void queryReleaseConfig(final int rtag_id) throws SQLException, Exception
|
|
|
5030 |
{
|
|
|
5031 |
mLogger.debug("queryReleaseConfig 2");
|
|
|
5032 |
mReleaseConfigCollection.removeAllElements();
|
|
|
5033 |
|
|
|
5034 |
if ( !mUseDatabase )
|
|
|
5035 |
{
|
|
|
5036 |
mLogger.info("queryReleaseConfig 2 !mUseDatabase");
|
| 896 |
mhunt |
5037 |
ReleaseConfig releaseConfig = new ReleaseConfig(1,1,'M');
|
| 814 |
mhunt |
5038 |
mReleaseConfigCollection.add(releaseConfig);
|
| 896 |
mhunt |
5039 |
releaseConfig = new ReleaseConfig(1,2,'S');
|
| 814 |
mhunt |
5040 |
mReleaseConfigCollection.add(releaseConfig);
|
|
|
5041 |
}
|
|
|
5042 |
else
|
|
|
5043 |
{
|
|
|
5044 |
try
|
|
|
5045 |
{
|
|
|
5046 |
connect();
|
| 882 |
mhunt |
5047 |
|
| 1313 |
dpurdie |
5048 |
CallableStatement stmt = mConnection.prepareCall(
|
|
|
5049 |
"select rc.rcon_id, rc.daemon_mode, rl.pause" +
|
|
|
5050 |
" from release_manager.release_config rc, release_manager.run_level rl" +
|
|
|
5051 |
" where rc.rtag_id=" + rtag_id + " and rl.rcon_id=rc.rcon_id");
|
|
|
5052 |
|
| 814 |
mhunt |
5053 |
ResultSet rset = stmt.executeQuery();
|
|
|
5054 |
|
|
|
5055 |
while( rset.next() )
|
|
|
5056 |
{
|
|
|
5057 |
int rcon_id = rset.getInt("rcon_id");
|
|
|
5058 |
|
|
|
5059 |
if ( rset.wasNull() )
|
|
|
5060 |
{
|
|
|
5061 |
mLogger.fatal("queryReleaseConfig 2 null rcon_id " + rtag_id);
|
|
|
5062 |
// show stopper
|
| 868 |
mhunt |
5063 |
throw new Exception("queryReleaseConfig 2 null rcon_id " + rtag_id);
|
| 814 |
mhunt |
5064 |
}
|
|
|
5065 |
|
|
|
5066 |
char dm = 'S';
|
|
|
5067 |
String daemon_mode = rset.getString("daemon_mode");
|
|
|
5068 |
|
|
|
5069 |
if ( daemon_mode != null )
|
|
|
5070 |
{
|
|
|
5071 |
mLogger.info("queryReleaseConfig 2 daemon_mode " + daemon_mode + ".");
|
|
|
5072 |
|
|
|
5073 |
if ( daemon_mode.compareTo("M") == 0 )
|
|
|
5074 |
{
|
|
|
5075 |
dm = 'M';
|
|
|
5076 |
}
|
|
|
5077 |
}
|
| 1313 |
dpurdie |
5078 |
|
|
|
5079 |
//
|
|
|
5080 |
// Pause: null -> 0 == Run
|
|
|
5081 |
// 1 == Pause
|
|
|
5082 |
// 2 == Disabled
|
|
|
5083 |
//
|
|
|
5084 |
int pause = rset.getInt("pause");
|
|
|
5085 |
if ( rset.wasNull() )
|
|
|
5086 |
{
|
|
|
5087 |
pause = 0;
|
|
|
5088 |
}
|
|
|
5089 |
mLogger.info("queryReleaseConfig 2: " + rtag_id + ", " + rcon_id + ", "+ dm + ", " + pause );
|
|
|
5090 |
|
|
|
5091 |
|
|
|
5092 |
if ( pause <= 1 )
|
|
|
5093 |
{
|
|
|
5094 |
ReleaseConfig releaseConfig = new ReleaseConfig( rtag_id, rcon_id, dm );
|
|
|
5095 |
mReleaseConfigCollection.add(releaseConfig);
|
|
|
5096 |
}
|
| 814 |
mhunt |
5097 |
}
|
|
|
5098 |
|
| 830 |
mhunt |
5099 |
|
|
|
5100 |
rset.close();
|
|
|
5101 |
stmt.close();
|
| 814 |
mhunt |
5102 |
}
|
|
|
5103 |
catch ( SQLException e )
|
|
|
5104 |
{
|
|
|
5105 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5106 |
{
|
|
|
5107 |
mLogger.error("queryReleaseConfig 2 daemon_mode database access error only");
|
|
|
5108 |
throw new SQLException();
|
|
|
5109 |
}
|
|
|
5110 |
else
|
|
|
5111 |
{
|
|
|
5112 |
mLogger.fatal("queryReleaseConfig 2 show stopper");
|
| 868 |
mhunt |
5113 |
throw new Exception("queryReleaseConfig 2 show stopper");
|
| 814 |
mhunt |
5114 |
}
|
|
|
5115 |
}
|
| 898 |
mhunt |
5116 |
finally
|
|
|
5117 |
{
|
|
|
5118 |
// this block is executed regardless of what happens in the try block
|
|
|
5119 |
// even if an exception is thrown
|
|
|
5120 |
// ensure disconnect
|
|
|
5121 |
disconnect();
|
|
|
5122 |
}
|
| 814 |
mhunt |
5123 |
}
|
|
|
5124 |
}
|
|
|
5125 |
|
|
|
5126 |
/**removes all elements from the mReleaseConfigCollection
|
|
|
5127 |
* handles database connection and disconnection
|
|
|
5128 |
* queries the RELEASE_CONFIG table using the daemon_hostname
|
|
|
5129 |
* populates the mReleaseConfigCollection with the query result set
|
|
|
5130 |
* partially implements the sequence diagram spawn thread
|
|
|
5131 |
*/
|
|
|
5132 |
public void queryReleaseConfig(final String hostname) throws SQLException, Exception
|
|
|
5133 |
{
|
|
|
5134 |
mLogger.debug("queryReleaseConfig 3 " + hostname);
|
|
|
5135 |
mReleaseConfigCollection.removeAllElements();
|
|
|
5136 |
|
|
|
5137 |
if ( mConnectionString.compareTo("unit test spawn thread") == 0)
|
|
|
5138 |
{
|
|
|
5139 |
mLogger.info("queryReleaseConfig 3 unit test spawn thread");
|
|
|
5140 |
// specifying a gbebuildfilter of unit test is designed to invoke a benign thread for unit test purposes
|
| 896 |
mhunt |
5141 |
ReleaseConfig releaseConfig = new ReleaseConfig(1,1,'M');
|
| 814 |
mhunt |
5142 |
mReleaseConfigCollection.add(releaseConfig);
|
| 896 |
mhunt |
5143 |
releaseConfig = new ReleaseConfig(2,2,'S');
|
| 814 |
mhunt |
5144 |
mReleaseConfigCollection.add(releaseConfig);
|
|
|
5145 |
}
|
|
|
5146 |
else
|
|
|
5147 |
{
|
|
|
5148 |
try
|
|
|
5149 |
{
|
|
|
5150 |
connect();
|
| 1313 |
dpurdie |
5151 |
CallableStatement stmt = mConnection.prepareCall(
|
|
|
5152 |
"select rc.rtag_id, rc.rcon_id, rc.daemon_mode, rl.pause " +
|
|
|
5153 |
"from release_manager.release_config rc, release_manager.release_tags rt, release_manager.run_level rl " +
|
|
|
5154 |
"where rc.daemon_hostname='" + hostname + "'" +
|
|
|
5155 |
" and rt.rtag_id=rc.rtag_id" +
|
|
|
5156 |
" and rl.rcon_id=rc.rcon_id" +
|
|
|
5157 |
" and (rt.official = 'N' or rt.official='R' or rt.official='C')"
|
|
|
5158 |
);
|
| 814 |
mhunt |
5159 |
ResultSet rset = stmt.executeQuery();
|
|
|
5160 |
|
|
|
5161 |
while( rset.next() )
|
|
|
5162 |
{
|
|
|
5163 |
int rtag_id = rset.getInt("rtag_id");
|
|
|
5164 |
|
|
|
5165 |
if ( rset.wasNull() )
|
|
|
5166 |
{
|
|
|
5167 |
mLogger.fatal("queryReleaseConfig 3 null rtag_id");
|
|
|
5168 |
// show stopper
|
| 868 |
mhunt |
5169 |
throw new Exception("queryReleaseConfig 3 null rtag_id");
|
| 814 |
mhunt |
5170 |
}
|
|
|
5171 |
|
|
|
5172 |
int rcon_id = rset.getInt("rcon_id");
|
|
|
5173 |
|
|
|
5174 |
if ( rset.wasNull() )
|
|
|
5175 |
{
|
|
|
5176 |
mLogger.fatal("queryReleaseConfig 3 null rcon_id");
|
|
|
5177 |
// show stopper
|
| 868 |
mhunt |
5178 |
throw new Exception("queryReleaseConfig 3 null rcon_id");
|
| 814 |
mhunt |
5179 |
}
|
|
|
5180 |
|
|
|
5181 |
char dm = 'S';
|
|
|
5182 |
String daemon_mode = rset.getString("daemon_mode");
|
|
|
5183 |
|
|
|
5184 |
if ( daemon_mode != null )
|
|
|
5185 |
{
|
|
|
5186 |
mLogger.info("queryReleaseConfig 3 daemon_mode " + daemon_mode + ".");
|
|
|
5187 |
|
|
|
5188 |
if ( daemon_mode.compareTo("M") == 0 )
|
|
|
5189 |
{
|
|
|
5190 |
dm = 'M';
|
|
|
5191 |
}
|
|
|
5192 |
}
|
|
|
5193 |
|
| 1313 |
dpurdie |
5194 |
//
|
|
|
5195 |
// Pause: null -> 0 == Run
|
|
|
5196 |
// 1 == Pause
|
|
|
5197 |
// 2 == Disabled
|
|
|
5198 |
//
|
|
|
5199 |
int pause = rset.getInt("pause");
|
|
|
5200 |
if ( rset.wasNull() )
|
|
|
5201 |
{
|
|
|
5202 |
pause = 0;
|
|
|
5203 |
}
|
|
|
5204 |
mLogger.info("queryReleaseConfig 3: " + rtag_id + ", " + rcon_id + ", "+ dm + ", " + pause );
|
|
|
5205 |
|
|
|
5206 |
|
|
|
5207 |
if ( pause <= 1 )
|
|
|
5208 |
{
|
|
|
5209 |
ReleaseConfig releaseConfig = new ReleaseConfig( rtag_id, rcon_id, dm );
|
|
|
5210 |
mReleaseConfigCollection.add(releaseConfig);
|
|
|
5211 |
}
|
| 814 |
mhunt |
5212 |
}
|
|
|
5213 |
|
| 830 |
mhunt |
5214 |
rset.close();
|
|
|
5215 |
stmt.close();
|
| 814 |
mhunt |
5216 |
}
|
|
|
5217 |
catch ( SQLException e )
|
|
|
5218 |
{
|
|
|
5219 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5220 |
{
|
|
|
5221 |
mLogger.error("queryReleaseConfig 3 database access error only");
|
|
|
5222 |
throw new SQLException();
|
|
|
5223 |
}
|
|
|
5224 |
else
|
|
|
5225 |
{
|
|
|
5226 |
mLogger.fatal("queryReleaseConfig 3 show stopper");
|
| 868 |
mhunt |
5227 |
throw new Exception("queryReleaseConfig 3 show stopper");
|
| 814 |
mhunt |
5228 |
}
|
|
|
5229 |
}
|
| 898 |
mhunt |
5230 |
finally
|
|
|
5231 |
{
|
|
|
5232 |
// this block is executed regardless of what happens in the try block
|
|
|
5233 |
// even if an exception is thrown
|
|
|
5234 |
// ensure disconnect
|
|
|
5235 |
disconnect();
|
|
|
5236 |
}
|
| 814 |
mhunt |
5237 |
}
|
|
|
5238 |
}
|
|
|
5239 |
|
|
|
5240 |
/**queries the RUN_LEVEL table using the rcon_id primary key
|
|
|
5241 |
* handles database connection and disconnection
|
|
|
5242 |
* returns the current_build_files
|
|
|
5243 |
* implements the sequence diagram consume build files
|
|
|
5244 |
*/
|
|
|
5245 |
public void queryRunLevel(int rcon_id, MutableString currentBuildFiles) throws SQLException, Exception
|
|
|
5246 |
{
|
|
|
5247 |
mLogger.debug("queryRunLevel 1 rcon_id " + rcon_id);
|
|
|
5248 |
if ( !mUseDatabase )
|
|
|
5249 |
{
|
|
|
5250 |
mLogger.info("queryRunLevel 1 !mUseDatabase");
|
|
|
5251 |
currentBuildFiles.value = "unit test build file content";
|
|
|
5252 |
}
|
|
|
5253 |
else
|
|
|
5254 |
{
|
|
|
5255 |
try
|
|
|
5256 |
{
|
|
|
5257 |
connect();
|
|
|
5258 |
CallableStatement stmt = mConnection.prepareCall("select current_build_files from release_manager.run_level where rcon_id=" + rcon_id);
|
|
|
5259 |
ResultSet rset = stmt.executeQuery();
|
|
|
5260 |
int rsetSize = 0;
|
|
|
5261 |
|
|
|
5262 |
while( rset.next() )
|
|
|
5263 |
{
|
|
|
5264 |
rsetSize++;
|
|
|
5265 |
currentBuildFiles.value = rset.getString("current_build_files");
|
|
|
5266 |
if (rset.wasNull())
|
|
|
5267 |
{
|
|
|
5268 |
currentBuildFiles.value = "";
|
|
|
5269 |
}
|
|
|
5270 |
}
|
|
|
5271 |
|
|
|
5272 |
if ( rsetSize > 1 )
|
|
|
5273 |
{
|
|
|
5274 |
mLogger.fatal("queryRunLevel 1 rsetSize > 1");
|
|
|
5275 |
// show stopper
|
| 868 |
mhunt |
5276 |
throw new Exception("queryRunLevel 1 rsetSize > 1");
|
| 814 |
mhunt |
5277 |
}
|
|
|
5278 |
|
| 830 |
mhunt |
5279 |
rset.close();
|
|
|
5280 |
stmt.close();
|
| 814 |
mhunt |
5281 |
}
|
|
|
5282 |
catch ( SQLException e )
|
|
|
5283 |
{
|
|
|
5284 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5285 |
{
|
|
|
5286 |
mLogger.error("queryRunLevel 1 database access error only");
|
|
|
5287 |
throw new SQLException();
|
|
|
5288 |
}
|
|
|
5289 |
else
|
|
|
5290 |
{
|
|
|
5291 |
mLogger.fatal("queryRunLevel 1 show stopper");
|
| 868 |
mhunt |
5292 |
throw new Exception("queryRunLevel 1 show stopper");
|
| 814 |
mhunt |
5293 |
}
|
|
|
5294 |
}
|
| 898 |
mhunt |
5295 |
finally
|
|
|
5296 |
{
|
|
|
5297 |
// this block is executed regardless of what happens in the try block
|
|
|
5298 |
// even if an exception is thrown
|
|
|
5299 |
// ensure disconnect
|
|
|
5300 |
disconnect();
|
|
|
5301 |
}
|
| 814 |
mhunt |
5302 |
}
|
|
|
5303 |
}
|
|
|
5304 |
|
|
|
5305 |
/**removes all elements from the mRunLevelCollection
|
|
|
5306 |
* handles database connection and disconnection
|
| 882 |
mhunt |
5307 |
* select rl.rcon_id, rl.current_run_level from release_manager.release_config rc, release_manager.run_level rl
|
| 814 |
mhunt |
5308 |
* where rc.rtag_id=<rtag_id> and rl.rcon_id=rc.rcon_id;
|
|
|
5309 |
* populates the mRunLevelCollection with the query result set
|
|
|
5310 |
* refer to sequence diagram coordinate slave threads
|
|
|
5311 |
*/
|
|
|
5312 |
public void queryRunLevel(final int rtag_id) throws SQLException, Exception
|
|
|
5313 |
{
|
|
|
5314 |
mLogger.debug("queryRunLevel 2 rtag_id " + rtag_id);
|
|
|
5315 |
if ( mConnectionString.compareTo("unit test coordinate slave threads") == 0)
|
|
|
5316 |
{
|
|
|
5317 |
mLogger.info("queryRunLevel 2 unit test coordinate slave threads");
|
|
|
5318 |
|
|
|
5319 |
if ( mRunLevelCollection.size() == 0)
|
|
|
5320 |
{
|
|
|
5321 |
// first time not all slave threads are waiting
|
|
|
5322 |
RunLevel runLevel = new RunLevel(1, "", DB_WAITING, false);
|
|
|
5323 |
mRunLevelCollection.add(runLevel);
|
|
|
5324 |
runLevel = new RunLevel(2, "", DB_IDLE, false);
|
|
|
5325 |
mRunLevelCollection.add(runLevel);
|
|
|
5326 |
}
|
|
|
5327 |
else
|
|
|
5328 |
{
|
|
|
5329 |
// subsequent times all slave threads are waiting
|
|
|
5330 |
mRunLevelCollection.removeAllElements();
|
|
|
5331 |
RunLevel runLevel = new RunLevel(1, "", DB_WAITING, false);
|
|
|
5332 |
mRunLevelCollection.add(runLevel);
|
|
|
5333 |
runLevel = new RunLevel(2, "", DB_WAITING, false);
|
|
|
5334 |
mRunLevelCollection.add(runLevel);
|
|
|
5335 |
}
|
|
|
5336 |
}
|
|
|
5337 |
|
|
|
5338 |
if ( mUseDatabase )
|
|
|
5339 |
{
|
|
|
5340 |
mRunLevelCollection.removeAllElements();
|
|
|
5341 |
|
|
|
5342 |
try
|
|
|
5343 |
{
|
|
|
5344 |
connect();
|
|
|
5345 |
CallableStatement stmt = mConnection.prepareCall(
|
| 882 |
mhunt |
5346 |
"select rl.rcon_id, rl.current_run_level from release_manager.release_config rc, release_manager.run_level rl " +
|
| 814 |
mhunt |
5347 |
"where rc.rtag_id=" +rtag_id + " and rl.rcon_id=rc.rcon_id");
|
|
|
5348 |
ResultSet rset = stmt.executeQuery();
|
|
|
5349 |
int rsetSize = 0;
|
|
|
5350 |
int rcon_id = 0;
|
|
|
5351 |
int current_run_level = 0;
|
|
|
5352 |
|
|
|
5353 |
while( rset.next() )
|
|
|
5354 |
{
|
|
|
5355 |
rsetSize++;
|
|
|
5356 |
rcon_id = rset.getInt("rcon_id");
|
|
|
5357 |
|
|
|
5358 |
if ( rset.wasNull() )
|
|
|
5359 |
{
|
|
|
5360 |
mLogger.fatal("queryRunLevel 2 null rcon_id");
|
|
|
5361 |
// show stopper
|
| 868 |
mhunt |
5362 |
throw new Exception("queryRunLevel 2 null rcon_id");
|
| 814 |
mhunt |
5363 |
}
|
|
|
5364 |
|
|
|
5365 |
current_run_level = rset.getInt("current_run_level");
|
|
|
5366 |
|
|
|
5367 |
if ( rset.wasNull() )
|
|
|
5368 |
{
|
| 906 |
mhunt |
5369 |
// slave may never have started to insert run level
|
|
|
5370 |
// use idle
|
|
|
5371 |
current_run_level = DB_IDLE;
|
| 814 |
mhunt |
5372 |
}
|
|
|
5373 |
|
|
|
5374 |
RunLevel runLevel = new RunLevel(rcon_id, "", current_run_level, false);
|
|
|
5375 |
mRunLevelCollection.add(runLevel);
|
|
|
5376 |
}
|
|
|
5377 |
|
| 830 |
mhunt |
5378 |
rset.close();
|
|
|
5379 |
stmt.close();
|
| 814 |
mhunt |
5380 |
}
|
|
|
5381 |
catch ( SQLException e )
|
|
|
5382 |
{
|
|
|
5383 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5384 |
{
|
|
|
5385 |
mLogger.error("queryRunLevel 2 database access error only");
|
|
|
5386 |
throw new SQLException();
|
|
|
5387 |
}
|
|
|
5388 |
else
|
|
|
5389 |
{
|
|
|
5390 |
mLogger.fatal("queryRunLevel 2 show stopper");
|
| 868 |
mhunt |
5391 |
throw new Exception("queryRunLevel 2 show stopper");
|
| 814 |
mhunt |
5392 |
}
|
|
|
5393 |
}
|
| 898 |
mhunt |
5394 |
finally
|
|
|
5395 |
{
|
|
|
5396 |
// this block is executed regardless of what happens in the try block
|
|
|
5397 |
// even if an exception is thrown
|
|
|
5398 |
// ensure disconnect
|
|
|
5399 |
disconnect();
|
|
|
5400 |
}
|
| 814 |
mhunt |
5401 |
}
|
|
|
5402 |
}
|
|
|
5403 |
|
| 818 |
mhunt |
5404 |
/**removes all elements from the mRunLevelCollection
|
|
|
5405 |
* handles database connection and disconnection
|
| 882 |
mhunt |
5406 |
* select rcon_id, current_run_level from release_manager.run_level
|
| 818 |
mhunt |
5407 |
* where rcon_id=<rcon_id>;
|
|
|
5408 |
* populates the mRunLevelCollection with the query result set
|
|
|
5409 |
*/
|
|
|
5410 |
public void querySingleRunLevel(final int rcon_id) throws SQLException, Exception
|
|
|
5411 |
{
|
|
|
5412 |
mLogger.debug("querySingleRunLevel rcon_id " + rcon_id);
|
|
|
5413 |
if ( !mUseDatabase )
|
|
|
5414 |
{
|
|
|
5415 |
mLogger.info("querySingleRunLevel !mUseDatabase");
|
|
|
5416 |
|
|
|
5417 |
mRunLevelCollection.removeAllElements();
|
|
|
5418 |
RunLevel runLevel = new RunLevel(rcon_id, "", DB_ACTIVE, false);
|
|
|
5419 |
mRunLevelCollection.add(runLevel);
|
|
|
5420 |
}
|
|
|
5421 |
else
|
|
|
5422 |
{
|
|
|
5423 |
mRunLevelCollection.removeAllElements();
|
|
|
5424 |
|
|
|
5425 |
try
|
|
|
5426 |
{
|
|
|
5427 |
connect();
|
|
|
5428 |
|
| 882 |
mhunt |
5429 |
if (isRconIdConfigured( rcon_id ))
|
| 818 |
mhunt |
5430 |
{
|
| 882 |
mhunt |
5431 |
CallableStatement stmt = mConnection.prepareCall(
|
|
|
5432 |
"select rcon_id, current_run_level from release_manager.run_level " +
|
|
|
5433 |
"where rcon_id=" +rcon_id);
|
|
|
5434 |
ResultSet rset = stmt.executeQuery();
|
|
|
5435 |
int rsetSize = 0;
|
|
|
5436 |
int current_run_level = 0;
|
|
|
5437 |
|
|
|
5438 |
while( rset.next() )
|
| 818 |
mhunt |
5439 |
{
|
| 882 |
mhunt |
5440 |
rsetSize++;
|
|
|
5441 |
current_run_level = rset.getInt("current_run_level");
|
|
|
5442 |
|
|
|
5443 |
if ( rset.wasNull() )
|
|
|
5444 |
{
|
|
|
5445 |
mLogger.fatal("querySingleRunLevel null current_run_level");
|
|
|
5446 |
// show stopper
|
|
|
5447 |
throw new Exception("querySingleRunLevel null current_run_level");
|
|
|
5448 |
}
|
|
|
5449 |
|
|
|
5450 |
RunLevel runLevel = new RunLevel(rcon_id, "", current_run_level, false);
|
|
|
5451 |
mRunLevelCollection.add(runLevel);
|
|
|
5452 |
}
|
|
|
5453 |
|
|
|
5454 |
rset.close();
|
|
|
5455 |
stmt.close();
|
|
|
5456 |
|
|
|
5457 |
if ( rsetSize != 1 )
|
|
|
5458 |
{
|
|
|
5459 |
mLogger.fatal("querySingleRunLevel rsetSize != 1");
|
| 818 |
mhunt |
5460 |
// show stopper
|
| 882 |
mhunt |
5461 |
throw new Exception("querySingleRunLevel rsetSize != 1");
|
| 818 |
mhunt |
5462 |
}
|
|
|
5463 |
}
|
|
|
5464 |
}
|
|
|
5465 |
catch ( SQLException e )
|
|
|
5466 |
{
|
|
|
5467 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5468 |
{
|
|
|
5469 |
mLogger.error("querySingleRunLevel database access error only");
|
|
|
5470 |
throw new SQLException();
|
|
|
5471 |
}
|
|
|
5472 |
else
|
|
|
5473 |
{
|
|
|
5474 |
mLogger.fatal("querySingleRunLevel show stopper");
|
| 868 |
mhunt |
5475 |
throw new Exception("querySingleRunLevel show stopper");
|
| 818 |
mhunt |
5476 |
}
|
|
|
5477 |
}
|
| 898 |
mhunt |
5478 |
finally
|
|
|
5479 |
{
|
|
|
5480 |
// this block is executed regardless of what happens in the try block
|
|
|
5481 |
// even if an exception is thrown
|
|
|
5482 |
// ensure disconnect
|
|
|
5483 |
disconnect();
|
|
|
5484 |
}
|
| 818 |
mhunt |
5485 |
}
|
|
|
5486 |
}
|
|
|
5487 |
|
| 814 |
mhunt |
5488 |
/**queries the RUN_LEVEL_SCHEDULE table
|
| 896 |
mhunt |
5489 |
* when recover is true, checks for archive existence and runs resume when both archives exist
|
|
|
5490 |
* this should delete rows with a non NULL indefinite pause
|
| 814 |
mhunt |
5491 |
* returns false if a row in the query result set indicates build service downtime is scheduled
|
|
|
5492 |
* returns false if a row in the query result set has a non NULL indefinite_pause
|
|
|
5493 |
* refer to the sequence diagram allowed to proceed
|
|
|
5494 |
*/
|
| 896 |
mhunt |
5495 |
public boolean queryRunLevelSchedule(Date resumeTime, boolean recover) throws SQLException, Exception
|
| 814 |
mhunt |
5496 |
{
|
|
|
5497 |
mLogger.debug("queryRunLevelSchedule");
|
|
|
5498 |
boolean retVal = true;
|
|
|
5499 |
|
|
|
5500 |
if ( !mUseDatabase )
|
|
|
5501 |
{
|
|
|
5502 |
mLogger.info("queryRunLevelSchedule !mUseDatabase");
|
|
|
5503 |
|
|
|
5504 |
if ( mConnectionString.compareTo("unit test not allowed to proceed") == 0 )
|
|
|
5505 |
{
|
|
|
5506 |
// schedule a 100ms max wait
|
|
|
5507 |
resumeTime.setTime( resumeTime.getTime() + 100 );
|
|
|
5508 |
retVal = false;
|
|
|
5509 |
}
|
|
|
5510 |
}
|
|
|
5511 |
else
|
|
|
5512 |
{
|
|
|
5513 |
try
|
|
|
5514 |
{
|
| 896 |
mhunt |
5515 |
if ( recover )
|
|
|
5516 |
{
|
|
|
5517 |
if ( Package.recover() )
|
|
|
5518 |
{
|
|
|
5519 |
// dpkg and deploy archives exist
|
|
|
5520 |
// clear the indefinite pause condition
|
|
|
5521 |
resume();
|
|
|
5522 |
}
|
|
|
5523 |
}
|
| 814 |
mhunt |
5524 |
CallableStatement stmt = mConnection.prepareCall("select scheduled_pause, scheduled_resume, repeat, indefinite_pause from release_manager.run_level_schedule");
|
|
|
5525 |
ResultSet rset = stmt.executeQuery();
|
|
|
5526 |
Date now = new Date();
|
| 844 |
dpurdie |
5527 |
|
|
|
5528 |
|
|
|
5529 |
//
|
| 846 |
dpurdie |
5530 |
// Scan the database information and determine if there is any reason
|
| 844 |
dpurdie |
5531 |
// to pause. Terminate the loop on the first excuse to pause
|
|
|
5532 |
// as indefinite pause may have multiple (lots) of entries in the data
|
|
|
5533 |
// base.
|
|
|
5534 |
//
|
|
|
5535 |
while( retVal == true && rset.next() )
|
| 814 |
mhunt |
5536 |
{
|
| 846 |
dpurdie |
5537 |
//
|
|
|
5538 |
// Examine the current row from the data base
|
|
|
5539 |
// Expect one of two forms:
|
|
|
5540 |
// 1) scheduled_pause
|
|
|
5541 |
// Must also have a scheduled_resume and a repeat
|
|
|
5542 |
// 2) indefinite_pause
|
|
|
5543 |
//
|
|
|
5544 |
|
|
|
5545 |
// Look for scheduled_pause style of entry
|
|
|
5546 |
//
|
| 814 |
mhunt |
5547 |
Timestamp sp = rset.getTimestamp("scheduled_pause");
|
|
|
5548 |
if ( sp != null )
|
|
|
5549 |
{
|
|
|
5550 |
Date scheduled_pause = new Date( sp.getTime() );
|
|
|
5551 |
Timestamp sr = rset.getTimestamp("scheduled_resume");
|
|
|
5552 |
|
|
|
5553 |
if ( sr != null )
|
|
|
5554 |
{
|
|
|
5555 |
Date scheduled_resume = new Date( sr.getTime() );
|
|
|
5556 |
int repeat = rset.getInt("repeat");
|
|
|
5557 |
mLogger.info("queryRunLevelSchedule repeat " + repeat);
|
| 846 |
dpurdie |
5558 |
|
|
|
5559 |
//
|
|
|
5560 |
// Have scheduled_pause and scheduled_resume
|
|
|
5561 |
// Examine the repeat field and determine how these are used
|
|
|
5562 |
// Supported repeat:
|
|
|
5563 |
// Once Only
|
|
|
5564 |
// Daily Year, Month and Day information is ignored
|
|
|
5565 |
// Weekly Only day of week is utilised
|
|
|
5566 |
//
|
| 814 |
mhunt |
5567 |
if ( !rset.wasNull() )
|
|
|
5568 |
{
|
|
|
5569 |
switch( repeat )
|
|
|
5570 |
{
|
|
|
5571 |
case 0:
|
|
|
5572 |
{
|
|
|
5573 |
// one off
|
|
|
5574 |
if ( scheduled_pause.before(now) && scheduled_resume.after(now) )
|
|
|
5575 |
{
|
|
|
5576 |
mLogger.warn("queryRunLevelSchedule one off scheduled downtime");
|
| 838 |
mhunt |
5577 |
resumeTime = scheduled_resume;
|
| 814 |
mhunt |
5578 |
retVal = false;
|
|
|
5579 |
}
|
|
|
5580 |
break;
|
|
|
5581 |
}
|
|
|
5582 |
case 1:
|
|
|
5583 |
{
|
| 846 |
dpurdie |
5584 |
// daily
|
|
|
5585 |
// Create start and end fimes, then massage some fields
|
|
|
5586 |
// to reflect todays date
|
|
|
5587 |
//
|
| 814 |
mhunt |
5588 |
GregorianCalendar startOfDowntime = new GregorianCalendar();
|
|
|
5589 |
startOfDowntime.setTime(scheduled_pause);
|
|
|
5590 |
GregorianCalendar endOfDowntime = new GregorianCalendar();
|
|
|
5591 |
endOfDowntime.setTime(scheduled_resume);
|
|
|
5592 |
GregorianCalendar clock = new GregorianCalendar();
|
|
|
5593 |
clock.setTime(now);
|
| 846 |
dpurdie |
5594 |
|
|
|
5595 |
// Force date fields to todays date
|
|
|
5596 |
endOfDowntime.set ( clock.get(Calendar.YEAR), clock.get(Calendar.MONTH), clock.get(Calendar.DAY_OF_MONTH) );
|
|
|
5597 |
startOfDowntime.set( clock.get(Calendar.YEAR), clock.get(Calendar.MONTH), clock.get(Calendar.DAY_OF_MONTH) );
|
|
|
5598 |
|
| 814 |
mhunt |
5599 |
if ( startOfDowntime.before(clock) && endOfDowntime.after(clock) )
|
|
|
5600 |
{
|
|
|
5601 |
mLogger.warn("queryRunLevelSchedule daily scheduled downtime");
|
| 838 |
mhunt |
5602 |
resumeTime.setTime(endOfDowntime.getTimeInMillis());
|
| 814 |
mhunt |
5603 |
retVal = false;
|
|
|
5604 |
}
|
|
|
5605 |
break;
|
|
|
5606 |
}
|
|
|
5607 |
case 7:
|
|
|
5608 |
{
|
|
|
5609 |
// weekly
|
| 846 |
dpurdie |
5610 |
// Create start and end times, then massage some fields
|
|
|
5611 |
// to reflect todays date
|
|
|
5612 |
//
|
| 814 |
mhunt |
5613 |
GregorianCalendar startOfDowntime = new GregorianCalendar();
|
|
|
5614 |
startOfDowntime.setTime(scheduled_pause);
|
|
|
5615 |
GregorianCalendar endOfDowntime = new GregorianCalendar();
|
|
|
5616 |
endOfDowntime.setTime(scheduled_resume);
|
|
|
5617 |
GregorianCalendar clock = new GregorianCalendar();
|
|
|
5618 |
clock.setTime(now);
|
| 846 |
dpurdie |
5619 |
|
|
|
5620 |
// Only interested in one day of the week
|
| 814 |
mhunt |
5621 |
if ( startOfDowntime.get(Calendar.DAY_OF_WEEK) == clock.get(Calendar.DAY_OF_WEEK) )
|
|
|
5622 |
{
|
| 846 |
dpurdie |
5623 |
endOfDowntime.set ( clock.get(Calendar.YEAR), clock.get(Calendar.MONTH), clock.get(Calendar.DAY_OF_MONTH) );
|
|
|
5624 |
startOfDowntime.set( clock.get(Calendar.YEAR), clock.get(Calendar.MONTH), clock.get(Calendar.DAY_OF_MONTH) );
|
| 814 |
mhunt |
5625 |
|
|
|
5626 |
if ( startOfDowntime.before(clock) && endOfDowntime.after(clock) )
|
|
|
5627 |
{
|
|
|
5628 |
mLogger.warn("queryRunLevelSchedule weekly scheduled downtime");
|
| 838 |
mhunt |
5629 |
resumeTime.setTime(endOfDowntime.getTimeInMillis());
|
| 814 |
mhunt |
5630 |
retVal = false;
|
|
|
5631 |
}
|
|
|
5632 |
}
|
|
|
5633 |
break;
|
|
|
5634 |
}
|
|
|
5635 |
}
|
|
|
5636 |
}
|
|
|
5637 |
}
|
|
|
5638 |
}
|
|
|
5639 |
|
| 846 |
dpurdie |
5640 |
//
|
|
|
5641 |
// Look for indefinite_pause style of entry
|
|
|
5642 |
// Note: due to an implemenation error there may be many
|
|
|
5643 |
// rows that match. We only need one. The scan will
|
| 896 |
mhunt |
5644 |
// be terminated if we find any
|
| 846 |
dpurdie |
5645 |
//
|
|
|
5646 |
//
|
| 836 |
mhunt |
5647 |
String ip = rset.getString("indefinite_pause");
|
|
|
5648 |
if ( ip != null )
|
| 814 |
mhunt |
5649 |
{
|
|
|
5650 |
// indefinite pause is non null
|
|
|
5651 |
mLogger.warn("queryRunLevelSchedule indefinite pause");
|
| 838 |
mhunt |
5652 |
GregorianCalendar clock = new GregorianCalendar();
|
|
|
5653 |
clock.setTime(now);
|
|
|
5654 |
// wait a minute
|
|
|
5655 |
resumeTime.setTime(clock.getTimeInMillis() + 60000);
|
| 814 |
mhunt |
5656 |
retVal = false;
|
|
|
5657 |
}
|
|
|
5658 |
}
|
| 830 |
mhunt |
5659 |
|
|
|
5660 |
rset.close();
|
|
|
5661 |
stmt.close();
|
| 814 |
mhunt |
5662 |
}
|
|
|
5663 |
catch ( SQLException e )
|
|
|
5664 |
{
|
|
|
5665 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5666 |
{
|
|
|
5667 |
mLogger.error("queryRunLevelSchedule database access error only");
|
|
|
5668 |
throw new SQLException();
|
|
|
5669 |
}
|
|
|
5670 |
else
|
|
|
5671 |
{
|
|
|
5672 |
mLogger.fatal("queryRunLevelSchedule show stopper");
|
| 868 |
mhunt |
5673 |
throw new Exception("queryRunLevelSchedule show stopper");
|
| 814 |
mhunt |
5674 |
}
|
|
|
5675 |
}
|
|
|
5676 |
}
|
|
|
5677 |
|
|
|
5678 |
mLogger.info("queryRunLevelSchedule returning " + retVal);
|
|
|
5679 |
return retVal;
|
|
|
5680 |
}
|
|
|
5681 |
|
| 882 |
mhunt |
5682 |
/**returns true if the rcon_id is configured
|
|
|
5683 |
*/
|
|
|
5684 |
private boolean isRconIdConfigured(final int rcon_id) throws SQLException, Exception
|
|
|
5685 |
{
|
|
|
5686 |
mLogger.debug("isRconIdConfigured");
|
|
|
5687 |
boolean retVal = false;
|
|
|
5688 |
|
|
|
5689 |
try
|
|
|
5690 |
{
|
|
|
5691 |
// check if the rcon_id is still configured
|
|
|
5692 |
CallableStatement stmt = mConnection.prepareCall("select rcon_id from release_manager.release_config where rcon_id=" + rcon_id);
|
|
|
5693 |
ResultSet rset = stmt.executeQuery();
|
|
|
5694 |
|
|
|
5695 |
while( rset.next() )
|
|
|
5696 |
{
|
|
|
5697 |
retVal = true;
|
|
|
5698 |
}
|
|
|
5699 |
|
|
|
5700 |
rset.close();
|
|
|
5701 |
stmt.close();
|
|
|
5702 |
}
|
|
|
5703 |
catch( SQLException e )
|
|
|
5704 |
{
|
|
|
5705 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5706 |
{
|
|
|
5707 |
mLogger.fatal("isRconIdConfigured database access error only");
|
|
|
5708 |
throw new Exception("isRconIdConfigured database access error only");
|
|
|
5709 |
}
|
|
|
5710 |
else
|
|
|
5711 |
{
|
|
|
5712 |
mLogger.fatal("isRconIdConfigured show stopper");
|
|
|
5713 |
throw new Exception("isRconIdConfigured show stopper");
|
|
|
5714 |
}
|
|
|
5715 |
}
|
|
|
5716 |
mLogger.info("isRconIdConfigured returning " + retVal);
|
|
|
5717 |
return retVal;
|
|
|
5718 |
}
|
|
|
5719 |
|
|
|
5720 |
/**returns true if the rcon_id is configured
|
|
|
5721 |
*/
|
|
|
5722 |
private boolean isRtagIdConfigured(final int rtag_id) throws SQLException, Exception
|
|
|
5723 |
{
|
|
|
5724 |
mLogger.debug("isRtagIdConfigured");
|
|
|
5725 |
boolean retVal = false;
|
|
|
5726 |
|
|
|
5727 |
try
|
|
|
5728 |
{
|
|
|
5729 |
// check if the rcon_id is still configured
|
|
|
5730 |
CallableStatement stmt = mConnection.prepareCall("select rtag_id from release_manager.release_config where rtag_id=" + rtag_id);
|
|
|
5731 |
ResultSet rset = stmt.executeQuery();
|
|
|
5732 |
|
|
|
5733 |
while( rset.next() )
|
|
|
5734 |
{
|
|
|
5735 |
retVal = true;
|
|
|
5736 |
}
|
|
|
5737 |
|
|
|
5738 |
rset.close();
|
|
|
5739 |
stmt.close();
|
|
|
5740 |
}
|
|
|
5741 |
catch( SQLException e )
|
|
|
5742 |
{
|
|
|
5743 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5744 |
{
|
|
|
5745 |
mLogger.fatal("isRtagIdConfigured database access error only");
|
|
|
5746 |
throw new Exception("isRtagIdConfigured database access error only");
|
|
|
5747 |
}
|
|
|
5748 |
else
|
|
|
5749 |
{
|
|
|
5750 |
mLogger.fatal("isRtagIdConfigured show stopper");
|
|
|
5751 |
throw new Exception("isRtagIdConfigured show stopper");
|
|
|
5752 |
}
|
|
|
5753 |
}
|
|
|
5754 |
mLogger.info("isRtagIdConfigured returning " + retVal);
|
|
|
5755 |
return retVal;
|
|
|
5756 |
}
|
|
|
5757 |
|
|
|
5758 |
/**persists the runLevel in the RUN_LEVEL table for the rcon_id primary key
|
| 814 |
mhunt |
5759 |
* refer to sequence diagrams generate build files, allowed to proceed, not allowed to proceed, exit, check environment
|
|
|
5760 |
*/
|
| 882 |
mhunt |
5761 |
public void updateCurrentRunLevel(final int rcon_id, final int runLevel, final boolean insert) throws SQLException, Exception
|
| 814 |
mhunt |
5762 |
{
|
|
|
5763 |
mLogger.debug("updateCurrentRunLevel");
|
|
|
5764 |
if ( !mUseDatabase )
|
|
|
5765 |
{
|
|
|
5766 |
mLogger.info("updateCurrentRunLevel !mUseDatabase");
|
|
|
5767 |
Integer i = new Integer(runLevel);
|
|
|
5768 |
mPersistedRunLevelCollection.add(i);
|
|
|
5769 |
}
|
|
|
5770 |
else
|
|
|
5771 |
{
|
|
|
5772 |
try
|
|
|
5773 |
{
|
|
|
5774 |
connect();
|
|
|
5775 |
boolean update = false;
|
|
|
5776 |
{
|
|
|
5777 |
// check if the rcon_id exists in the table
|
|
|
5778 |
CallableStatement stmt = mConnection.prepareCall("select rcon_id from release_manager.run_level where rcon_id=" + rcon_id);
|
|
|
5779 |
ResultSet rset = stmt.executeQuery();
|
| 4123 |
dpurdie |
5780 |
mLogger.warn("updateCurrentRunLevel: checked existance: " + rcon_id);
|
| 814 |
mhunt |
5781 |
|
|
|
5782 |
while( rset.next() )
|
|
|
5783 |
{
|
|
|
5784 |
update = true;
|
|
|
5785 |
}
|
| 830 |
mhunt |
5786 |
|
|
|
5787 |
rset.close();
|
|
|
5788 |
stmt.close();
|
| 814 |
mhunt |
5789 |
}
|
|
|
5790 |
|
| 882 |
mhunt |
5791 |
// the insert flag ensures the insertion is controlled
|
|
|
5792 |
// it should only be set initially in the BuildThread run methods
|
|
|
5793 |
if ( !update && insert )
|
| 814 |
mhunt |
5794 |
{
|
| 864 |
mhunt |
5795 |
|
| 882 |
mhunt |
5796 |
if (isRconIdConfigured( rcon_id ))
|
| 864 |
mhunt |
5797 |
{
|
| 4123 |
dpurdie |
5798 |
mLogger.warn("updateCurrentRunLevel: Must insert: " + rcon_id);
|
| 864 |
mhunt |
5799 |
CallableStatement stmt = mConnection.prepareCall("insert into release_manager.run_level (rcon_id) values (" + rcon_id + ")" );
|
|
|
5800 |
stmt.executeUpdate();
|
|
|
5801 |
stmt.close();
|
|
|
5802 |
}
|
| 814 |
mhunt |
5803 |
}
|
|
|
5804 |
|
|
|
5805 |
{
|
| 886 |
mhunt |
5806 |
// DEVI 52589 provide a keep alive indication
|
| 4123 |
dpurdie |
5807 |
mLogger.warn("updateCurrentRunLevel: Set Runlevel:" + runLevel + ", rcon_id: " + rcon_id);
|
| 886 |
mhunt |
5808 |
PreparedStatement stmt = mConnection.prepareCall("update release_manager.run_level set current_run_level=" + runLevel + ", keep_alive=SYSDATE where rcon_id=" + rcon_id);
|
| 814 |
mhunt |
5809 |
stmt.executeUpdate();
|
| 830 |
mhunt |
5810 |
stmt.close();
|
| 814 |
mhunt |
5811 |
}
|
| 4123 |
dpurdie |
5812 |
mLogger.warn("updateCurrentRunLevel: committing");
|
| 898 |
mhunt |
5813 |
commit();
|
| 4123 |
dpurdie |
5814 |
mLogger.warn("updateCurrentRunLevel: committed");
|
| 814 |
mhunt |
5815 |
}
|
|
|
5816 |
catch( SQLException e )
|
|
|
5817 |
{
|
|
|
5818 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5819 |
{
|
| 868 |
mhunt |
5820 |
mLogger.fatal("updateCurrentRunLevel database access error only");
|
| 882 |
mhunt |
5821 |
throw new SQLException("updateCurrentRunLevel database access error only");
|
| 814 |
mhunt |
5822 |
}
|
|
|
5823 |
else
|
|
|
5824 |
{
|
|
|
5825 |
mLogger.fatal("updateCurrentRunLevel show stopper");
|
| 868 |
mhunt |
5826 |
throw new Exception("updateCurrentRunLevel show stopper");
|
| 814 |
mhunt |
5827 |
}
|
|
|
5828 |
}
|
| 898 |
mhunt |
5829 |
finally
|
|
|
5830 |
{
|
|
|
5831 |
// this block is executed regardless of what happens in the try block
|
|
|
5832 |
// even if an exception is thrown
|
|
|
5833 |
// ensure disconnect
|
|
|
5834 |
disconnect();
|
|
|
5835 |
}
|
| 814 |
mhunt |
5836 |
}
|
|
|
5837 |
}
|
|
|
5838 |
|
| 866 |
mhunt |
5839 |
public void queryBuildExclusions(Vector<BuildExclusion> buildExclusionCollection, int baseline) throws SQLException, Exception
|
|
|
5840 |
{
|
|
|
5841 |
mLogger.debug("queryBuildExclusions " + baseline);
|
|
|
5842 |
|
|
|
5843 |
if ( !mUseDatabase )
|
|
|
5844 |
{
|
|
|
5845 |
mLogger.info("queryBuildExclusions !mUseDatabase");
|
|
|
5846 |
}
|
|
|
5847 |
else
|
|
|
5848 |
{
|
|
|
5849 |
try
|
|
|
5850 |
{
|
|
|
5851 |
CallableStatement stmt = mConnection.prepareCall("select pv_id, root_pv_id, root_cause from release_manager.do_not_ripple where rtag_id=" + baseline);
|
|
|
5852 |
ResultSet rset = stmt.executeQuery();
|
|
|
5853 |
|
|
|
5854 |
while( rset.next() )
|
|
|
5855 |
{
|
|
|
5856 |
int pvId = rset.getInt("pv_id");
|
|
|
5857 |
|
|
|
5858 |
if ( rset.wasNull() )
|
|
|
5859 |
{
|
|
|
5860 |
mLogger.fatal("queryBuildExclusions rset null pv_id");
|
|
|
5861 |
// show stopper
|
| 868 |
mhunt |
5862 |
throw new Exception("queryBuildExclusions rset null pv_id");
|
| 866 |
mhunt |
5863 |
}
|
|
|
5864 |
|
|
|
5865 |
int rootPvId = rset.getInt("root_pv_id");
|
|
|
5866 |
|
|
|
5867 |
if ( rset.wasNull() )
|
|
|
5868 |
{
|
|
|
5869 |
// quite acceptable
|
|
|
5870 |
rootPvId = -1;
|
|
|
5871 |
}
|
|
|
5872 |
|
|
|
5873 |
// again, a null root_cause is quite acceptable
|
|
|
5874 |
String rootCause = rset.getString("root_cause");
|
|
|
5875 |
|
| 908 |
mhunt |
5876 |
// force email notification by using a zero test build instruction
|
|
|
5877 |
BuildExclusion buildExclusion = new BuildExclusion(pvId, rootPvId, rootCause, 0);
|
| 866 |
mhunt |
5878 |
buildExclusionCollection.add(buildExclusion);
|
|
|
5879 |
}
|
|
|
5880 |
|
|
|
5881 |
rset.close();
|
|
|
5882 |
stmt.close();
|
|
|
5883 |
}
|
|
|
5884 |
catch ( SQLException e )
|
|
|
5885 |
{
|
|
|
5886 |
if ( mConnection == null || ( mConnection != null && !mConnection.isValid(10) ) )
|
|
|
5887 |
{
|
|
|
5888 |
mLogger.error("queryBuildExclusions database access error only");
|
|
|
5889 |
throw new SQLException();
|
|
|
5890 |
}
|
|
|
5891 |
else
|
|
|
5892 |
{
|
|
|
5893 |
mLogger.fatal("queryBuildExclusions show stopper");
|
| 868 |
mhunt |
5894 |
throw new Exception("queryBuildExclusions show stopper");
|
| 866 |
mhunt |
5895 |
}
|
|
|
5896 |
}
|
|
|
5897 |
}
|
|
|
5898 |
}
|
| 814 |
mhunt |
5899 |
}
|