1 # |
|
2 # Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 # All rights reserved. |
|
4 # This component and the accompanying materials are made available |
|
5 # under the terms of "Eclipse Public License v1.0" |
|
6 # which accompanies this distribution, and is available |
|
7 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 # |
|
9 # Initial Contributors: |
|
10 # Nokia Corporation - initial contribution. |
|
11 # |
|
12 # Contributors: |
|
13 # |
|
14 # Description: |
|
15 # |
|
16 |
|
17 use FindBin; |
|
18 use lib "$FindBin::Bin"; |
|
19 use LWP::UserAgent; |
|
20 use Getopt::Long; |
|
21 |
|
22 my($tcl_delta_cache, $log_dir, $product, $number); |
|
23 |
|
24 GetOptions ( |
|
25 'tcl_delta_cache=s' => \$tcl_delta_cache, |
|
26 'log_dir=s' => \$log_dir, |
|
27 'product=s' => \$product, |
|
28 'number=s' => \$number, |
|
29 'version=s' => \$ver_dp_tools # like DP00562 |
|
30 ); |
|
31 |
|
32 my $full_ver_latest_green = ''; |
|
33 # if user doesn't specify the detail dp tools build number throught the parameter "-version" |
|
34 # auto connect to intweb service to get latest green build number list |
|
35 unless( defined($ver_dp_tools) ) |
|
36 { |
|
37 # Alternative method of getting the BRAG status - use the HTTP interface to Autobuild |
|
38 my $parameters = "product=$product&number=$number"; |
|
39 my $sLogsLocation = "http://intweb:8080/esr/query?$parameters"; |
|
40 my $roUserAgent = LWP::UserAgent->new; |
|
41 my $roResponse = $roUserAgent->get($sLogsLocation); |
|
42 my $ver_info = $roResponse->content; |
|
43 print "--------------------Retrieve build and brag information-------------------------\n"; |
|
44 print "$ver_info\n"; |
|
45 print "--------------------------------------------------------------------------------\n"; |
|
46 my @lst_ver = (); |
|
47 while ($ver_info =~ m/snapshot\s+=\s+dp.*/gi) |
|
48 { |
|
49 $ver = $&; |
|
50 push(@lst_ver, $ver); |
|
51 } |
|
52 |
|
53 my @lst_brag = (); |
|
54 while ($ver_info =~ m/==\s+brag\s+=.*/gi) |
|
55 { |
|
56 $brag = $&; |
|
57 push(@lst_brag, $brag); |
|
58 } |
|
59 |
|
60 my $scalar_lst_brag = @lst_brag; |
|
61 my $index; |
|
62 for($index = 0; $index < $scalar_lst_brag; $index++) |
|
63 { |
|
64 if($lst_brag[$index] =~ /green/i) |
|
65 { |
|
66 last; |
|
67 } |
|
68 } |
|
69 |
|
70 my $ver_latest_green; |
|
71 if($index == $scalar_lst_brag) |
|
72 { |
|
73 print "No green build found for DP Tools! Build will be terminated!\n"; |
|
74 exit 0; |
|
75 } |
|
76 else |
|
77 { |
|
78 if($lst_ver[$index] =~ /(dp.*)/i) |
|
79 { |
|
80 $ver_latest_green = $1; |
|
81 print "Found green dp build: $ver_latest_green\n"; |
|
82 } |
|
83 } |
|
84 $full_ver_latest_green = "$ver_latest_green"."_DeveloperProduct"; |
|
85 } |
|
86 else |
|
87 { |
|
88 # use the build number specified by users |
|
89 $full_ver_latest_green = "$ver_dp_tools"."_DeveloperProduct"; |
|
90 print "Use specified dp build: $ver_dp_tools\n"; |
|
91 } |
|
92 |
|
93 my $unzip_exe = "$tcl_delta_cache\\DP\\master\\sf\\dev\\hostenv\\dist\\unzip-5.40\\unzip.exe"; |
|
94 my $cbr_tools_zip = "\"\\\\builds01\\devbuilds\\DeveloperProduct\\$full_ver_latest_green\\SF_Package\\CBR tools_windows.zip\""; |
|
95 my $cmd_unzip_cbr_tools = "$unzip_exe -o $cbr_tools_zip > $log_dir\\cbrtools_unzip.log"; |
|
96 print "unzip command: $cmd_unzip_cbr_tools\n"; |
|
97 |
|
98 print "Unzip the zip package of cbr tools from the server \"builds01\"\n"; |
|
99 system($cmd_unzip_cbr_tools); |
|
100 print "check the detailed of unzip process from cbrtools_unzip.log\n"; |
|