Subversion Repositories DevTools

Rev

Rev 5506 | Rev 5895 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5506 Rev 5893
Line 1... Line 1...
1
<%@LANGUAGE="VBSCRIPT"%>
1
<%@LANGUAGE="VBSCRIPT"%>
2
<%
2
<%
3
'=====================================================
3
'=====================================================
4
'              UPDATE dependencies
4
'               UPDATE dependencies
-
 
5
'               _update_dependencies.asp
5
'               --- PROCESS FORM ---
6
'               --- PROCESS FORM ---
6
'=====================================================
7
'=====================================================
7
%>
8
%>
8
<%
9
<%
9
Option explicit
10
Option explicit
Line 37... Line 38...
37
Const COL_build_type = 2
38
Const COL_build_type = 2
38
'------------ Variable Init -------------------
39
'------------ Variable Init -------------------
39
'----------------------------------------------
40
'----------------------------------------------
40
%>
41
%>
41
<%
42
<%
42
Sub Populate_depArray_from_Import ( SSdep_import, ARRdep, BBarray_is_empty )
-
 
43
   Dim recCnt, pkg_name, pkg_version, build_type, re, Matches, Match
-
 
44
 
-
 
45
   If (SSdep_import = "") Then Exit Sub      ' exit if no dependencies are submited
-
 
46
 
43
'
47
   ' Decode Server.URLEncode if present
-
 
48
   SSdep_import = URLDecode( SSdep_import )
-
 
49
 
-
 
50
   SSdep_import = Replace(SSdep_import, " ", "")            ' remove spaces
-
 
51
   SSdep_import = Replace(SSdep_import, VBTab, "")          ' remove horizontal tabs
-
 
52
   SSdep_import = Replace(SSdep_import, VBVerticalTab, "")  ' remove vertical tabs
-
 
53
   SSdep_import = Replace(SSdep_import, """", "'")          ' replace " with '
-
 
54
 
-
 
55
   Set re = New RegExp
-
 
56
   re.IgnoreCase = True
44
'   Populate from a form
57
   re.Global = True
-
 
58
 
-
 
59
   'The following regular expression captures the package name and version on each matching line.
-
 
60
   'The following is an example of the format of the input string, SSdep_import.
-
 
61
   '
-
 
62
   'BuildPkgArchive ( 'linux_kernel_viper'  , '2.6.24.6.5000.cots' );
-
 
63
   '
-
 
64
   '#   Packages for creating the debian package
45
'       Assumes that items are seqentially numbered starting at 1
65
   '#LinkPkgArchive  ( 'debian_dpkg'         , '1.13.25000.cots' );
46
Sub Populate_depArray_from_Import ( ARRdep, BBarray_is_empty )
66
   'LinkPkgArchive  ( 'debian_packager'     , '1.1.0000.cr' );
-
 
67
   'LinkPkgArchive  ( 'Jasper Patch (JBoss/Tomcat Hotfix)' , '1.6.0,REV=2006.11.29.02.51' );
-
 
68
   'LinkPkgArchive  ( 'Java 2 SDK, Enterprise Edition (J2EE)' , '1.6.0,REV=2006.11.29.02.51' );
-
 
69
   '
-
 
70
   ' Note. Ant dependencies are formatted to look like:
47
   Dim recCnt, pkg_name, pkg_version, build_type
71
   '    AntStyle('PackageName','PackageVersion');
-
 
72
 
-
 
73
   re.Pattern = "(^|\n)\s*([_A-Za-z0-9]+)\s*\(\s*\'([^\']*)\'\s*\,\s*\'([^\']*)\'\s*\)"
-
 
74
   Set Matches = re.Execute(SSdep_import)
-
 
75
 
48
 
76
   recCnt=0
49
   recCnt=0
77
   For Each Match in Matches
50
   BBarray_is_empty = true
78
     build_type = Match.SubMatches(1)
51
   Do While TRUE
79
     pkg_name = Match.SubMatches(2)
52
       pkg_name = Request("btName" & recCnt + 1)
80
     pkg_version = Match.SubMatches(3)
53
       pkg_version = Request("pkgn" & recCnt + 1)
-
 
54
       build_type = Request("bt" & recCnt + 1)
81
 
55
     
82
      ' Proceed only if:
56
          ' Proceed only if:
83
      '    pkg name is not empty,
57
          '    pkg name is not empty,
84
      '    pkg version is not empty,
58
          '    pkg version is not empty,
85
      If ( pkg_name <> "" )  AND  ( pkg_version <> "" ) Then
59
          If ( pkg_name <> "" )  AND  ( pkg_version <> "" ) Then
86
         ReDim Preserve ARRdep( 2, recCnt )
60
             ReDim Preserve ARRdep( 2, recCnt )
87
         ARRdep( COL_pkg_name, recCnt ) = pkg_name
61
             ARRdep( COL_pkg_name, recCnt ) = pkg_name
88
         ARRdep( COL_pkg_version, recCnt ) = pkg_version
62
             ARRdep( COL_pkg_version, recCnt ) = pkg_version
89
         ' Define build type
-
 
90
         If LCase(build_type) = LCase("BuildPkgArchive") Then
-
 
91
            ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE
63
             ARRdep( COL_build_type, recCnt ) = build_type
92
         ElseIf LCase(build_type) = LCase("LinkPkgArchive") Then
64
             recCnt = recCnt + 1
93
            ARRdep( COL_build_type, recCnt ) = enum_LINK_PKG_ARCHIVE
65
             BBarray_is_empty = FALSE
94
         Else
66
         Else
95
            ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE   'neither build_package or link_package is found, hence set to...
67
            Exit Do
96
         End If
68
         End If
97
         recCnt = recCnt + 1
-
 
98
         BBarray_is_empty = FALSE
-
 
99
     End If
-
 
100
   Next
69
   Loop
101
 
-
 
102
End Sub
70
End Sub
103
 
71
 
104
' This function is called when update_type is "add_custom". This is only the case when adding dependencies
72
' This function is called when update_type is "add_custom". This is only the case when adding dependencies
105
' The list given via the actual parameter pkg_list is in fact a list of pv_id's supplied from the form_search_result_pkgs.asp
73
' The list given via the actual parameter pkg_list is in fact a list of pv_id's supplied from the form_search_result_pkgs.asp
106
' and form_add_pkg_versions.asp files. In the past, it only ever used to be a list of package IDs, but this has now been
74
' and form_add_pkg_versions.asp files. In the past, it only ever used to be a list of package IDs, but this has now been
Line 188... Line 156...
188
      rsTemp.MoveNext
156
      rsTemp.MoveNext
189
   WEnd
157
   WEnd
190
 
158
 
191
   rsTemp.Close
159
   rsTemp.Close
192
   Set rsTemp = nothing
160
   Set rsTemp = nothing
-
 
161
 
193
End Sub
162
End Sub
194
 
163
 
195
Sub Update_Package_Dependencies ( ARRdep, NNpv_id, NNuser_id, NNdelete_old_dependency, sAction_type, sDependBlock )
164
Sub Update_Package_Dependencies ( ARRdep, NNpv_id, NNuser_id, NNdelete_old_dependency, sAction_type, sDependBlock )
196
   Dim i, OraParameter, sComments
165
   Dim i, OraParameter, sComments
197
 
166
 
Line 332... Line 301...
332
      If ((NOT array_is_empty) AND (Err.number = 0)) Then
301
      If ((NOT array_is_empty) AND (Err.number = 0)) Then
333
         Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_update", sDependBlock )
302
         Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_update", sDependBlock )
334
      End If
303
      End If
335
 
304
 
336
 
305
 
337
   Else
306
   ElseIf Request("update_type") = "edit_import" Then
338
      '---- JATS, ANT dependency import ----
307
      '-- JATS,ANT dependency import after being edited
339
      Call Populate_depArray_from_Import ( Request("FRdeps"), depArray, array_is_empty )
308
      Call Populate_depArray_from_Import ( depArray, array_is_empty )
340
      Call Remove_Old_Dependencies ( Request("pv_id") )
309
      Call Remove_Old_Dependencies ( Request("pv_id") )
341
 
310
 
342
      If ((NOT array_is_empty) AND (Err.number = 0)) Then
311
      If ((NOT array_is_empty) AND (Err.number = 0)) Then
343
         Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_import", Request("FRdeps") )
312
         Call Update_Package_Dependencies ( depArray, Request("pv_id"), objAccessControl.UserId, enumlocal_DONOT_DELETE_OLD_DEPENDENCIES, "depend_import", Request("FRdeps") )
344
      End If
313
      End If
345
 
314
   Else
-
 
315
      '---- Unknown input type
-
 
316
        Response.write "Internal error. Unknown update_type!" & "<br>" 'TODO
-
 
317
        Err.number = 1
346
   End If
318
   End If
347
 
319
 
348
 
320
 
349
   If Err.number = 0 Then
321
   If Err.number = 0 Then
350
      Call Update_Mod_Details ( Request("pv_id") )
322
      Call Update_Mod_Details ( Request("pv_id") )