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