| Line 38... |
Line 38... |
| 38 |
'------------ Variable Init -------------------
|
38 |
'------------ Variable Init -------------------
|
| 39 |
'----------------------------------------------
|
39 |
'----------------------------------------------
|
| 40 |
%>
|
40 |
%>
|
| 41 |
<%
|
41 |
<%
|
| 42 |
Sub Populate_depArray_from_Import ( SSdep_import, ARRdep, BBarray_is_empty )
|
42 |
Sub Populate_depArray_from_Import ( SSdep_import, ARRdep, BBarray_is_empty )
|
| 43 |
Dim depList, lastItem, i, recCnt, pkg_name, pkg_version
|
43 |
Dim recCnt, pkg_name, pkg_version, build_type, re, Matches, Match
|
| 44 |
|
44 |
|
| 45 |
If (SSdep_import = "") Then Exit Sub ' exit if no dependencies are submited
|
45 |
If (SSdep_import = "") Then Exit Sub ' exit if no dependencies are submited
|
| 46 |
|
46 |
|
| 47 |
' Decode Server.URLEncode if present
|
47 |
' Decode Server.URLEncode if present
|
| 48 |
SSdep_import = URLDecode( SSdep_import )
|
48 |
SSdep_import = URLDecode( SSdep_import )
|
| Line 50... |
Line 50... |
| 50 |
SSdep_import = Replace(SSdep_import, " ", "") ' remove spaces
|
50 |
SSdep_import = Replace(SSdep_import, " ", "") ' remove spaces
|
| 51 |
SSdep_import = Replace(SSdep_import, VBTab, "") ' remove horizontal tabs
|
51 |
SSdep_import = Replace(SSdep_import, VBTab, "") ' remove horizontal tabs
|
| 52 |
SSdep_import = Replace(SSdep_import, VBVerticalTab, "") ' remove vertical tabs
|
52 |
SSdep_import = Replace(SSdep_import, VBVerticalTab, "") ' remove vertical tabs
|
| 53 |
SSdep_import = Replace(SSdep_import, """", "'") ' replace " with '
|
53 |
SSdep_import = Replace(SSdep_import, """", "'") ' replace " with '
|
| 54 |
|
54 |
|
| - |
|
55 |
Set re = New RegExp
|
| - |
|
56 |
re.IgnoreCase = True
|
| - |
|
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
|
| - |
|
65 |
'#LinkPkgArchive ( 'debian_dpkg' , '1.13.25000.cots' );
|
| - |
|
66 |
'LinkPkgArchive ( 'debian_packager' , '1.1.0000.cr' );
|
| - |
|
67 |
|
| - |
|
68 |
re.Pattern = "(^|\n)\s*([_A-Za-z0-9]+)\s*\(\s*\'([-_A-Za-z0-9 ]*)\'\s*\,\s*\'([-_.A-Za-z0-9 ]*)\'\s*\)"
|
| 55 |
depList = Split( SSdep_import, "'")
|
69 |
Set Matches = re.Execute(SSdep_import)
|
| 56 |
|
70 |
|
| 57 |
recCnt = 0
|
71 |
recCnt=0
|
| 58 |
lastItem = UBound(depList)
|
72 |
For Each Match in Matches
|
| 59 |
For i = 1 To lastItem Step 4
|
73 |
build_type = Match.SubMatches(1)
|
| 60 |
pkg_name = depList(i)
|
74 |
pkg_name = Match.SubMatches(2)
|
| 61 |
pkg_version = depList(i+2)
|
75 |
pkg_version = Match.SubMatches(3)
|
| 62 |
|
76 |
|
| 63 |
' Proceed only if:
|
77 |
' Proceed only if:
|
| 64 |
' pkg name is not empty,
|
78 |
' pkg name is not empty,
|
| 65 |
' pkg version is not empty,
|
79 |
' pkg version is not empty,
|
| 66 |
' line is not commented out with #
|
- |
|
| 67 |
|
- |
|
| 68 |
If ( pkg_name <> "" ) AND ( pkg_version <> "" ) AND (InStr(depList(i-1), "#") = 0) Then
|
80 |
If ( pkg_name <> "" ) AND ( pkg_version <> "" ) Then
|
| 69 |
ReDim Preserve ARRdep( 2, recCnt )
|
81 |
ReDim Preserve ARRdep( 2, recCnt )
|
| 70 |
ARRdep( COL_pkg_name, recCnt ) = pkg_name
|
82 |
ARRdep( COL_pkg_name, recCnt ) = pkg_name
|
| 71 |
ARRdep( COL_pkg_version, recCnt ) = pkg_version
|
83 |
ARRdep( COL_pkg_version, recCnt ) = pkg_version
|
| 72 |
|
- |
|
| 73 |
' Define build type
|
84 |
' Define build type
|
| 74 |
If InStr(depList(i-1), "BuildPkgArchive") > 0 Then
|
85 |
If LCase(build_type) = LCase("BuildPkgArchive") Then
|
| 75 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE
|
86 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE
|
| 76 |
|
- |
|
| 77 |
ElseIf InStr(depList(i-1), "LinkPkgArchive") > 0 Then
|
87 |
ElseIf LCase(build_type) = LCase("LinkPkgArchive") Then
|
| 78 |
ARRdep( COL_build_type, recCnt ) = enum_LINK_PKG_ARCHIVE
|
88 |
ARRdep( COL_build_type, recCnt ) = enum_LINK_PKG_ARCHIVE
|
| 79 |
|
- |
|
| 80 |
Else
|
89 |
Else
|
| 81 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE 'neither build_package or link_package is found, hence set to...
|
90 |
ARRdep( COL_build_type, recCnt ) = enum_BUILD_PKG_ARCHIVE 'neither build_package or link_package is found, hence set to...
|
| 82 |
|
- |
|
| 83 |
End If
|
91 |
End If
|
| 84 |
|
- |
|
| 85 |
recCnt = recCnt + 1
|
92 |
recCnt = recCnt + 1
|
| 86 |
BBarray_is_empty = FALSE
|
93 |
BBarray_is_empty = FALSE
|
| 87 |
End If
|
94 |
End If
|
| 88 |
|
- |
|
| 89 |
Next
|
95 |
Next
|
| 90 |
|
96 |
|
| 91 |
End Sub
|
97 |
End Sub
|
| 92 |
|
98 |
|
| 93 |
' This function is called when update_type is "add_custom". This is only the case when adding dependencies
|
99 |
' This function is called when update_type is "add_custom". This is only the case when adding dependencies
|