Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
29 jtweddle 1
<?xml version="1.0" ?>
2
<package>
3
	<comment>
4
	PrimalCode wizard generated file.
5
	</comment>
6
	<job id="CheckForUnitTests" args="/bom_id:2864" prompt="no">
7
		<?job error="false" debug="false" ?>
8
		<runtime>
9
			<named helpstring="Bom ID" name="bom_id" required="false" type="string"/>
10
		</runtime>
11
		<object id="Oracle_Objects_For_OLE" progid="OracleInProcServer.XOraServer" events="true"/>
12
		<script language="VBScript" src="common_subs.vbs"/>
13
		<script language="VBScript" src="config.vbs"/>
14
 
15
		<script language="VBScript" src="pkg_archive.vbs"/>
16
		<script id="CheckForPackageVersions" language="VBScript">
17
<![CDATA[
18
Option Explicit
19
'=====================================================
20
'        Name: 	GetComponents
21
' Description:	Connects to dpkg_archive and gets the
22
' 				content of folders and files of certain
23
' 				package. It then stores this info into 
24
'				Release Manager database. This info can
25
' 				later be included in release notes Or
26
' 				searched with search engine.
27
' 		INPUT:  pkg_name
28
'				pkg_version
29
'=====================================================
30
 
31
'== Variable Definition ==============================
32
Dim BomId
33
Dim CompareBomId
34
Dim UserName
35
Dim objArgs
36
 
37
'== Constants Declaration ============================
38
'== Variable Init ====================================
39
'=====================================================
40
 
41
'-----------------------------------------------------------------------------------------------------------------
42
Sub CheckForPackageVersions ( nBomId, nCompareBomId, sUserName )
43
	Dim rsQry, rsTemp, rsDep, aPackages, XMLNode, DateString, objPkgFileSys, sSourcePath, sDestPath, oFileSys
44
	Dim lastRow, row, MappedDrive, objMessage, strBody, strHTML, isPatch, pkgName
45
	Dim outUser, outPassword, command, login_details
46
 
47
	Set oFileSys = CreateObject("Scripting.FileSystemObject")	
48
 
49
	OraDatabase.Parameters.Add "BOM_ID", nBomId, ORAPARM_INPUT, ORATYPE_NUMBER 
50
	OraDatabase.Parameters.Add "COMPARE_BOM_ID", nCompareBomId, ORAPARM_INPUT, ORATYPE_NUMBER 
51
 
52
	Set rsTemp = OraDatabase.DbCreateDynaset( GetQuery ("BomLocationDetails.sql"), ORADYN_DEFAULT ) 
53
 
54
	Set rsQry = OraDatabase.DbCreateDynaset( GetQuery ("BomCompare.sql"), ORADYN_DEFAULT )
55
 
56
	OraDatabase.Parameters.Remove "BOM_ID"
57
	OraDatabase.Parameters.Remove "COMPARE_BOM_ID"
58
 
59
 
60
	Set objPkgFileSys = New PkgArchive
61
 
62
	objPkgFileSys.Map_Network_Drive  UNC_ARCHIVE, MappedDrive 	' Map Drive if required
63
 
64
	objPkgFileSys.Remote_Host = TELNET_MACHINE
65
 
66
	objPkgFileSys.Archive_Path = TELNET_RELEASES
67
 
68
 
69
 
70
	If rsQry.RecordCount > 0 Then
71
		aPackages = rsQry.GetRows()
72
 
73
	End If
74
 
75
	lastRow = UBound( aPackages, 2 )
76
	DateString = DateReversed( Date )
77
 
78
	'strBody = NULL
79
 
80
 
81
 
82
 
83
	For row = 0 To lastRow	
84
		isPatch = aPackages (7, row)
85
 
86
		If isPatch = "Y" Then
87
			Set rsDep = OraDatabase.DbCreateDynaset( "select * from package_dependencies pd, package_versions pv where pd.dpv_id = pv.pv_id and pd.pv_id ="&aPackages(0, row), ORADYN_DEFAULT )
88
			sSourcePath = "\\auperaunx26\releases\"&rsTemp("proj_name")&"\"&rsTemp("branch_name")&"\"&aPackages(1, row)&"\"&rsDep("pkg_version")	
89
			rsDep.Close()
90
			Set rsDep = nothing
91
		Else
92
			sSourcePath = "\\auperaunx26\releases\"&rsTemp("proj_name")&"\"&rsTemp("branch_name")&"\"&aPackages(1, row)&"\"&aPackages(6, row)&"\"&aPackages(2, row)	
93
		End If
94
 
95
 
96
		If oFileSys.FolderExists( sSourcePath ) Then
97
			objPkgFileSys.Make_Zip aPackages(1, row) &"-"& aPackages(2, row) &"-" & aPackages(6, row) &".zip", "/devl/releases/"& rsTemp("proj_name") &"/"& rsTemp("branch_name") &"/"& aPackages(1, row) &"/"& aPackages(6, row) &"/"& aPackages(2, row)&"/"
98
		Else
99
			'Wscript.Echo pkgName
100
			If pkgName = aPackages(1, row) Then
101
				strBody = strBody + "<br>Version: "&aPackages(2, row) 
102
			Else
103
				strBody = strBody + "<br><br>"
104
				strBody = strBody + "Project: "&rsTemp("proj_name")
105
				strBody = strBody + "<br>Branch: "&rsTemp("branch_name") 
106
				strBody = strBody + "<br>Package: "&aPackages(1, row)
107
				strBody = strBody + "<br>Version: "&aPackages(2, row)	
108
			End If
109
		End If
110
		pkgName = aPackages(1, row)
111
	Next
112
 
113
	If strBody <> "" Then
114
 
115
		strHTML = "<HTML>"
116
		strHTML = strHTML & "<HEAD>"
117
		strHTML = strHTML & "<BODY>"
118
		strHTML = strHTML & "<b>"&strBody&"</b></br>"
119
		strHTML = strHTML & "</BODY>"
120
		strHTML = strHTML & "</HTML>"
121
 
122
		Set objMessage = CreateObject("CDO.Message") 
123
		objMessage.Subject = "Missing Packages In Releases Area" 
124
		objMessage.From = "releasem@erggroup.com" 'System Administrators 
125
		objMessage.To = sUserName&"@erggroup.com" 'BOM Releasor  
126
		'Wscript.Echo strHTML
127
 
128
		'The line below shows how to send using HTML included directly in your script
129
		objMessage.HTMLBody = strHTML
130
 
131
		objMessage.Configuration.Fields.Item _
132
		("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2
133
 
134
		'IP of remote SMTP server for ERG
135
		objMessage.Configuration.Fields.Item _
136
		("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
137
		= "aupera03.aupera.erggroup.com"
138
 
139
		'Server port = 25
140
		objMessage.Configuration.Fields.Item _
141
		("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
142
		= 25 
143
 
144
		objMessage.Configuration.Fields.Update
145
 
146
		objMessage.Send()
147
 
148
		Set objMessage = Nothing
149
 
150
	End If
151
 
152
 
153
 
154
	Set objPkgFileSys = Nothing
155
	Set oFileSys = Nothing
156
 
157
	rsQry.Close()
158
	rsTemp.Close()
159
 
160
	Set rsQry = Nothing
161
	Set rsTemp = Nothing
162
 
163
 
164
 
165
 
166
 
167
End Sub
168
'-----------------------------------------------------------------------------------------------------------------
169
 
170
 
171
Function FormatFileName ( sFileName )
172
	Dim sReturn
173
 
174
	sReturn = Replace ( sFileName, "/", "" ) 	
175
	sReturn = Replace ( sReturn, "\", "" ) 	
176
	sReturn = Replace ( sReturn, "&", "And" ) 	
177
	sReturn = Replace ( sReturn, " ", "_" ) 	
178
 
179
	FormatFileName = sReturn
180
 
181
End Function
182
'-----------------------------------------------------------------------------------------------------------------
183
 
184
 
185
 
186
 
187
'=================================== MAIN LINE ======================================
188
WScript.Echo "==================== job:CheckForUnitTests ===================="
189
 
190
Set objArgs = WScript.Arguments
191
 
192
If (objArgs.Unnamed.Count > 0) Then
193
	Wscript.Echo "ERROR: Unnamed parameters!"
194
	objArgs.ShowUsage
195
   	WScript.Quit
196
 
197
Else
198
	BomId = objArgs.Named.Item("bom_id")
199
	CompareBomId = objArgs.Named.Item("compare_bom_id")
200
	UserName = objArgs.Named.Item("user_name")
201
 
202
	If ( BomId <> "" ) And (CompareBomId <> "") And (UserName <> "") Then
203
		'Check if the Package Versions Exists for Tests to be Uploaded.  
204
		Call CheckForPackageVersions( BomId, CompareBomId, UserName )
205
   	Else
206
   		objArgs.ShowUsage
207
   		WScript.Quit
208
 
209
   	End If
210
 
211
End If
212
 
213
 
214
WScript.Echo "Job completed successfully!"
215
 
216
'====================================================================================
217
 
218
 
219
]]>
220
		</script>
221
	</job>
222
</package>