Subversion Repositories DevTools

Rev

Rev 151 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 151 Rev 161
Line 113... Line 113...
113
         " PK_RELEASE.CAN_USER_WRITE_TO_RELEASE ( :RTAG_ID, :RETPV_ID, :ALTER_RELEASE ); "&_
113
         " PK_RELEASE.CAN_USER_WRITE_TO_RELEASE ( :RTAG_ID, :RETPV_ID, :ALTER_RELEASE ); "&_
114
         " PK_ENVIRONMENT.REPLACE_PACKAGE ( :RETPV_ID, :ORIG_PV_ID, :RTAG_ID, :USER_ID ); "&_
114
         " PK_ENVIRONMENT.REPLACE_PACKAGE ( :RETPV_ID, :ORIG_PV_ID, :RTAG_ID, :USER_ID ); "&_
115
         "END;"
115
         "END;"
116
 
116
 
117
         retNEWpv_id = OraDatabase.Parameters("RETPV_ID").Value
117
         retNEWpv_id = OraDatabase.Parameters("RETPV_ID").Value
-
 
118
 
-
 
119
        Call UpdateSubVersionSrcPath(retNEWpv_id)
-
 
120
 
118
      End If
121
      End If
119
   Else
122
   Else
120
      OraDatabase.ExecuteSQL _
123
      OraDatabase.ExecuteSQL _
121
      "BEGIN "&_
124
      "BEGIN "&_
122
      " PK_PACKAGE.NEW_VERSION ( :ORIG_PV_ID, "&_
125
      " PK_PACKAGE.NEW_VERSION ( :ORIG_PV_ID, "&_
Line 130... Line 133...
130
      " PK_RELEASE.CAN_USER_WRITE_TO_RELEASE ( :RTAG_ID, :RETPV_ID, :ALTER_RELEASE ); "&_
133
      " PK_RELEASE.CAN_USER_WRITE_TO_RELEASE ( :RTAG_ID, :RETPV_ID, :ALTER_RELEASE ); "&_
131
      " PK_ENVIRONMENT.REPLACE_PACKAGE ( :RETPV_ID, :ORIG_PV_ID, :RTAG_ID, :USER_ID ); "&_
134
      " PK_ENVIRONMENT.REPLACE_PACKAGE ( :RETPV_ID, :ORIG_PV_ID, :RTAG_ID, :USER_ID ); "&_
132
      "END;"
135
      "END;"
133
 
136
 
134
      retNEWpv_id = OraDatabase.Parameters("RETPV_ID").Value
137
      retNEWpv_id = OraDatabase.Parameters("RETPV_ID").Value
-
 
138
 
-
 
139
      Call UpdateSubVersionSrcPath(retNEWpv_id)
-
 
140
 
135
   End If
141
   End If
136
 
142
 
137
   objEH.CatchORA ( OraSession )
143
   objEH.CatchORA ( OraSession )
138
   If objEH.LastOraFailed = FALSE Then
144
   If objEH.LastOraFailed = FALSE Then
139
      Call UpdateChangeType (retNEWpv_id, Request("change_type"))
145
      Call UpdateChangeType (retNEWpv_id, Request("change_type"))
Line 213... Line 219...
213
   End If
219
   End If
214
 
220
 
215
   Set objRegEx = Nothing
221
   Set objRegEx = Nothing
216
   Set objRegEx2 = Nothing
222
   Set objRegEx2 = Nothing
217
End Function
223
End Function
-
 
224
 
218
'---------------------------------------------------------------
225
'---------------------------------------------------------------
219
Function VersionHasCotsExtension ( newVersion )
226
Function VersionHasCotsExtension ( newVersion )
220
   VersionHasCotsExtension = False
227
   VersionHasCotsExtension = False
221
 
228
 
222
   Dim myRegExp
229
   Dim myRegExp
Line 228... Line 235...
228
      VersionHasCotsExtension = True
235
      VersionHasCotsExtension = True
229
   End If
236
   End If
230
 
237
 
231
   Set myRegExp = Nothing
238
   Set myRegExp = Nothing
232
End Function
239
End Function
-
 
240
 
-
 
241
'---------------------------------------------------------------
-
 
242
Function IsCotsPatch ( apv_id, achange_type)
-
 
243
   '--- get old package version ---
-
 
244
   Dim rsQry, Query_String
-
 
245
   Dim pkg_version_old
-
 
246
   Query_string = " SELECT pv.pkg_version FROM package_versions pv WHERE pv.pv_id = "& apv_id
-
 
247
   Set rsQry = OraDatabase.DbCreateDynaset(Query_String, cint(0))
-
 
248
   pkg_version_old = rsQry("pkg_version")
-
 
249
   rsQry.Close()
-
 
250
   Set rsQry = Nothing
-
 
251
   
-
 
252
   Dim myRegExp
-
 
253
   Set myRegExp = New RegExp
-
 
254
   ' Must be a patch and the version must have a patch build number, ie a dot and at least 4 digits before the cots extenstion.
-
 
255
   myRegExp.Pattern = "\.\d{4,}\.cots$"
-
 
256
   IsCotsPatch = myRegExp.Test( pkg_version_old ) and (achange_type = "P")
-
 
257
   Set myRegExp = Nothing      
-
 
258
End Function
-
 
259
 
233
'---------------------------------------------------------------
260
'---------------------------------------------------------------
-
 
261
'Returns a new subversion package source path string by replacing or adding
-
 
262
'the specified label to the specified subversion package source path string.
-
 
263
Function  GetNewSvnSrcPath(asrc_path, alabel)
-
 
264
  Dim ssrc_base
-
 
265
  Dim snew_src_path
-
 
266
  Dim ssrc_path
-
 
267
  Dim slast_char
-
 
268
  Dim i,j
-
 
269
 
-
 
270
  if IsNull(asrc_path) then
-
 
271
    ssrc_path = ""
-
 
272
  else
-
 
273
    ssrc_path = asrc_path
-
 
274
  end if
-
 
275
  
-
 
276
  'get project directory from current package source path, ie path above either "tags" or "branches" or "trunk" directory
-
 
277
  i = InStrRev(LCase(ssrc_path), "/tags")
-
 
278
  if i = 0 then
-
 
279
    i = InStrRev(LCase(ssrc_path), "/branches")
-
 
280
    if i = 0 then
-
 
281
      i = InStrRev(LCase(ssrc_path), "/trunk")
-
 
282
    end if
-
 
283
  end if
-
 
284
  
-
 
285
  if i = 0 then
-
 
286
    '"tags" or "branches" or "trunk" not found
-
 
287
    'use current package source path as the project directory
-
 
288
    ssrc_base = ssrc_path
-
 
289
      
-
 
290
    'ensure project directory ends in a slash
-
 
291
    j = Len(ssrc_base)
-
 
292
    slast_char = Right(ssrc_base,1)
-
 
293
    if (j > 0) and (slast_char <> "/") then
-
 
294
      ssrc_base = ssrc_base & "/"
-
 
295
    end if
-
 
296
  else
-
 
297
    '"tags" or "branches" or "trunk" found so extract project directory
-
 
298
    ssrc_base = Mid(ssrc_path,1,i)
-
 
299
  end if
-
 
300
 
-
 
301
  'append new directory to the default project directory string.
-
 
302
  'the default path will be <project directory>/branches/<label>
-
 
303
  snew_src_path = ssrc_base & "branches/" & alabel
-
 
304
    
-
 
305
  GetNewSvnSrcPath = snew_src_path
-
 
306
  
-
 
307
End Function
-
 
308
 
-
 
309
'------------------------------------------------------------------
-
 
310
'This function is used to create the default package source path
-
 
311
'string when a new SubVersion package version is added.
-
 
312
'Assumes the specified pv_id is for a subversion package
-
 
313
Sub UpdateSubVersionSrcPath(apv_id)
-
 
314
  Dim rsQry
-
 
315
  Dim anew_src_path
-
 
316
  Dim ivcs_type_id
-
 
317
  Dim apkg_label
-
 
318
  Dim asrc_path
-
 
319
  Dim ssql
-
 
320
 
-
 
321
  'select the package and ensure it is a subversion package
-
 
322
  ssql = "SELECT * FROM PACKAGE_VERSIONS WHERE PV_ID ="& apv_id &" AND VCS_TYPE_ID=23"
-
 
323
 
-
 
324
  Set rsQry = OraDatabase.DbCreateDynaset(ssql, cint(0))
-
 
325
 
-
 
326
  If rsQry.RecordCount > 0 Then
-
 
327
    ivcs_type_id = rsQry("vcs_type_id")
-
 
328
    'pkg_label contains the new auto generated label for this version
-
 
329
    apkg_label = rsQry("pkg_label")
-
 
330
    asrc_path = rsQry("src_path")
-
 
331
    anew_src_path = GetNewSvnSrcPath(asrc_path,apkg_label)
-
 
332
 
-
 
333
    OraDatabase.ExecuteSQL _
-
 
334
      "BEGIN "&_
-
 
335
      " UPDATE PACKAGE_VERSIONS SET SRC_PATH ='"& anew_src_path &"' WHERE PV_ID ="& apv_id &"; "&_
-
 
336
      "END;"
-
 
337
  End If
-
 
338
 
-
 
339
  rsQry.Close()
-
 
340
  Set rsQry = nothing
-
 
341
  
-
 
342
End Sub
-
 
343
 
-
 
344
'-----------------------------------------------------------------------------------
234
%>
345
%>
235
<%
346
<%
236
'-----------------------  MAIN LINE  ---------------------------
347
'-----------------------  MAIN LINE  ---------------------------
237
Dim rsQry, Query_String, Record_Count
348
Dim rsQry, Query_String, Record_Count
238
Dim versionToSanityCheck
349
Dim versionToSanityCheck
239
'--- Process submission ---
-
 
240
 
350
 
-
 
351
'--- Process submission ---
241
If Request("build_type") = "A" AND VersionHasCotsExtension( parFRnewver ) Then
352
If Request("build_type") = "A" AND VersionHasCotsExtension(parFRnewver) AND NOT (IsCotsPatch(parOLDpv_id,Request("change_type"))) Then
242
   Call RaiseMsg ( enum_MSG_CANNOT_AUTO_GENERATE_COTS_PKG&"?rtag_id="& parRtag_id &"&pv_id="& parOLDpv_id &"", parFRnewver)
353
  Call RaiseMsg ( enum_MSG_CANNOT_AUTO_GENERATE_COTS_PKG&"?rtag_id="& parRtag_id &"&pv_id="& parOLDpv_id &"", parFRnewver)
243
Else
354
Else
244
   If (parOLDpv_id <> "") AND ( (parFRnewver <> "") OR (parSetToPv_id <> "") ) AND (parRtag_id <> "") Then
355
   If (parOLDpv_id <> "") AND ( (parFRnewver <> "") OR (parSetToPv_id <> "") ) AND (parRtag_id <> "") Then
245
      ' All mandatory parameters FOUND
356
      ' All mandatory parameters FOUND
246
 
357
 
247
      If ( (parSetToPv_id <> "") OR SanityCheck(parFRnewver) ) Then
358
      If ( (parSetToPv_id <> "") OR SanityCheck(parFRnewver) ) Then