yu.dong | c33b307 | 2024-08-21 23:14:49 -0700 | [diff] [blame] | 1 | #!/usr/bin/perl
|
| 2 | use Net::SMTP;
|
| 3 |
|
| 4 | #********************************************************************
|
| 5 | # Global Vars for mail notification
|
| 6 | #********************************************************************
|
| 7 | my $Sender = uc(getlogin());;
|
| 8 | my $ToList = "MBJ06037".","."MBJ06026";
|
| 9 | my $CcList = "";
|
| 10 | my $smtp_server = "mtksmtp2.mtk.com.tw"; #172.21.100.20(192.168.160.24)
|
| 11 | my $ts_name = $ENV{"COMPUTERNAME"};
|
| 12 | my $user_domain = $ENV{"USERDOMAIN"};
|
| 13 | my $load_path = `cd`;
|
| 14 | chomp($load_path);
|
| 15 | my $log = "build\\$ARGV[3]\\log\\chk_env.log";
|
| 16 | my $log_flag = 0;
|
| 17 | my $Flag = $ARGV[2];
|
| 18 | print "*******************************************\n";
|
| 19 | print " Start checking MTK build environment......\n";
|
| 20 | print "*******************************************\n";
|
| 21 | #********************************************************************
|
| 22 | # checking OS version
|
| 23 | #********************************************************************
|
| 24 | if($ENV{OS} eq "Windows_NT")
|
| 25 | {
|
| 26 | print "OS is Windows 2000 or XP. => [OK]\n";
|
| 27 |
|
| 28 | if($Flag =~ /-customer/i){
|
| 29 | $reading ="OS is Windows 2000 or XP. => [OK]\n";
|
| 30 | if(-e "build\\$ARGV[3]\\log"){
|
| 31 | open (LOG, "> $log") or warn "cannot open $log\n";
|
| 32 | print LOG $reading;
|
| 33 | $log_flag =1;
|
| 34 | }
|
| 35 | else{
|
| 36 | warn "warning: There is no \\build folder.\n";
|
| 37 | }
|
| 38 | }
|
| 39 | }
|
| 40 | else
|
| 41 | {
|
| 42 | if ($user_domain =~ /MBJ/i)
|
| 43 | {
|
| 44 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 45 | my $content = "Your OS should be Windows2000 or above!\n";
|
| 46 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 47 | }
|
| 48 | print "Your OS should be Windows2000 or above!\n";
|
| 49 | exit(1);
|
| 50 | }
|
| 51 |
|
| 52 | #********************************************************************
|
| 53 | # checking ARM installation path
|
| 54 | #********************************************************************
|
| 55 |
|
| 56 | #&USAGE() if ($#ARGV != 1);
|
| 57 | my $makefile = "$ARGV[1]";
|
| 58 | #my $Flag = $ARGV[2];
|
| 59 |
|
| 60 | open(MAK,"<$makefile") or die "$!";
|
| 61 | while(<MAK>)
|
| 62 | {
|
| 63 | chomp;
|
| 64 | if(/^COMPILER\s*=\s*(\w+)+?/i)
|
| 65 | {
|
| 66 | #print $1;
|
| 67 | $compilerName = $1;
|
| 68 | if($compilerName =~ /RVCT/i)
|
| 69 | {
|
| 70 | print "Compiler in makefile is RVCT!\n";
|
| 71 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 72 | $reading ="Compiler in makefile is RVCT!\n";
|
| 73 | print LOG $reading;
|
| 74 | }
|
| 75 | $rvctflag = 1; ##
|
| 76 | &ChkRVCTenv($makefile,$Flag);
|
| 77 | }
|
| 78 | elsif($compilerName =~ /GCC/i){
|
| 79 | print "Compiler check skip GCC!!\n";
|
| 80 | last;
|
| 81 | }
|
| 82 | else
|
| 83 | {
|
| 84 | if ($Flag =~ /-customer/i) # ADS check only for customers
|
| 85 | {
|
| 86 | &ChkADSenv($makfile,-customer);
|
| 87 | }
|
| 88 | elsif($Flag =~ /-internal/i)
|
| 89 | {
|
| 90 | print "Compiler in makefile is Not RVCT!!\n";
|
| 91 | last;
|
| 92 | }
|
| 93 | }
|
| 94 | }
|
| 95 | }
|
| 96 |
|
| 97 |
|
| 98 | #********************************************************************
|
| 99 | # checking ARM compiler version & build number
|
| 100 | #********************************************************************
|
| 101 | sub ChkADSenv
|
| 102 | {
|
| 103 | my $optiondir = "$ARGV[0]\\option.mak";
|
| 104 | open(OPTION,"<$optiondir");
|
| 105 | if (defined($ENV{ARMHOME}) && ($ENV{ARMHOME} =~ /program\sFiles/i))
|
| 106 | {
|
| 107 | $ENV{ARMHOME} =~ s/m\sFiles/~1/i;
|
| 108 | }
|
| 109 |
|
| 110 | while(<OPTION>)
|
| 111 | {
|
| 112 | chomp;
|
| 113 | if(/DIR_ARM(\s*)=(\s*)(.*?ADSV1_2)+?/i)
|
| 114 | {
|
| 115 | my $arm_path = $3;
|
| 116 | if ( defined($ENV{ARMHOME}) && (lc($ENV{ARMHOME}) eq lc($arm_path)) )
|
| 117 | {
|
| 118 | print "ARM ADS installation path is correct. => [OK]\n";
|
| 119 | if($log_flag == 1){
|
| 120 | $reading ="ARM ADS installation path is correct. => [OK]\n";
|
| 121 | print LOG $reading;
|
| 122 | }
|
| 123 | last;
|
| 124 | }
|
| 125 | else
|
| 126 | {
|
| 127 | if ($user_domain =~ /MBJ/i)
|
| 128 | {
|
| 129 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 130 | my $content = "ARM installation path is inconsistent with the path defined in makefile[option.mak].\n" .
|
| 131 | "Current ARM installation path: $ENV{ARMHOME}.\n" .
|
| 132 | "In \"$optiondir\", ARM path is: $arm_path.\n" .
|
| 133 | "\nThe different path will cause a compiling error!\n" .
|
| 134 | "You should make them consistent\n";
|
| 135 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 136 | }
|
| 137 | print "ARM ADS installation path is inconsistent with the path defined in makefile[option.mak].\n";
|
| 138 | print "Current ARM installation path: $ENV{ARMHOME}.\n";
|
| 139 | print "In \"$optiondir\", ARM path is: $arm_path.\n";
|
| 140 | print "\nThe different path will cause a compiling error!\n";
|
| 141 | print "You should make them consistent\n";
|
| 142 | exit(1);
|
| 143 | }
|
| 144 | }
|
| 145 | }
|
| 146 | close(OPTION);
|
| 147 |
|
| 148 | chdir ("$arm_path");
|
| 149 | #**************************************************original
|
| 150 | my $arm_compiler = 0;
|
| 151 | foreach (split(/[\r\n]+/, `armcc -h 2>&1`))
|
| 152 | {
|
| 153 | chomp;
|
| 154 | if(/\bADS1.2/i)
|
| 155 | {
|
| 156 | print "ARM version is correct. => [OK]\n";
|
| 157 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 158 | $reading ="ARM version is correct. => [OK]\n";
|
| 159 | print LOG $reading;
|
| 160 | }
|
| 161 | if(/\bBuild(\s)*(\d+)/)
|
| 162 | {
|
| 163 | if($2 >= 848)
|
| 164 | {
|
| 165 | print "The build number of ARM ADS is correct. => [OK]\n";
|
| 166 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 167 | $reading ="The build number of ARM ADS is correct. => [OK]\n";
|
| 168 | print LOG $reading;
|
| 169 | }
|
| 170 | $arm_compiler = 1;
|
| 171 | last;
|
| 172 | }
|
| 173 | else
|
| 174 | {
|
| 175 | if ($user_domain =~ /MBJ/i)
|
| 176 | {
|
| 177 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 178 | my $content = "The build number of ARM should be at least 848!\n";
|
| 179 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 180 | }
|
| 181 | print "The build number of ARM should be at least 848!\n";
|
| 182 | exit(1);
|
| 183 | }
|
| 184 | }
|
| 185 | }
|
| 186 | else
|
| 187 | {
|
| 188 | next;
|
| 189 | }
|
| 190 | }
|
| 191 |
|
| 192 | if($arm_compiler == 0)
|
| 193 | {
|
| 194 | if ($user_domain =~ /MBJ/i)
|
| 195 | {
|
| 196 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 197 | my $content = "ARM should be ARM1.2 [Build 848](above) or RVCT!\n";
|
| 198 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 199 | }
|
| 200 | print "ARM ADS should be ARM1.2 [Build 848](above) or RVCT!\n";
|
| 201 | exit(1);
|
| 202 | }
|
| 203 | }
|
| 204 | #********************************************************************
|
| 205 | # checking ARM license
|
| 206 | #********************************************************************
|
| 207 | unless ($ARGV[2] =~ /-customer/)
|
| 208 | {
|
| 209 | if ($ENV{"USERDOMAIN"} =~ /MBJ/i)
|
| 210 | {
|
| 211 | my $arm_license = 0;
|
| 212 | my $arm_var_name = "ARMLMD_LICENSE_FILE";
|
| 213 | my @env_key = keys(%ENV);
|
| 214 |
|
| 215 | my $count = 0;
|
| 216 | foreach $_(@env_key)
|
| 217 | {
|
| 218 | if($_ =~ /$arm_var_name/i)
|
| 219 | {
|
| 220 | my @arm_var_value = split(";",$ENV{$_});
|
| 221 | for (my $i = 0; $i < @arm_var_value; $i++)
|
| 222 | {
|
| 223 | if ($ts_name =~ /^BJSTS\d\d$/i)
|
| 224 | {
|
| 225 | if (($arm_var_value[$i] =~ /^\s*C:\\Program Files\\ARM\\ADSv1_2\\licenses\\license\.dat$/i) ||
|
| 226 | ($arm_var_value[$i] =~ /^\s*C:\\Progra~1\\ARM\\ADSv1_2\\licenses\\license\.dat$/i))
|
| 227 | {
|
| 228 | for (my $j = $i + 1; $j < @arm_var_value; $j++)
|
| 229 | {
|
| 230 | if ($arm_var_value[$j] =~ /^\s*8224\@bjslic01$/i)
|
| 231 | {
|
| 232 | print "ARM license setting is correct. => [OK]\n";
|
| 233 | $arm_license = 1;
|
| 234 | last;
|
| 235 | }
|
| 236 | }
|
| 237 | }
|
| 238 | if ($arm_license == 1)
|
| 239 | {
|
| 240 | last;
|
| 241 | }
|
| 242 |
|
| 243 | }
|
| 244 | else
|
| 245 | {
|
| 246 | if ($arm_var_value[$i] =~ /^\s*8224\@bjslic01$/i)
|
| 247 | {
|
| 248 | print "ARM license setting is correct. => [OK]\n";
|
| 249 | $arm_license = 1;
|
| 250 | last;
|
| 251 | }
|
| 252 | }
|
| 253 | }
|
| 254 |
|
| 255 | if ($arm_license == 0)
|
| 256 | {
|
| 257 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 258 | my $content = "Please checking your ARM license setting!\n";
|
| 259 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 260 | print "Please checking your ARM license setting!\n";
|
| 261 | #exit(1);
|
| 262 | last;
|
| 263 | }
|
| 264 | else
|
| 265 | {
|
| 266 | last;
|
| 267 | }
|
| 268 | }
|
| 269 |
|
| 270 | $count++;
|
| 271 | if($count == ($#env_key+1))
|
| 272 | {
|
| 273 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 274 | my $content = "Please checking your ARM license setting!\n";
|
| 275 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 276 | print "Please checking your ARM license setting!\n";
|
| 277 | exit(1);
|
| 278 | }
|
| 279 | }
|
| 280 | }
|
| 281 | }
|
| 282 | elsif ($ARGV[2] =~ /-customer/)
|
| 283 | {
|
| 284 | my $arm_var_name = "ARMLMD_LICENSE_FILE";
|
| 285 | my @env_key = keys(%ENV);
|
| 286 |
|
| 287 | foreach $_(@env_key)
|
| 288 | {
|
| 289 | if($_ =~ /$arm_var_name/i)
|
| 290 | {
|
| 291 | my $arm_para = $ENV{$_};
|
| 292 | if (($arm_para =~ /^\s*C:\\Program Files\\ARM\\ADSv1_2\\licenses\\license\.dat/i) ||
|
| 293 | ($arm_para =~ /^\s*C:\\Progra~1\\ARM\\ADSv1_2\\licenses\\license\.dat/i))
|
| 294 | {
|
| 295 | if (-e "C:\\Program Files\\ARM\\ADSv1_2\\licenses\\license\.dat")
|
| 296 | {
|
| 297 | print "License is existed!\n";
|
| 298 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 299 | $reading ="License is existed!\n";
|
| 300 | print LOG $reading;
|
| 301 | }
|
| 302 | }
|
| 303 | else
|
| 304 | {
|
| 305 | print "License is not existed!\n";
|
| 306 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 307 | $reading ="License is existed!\n";
|
| 308 | print LOG $reading;
|
| 309 | }
|
| 310 | }
|
| 311 | }
|
| 312 | else
|
| 313 | {
|
| 314 | print "C:\\Program Files\\ARM\\ADSv1_2\\licenses\\license\.dat is not existed!\n";
|
| 315 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 316 | $reading ="C:\\Program Files\\ARM\\ADSv1_2\\licenses\\license\.dat is not existed!\n";
|
| 317 | print LOG $reading;
|
| 318 | }
|
| 319 | }
|
| 320 | }
|
| 321 | }
|
| 322 | }
|
| 323 | #********************************************************************
|
| 324 | # checking Active perl version
|
| 325 | #********************************************************************
|
| 326 | if($] >= 5.008006)
|
| 327 | {
|
| 328 | print "Perl version is $] . => [OK]\n";
|
| 329 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 330 | $reading ="Perl version is $] . => [OK]\n";
|
| 331 | print LOG $reading;
|
| 332 | }
|
| 333 | }
|
| 334 | else
|
| 335 | {
|
| 336 | if ($user_domain =~ /MBJ/i)
|
| 337 | {
|
| 338 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 339 | my $content = "Perl version is too low.\n";
|
| 340 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 341 | }
|
| 342 | print "Perl version is not correct , please update to 5.8.6 \n";
|
| 343 | exit(1);
|
| 344 | }
|
| 345 |
|
| 346 | #********************************************************************
|
| 347 | # checking shell(modification)
|
| 348 | #********************************************************************
|
| 349 | my @path = split(";",$ENV{"PATH"});
|
| 350 |
|
| 351 | foreach my $path (@path)
|
| 352 | {
|
| 353 | if(-d $path)
|
| 354 | {
|
| 355 | $path = "\"$path\"";
|
| 356 | open(TEMPHANDLE,"<dir /B $path |");
|
| 357 | while(<TEMPHANDLE>)
|
| 358 | {
|
| 359 | chomp;
|
| 360 | if($_ =~ /^sh\.exe\b/i)
|
| 361 | {
|
| 362 | if ($user_domain =~ /MBJ/i)
|
| 363 | {
|
| 364 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 365 | my $content = "sh.exe founded in: $path\nplease remove it\n";
|
| 366 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 367 | }
|
| 368 | print "sh.exe founded in: $path\nplease remove it\n";
|
| 369 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 370 | $reading ="sh.exe founded in: $path\nplease remove it\n";
|
| 371 | print LOG $reading;
|
| 372 | }
|
| 373 | exit(1);
|
| 374 | }
|
| 375 | }
|
| 376 | close(TEMPHANDLE);
|
| 377 | }
|
| 378 | }
|
| 379 | print "Shell is cmd.exe. => [OK]\n";
|
| 380 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 381 | $reading ="Shell is cmd.exe. => [OK]\n";
|
| 382 | print LOG $reading;
|
| 383 | }
|
| 384 |
|
| 385 | #********************************************************************
|
| 386 | # checking Excel version
|
| 387 | #********************************************************************
|
| 388 | if ($ENV{"INLSF"} eq "")
|
| 389 | {
|
| 390 | use Win32::OLE;
|
| 391 | my $excel = Win32::OLE->new('excel.Application');
|
| 392 | if($excel->version >= 9)
|
| 393 | {
|
| 394 | print "Excel version is 2000 or above. => [OK]\n";
|
| 395 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 396 | $reading ="Excel version is 2000 or above. => [OK]\n";
|
| 397 | print LOG $reading;
|
| 398 | }
|
| 399 | }
|
| 400 | else
|
| 401 | {
|
| 402 | if ($user_domain =~ /MBJ/i)
|
| 403 | {
|
| 404 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 405 | my $content = "Your Excel should be 2000+!\n";
|
| 406 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 407 | }
|
| 408 | print "Your Excel should be 2000+!\n";
|
| 409 | exit(1);
|
| 410 | }
|
| 411 | }
|
| 412 |
|
| 413 | #********************************************************************
|
| 414 | # checking make.exe version
|
| 415 | #********************************************************************
|
| 416 | if ($ARGV[2] =~ /-customer/){
|
| 417 | open(tfile, "pcore\\tools\\make.exe -v |") || die "Cannot open make.exe";
|
| 418 | while(<tfile>){
|
| 419 | if($_ =~ /^\s*GNU\s*Make\s*(.*)/i){
|
| 420 | $reading = $1;
|
| 421 | if($reading == "3.81"){
|
| 422 | print LOG "make.exe version is ".$reading." [OK]\n";
|
| 423 | }
|
| 424 | else{
|
| 425 | print "ERROR : make.exe version $reading is wrong,please update to 3.81 !!\n";
|
| 426 | print LOG "ERROR : make.exe version(".$reading.") is wrong, please update it to 3.81 !!\n";
|
| 427 | exit(1);
|
| 428 | }
|
| 429 | }
|
| 430 |
|
| 431 | }
|
| 432 | close(tfile);
|
| 433 |
|
| 434 | }
|
| 435 |
|
| 436 | #********************************************************************
|
| 437 | # checking MSYS version
|
| 438 | #********************************************************************
|
| 439 | if ($ARGV[2] =~ /-customer/){
|
| 440 | open(tfile, "pcore\\tools\\MSYS\\bin\\make.exe -v |") || die "Cannot open make.exe";
|
| 441 | while(<tfile>){
|
| 442 | if($_ =~ /^GNU\sMake\sversion\s(.*),/i){
|
| 443 | $reading = $1;
|
| 444 | if($reading == "3.79.1"){
|
| 445 | print LOG "pcore\\tools\\MSYS\\bin\\make.exe version is ".$reading." [OK]\n";
|
| 446 | }
|
| 447 | else{
|
| 448 | print "ERROR : pcore\\tools\\MSYS\\bin\\make.exe version $reading is wrong,please update to 3.79.1 !!\n";
|
| 449 | print LOG "ERROR : pcore\\tools\\MSYS\\bin\\make.exe version(".$reading.") is wrong, please update it to 3.79.1 !!\n";
|
| 450 | exit(1);
|
| 451 | }
|
| 452 | }
|
| 453 |
|
| 454 | }
|
| 455 | close(tfile);
|
| 456 |
|
| 457 | }
|
| 458 |
|
| 459 | print "*******************************************\n";
|
| 460 | print " MTK build environment is ready!\n";
|
| 461 | print "*******************************************\n";
|
| 462 | close LOG;
|
| 463 | sub SendEmailNotify
|
| 464 | {
|
| 465 | my ($to_list, $cc_list, $mail_subject, $mail_content) = @_;
|
| 466 | my $msg = <<__EOFNOTIFY
|
| 467 | To: $to_list
|
| 468 | Cc: $cc_list
|
| 469 | Subject: $mail_subject
|
| 470 | From: $Sender
|
| 471 |
|
| 472 | Dear All,
|
| 473 |
|
| 474 | $mail_content
|
| 475 |
|
| 476 | Best Regards,
|
| 477 |
|
| 478 | __EOFNOTIFY
|
| 479 | ;
|
| 480 | my $smtp = Net::SMTP->new($smtp_server);
|
| 481 | $smtp->mail($Sender);
|
| 482 | map { $smtp->to($_); } split(/,/, $to_list);
|
| 483 | map { $smtp->cc($_); } split(/,/, $cc_list);
|
| 484 | $smtp->data($msg);
|
| 485 | $smtp->quit;
|
| 486 | }
|
| 487 |
|
| 488 |
|
| 489 | sub USAGE
|
| 490 | {
|
| 491 | print <<"__EOFUSAGE";
|
| 492 |
|
| 493 | USAGE: chk_env Option_MF_Path Project.mak <-build>
|
| 494 | __EOFUSAGE
|
| 495 | exit 1;
|
| 496 | }
|
| 497 | #********************************************************************
|
| 498 | # Subroutine
|
| 499 | #********************************************************************
|
| 500 | sub ChkRVCTenv
|
| 501 | {
|
| 502 | my ($makefile,$flag) = @_;
|
| 503 | my $rvctversion = 0;
|
| 504 | my $path_569 = "C:\\Program Files\\ARM\\RVCT\\Programs\\3.1\\569_init\\win_32-pentium";
|
| 505 | open(MAK,"<$makefile") or die "$!";
|
| 506 | while(<MAK>)
|
| 507 | {
|
| 508 | chomp;
|
| 509 | if(/^RVCT_VERSION\s*=\s*(\w+)+?/i)
|
| 510 | {
|
| 511 | if($1 =~ /V31/i)
|
| 512 | {
|
| 513 | print "RVCT VERSION in makefile is correct!\n";
|
| 514 | if(($flag =~ /-customer/i) && ($log_flag == 1)){
|
| 515 | $reading ="RVCT VERSION in makefile is correct!\n";
|
| 516 | print LOG $reading;
|
| 517 | }
|
| 518 | $rvctversion = 1;
|
| 519 | }
|
| 520 | else
|
| 521 | {
|
| 522 | print "RVCT VERSION in makefile is wrong!\n";
|
| 523 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 524 | $reading ="RVCT VERSION in makefile is wrong!\n";
|
| 525 | print LOG $reading;
|
| 526 | }
|
| 527 | last;
|
| 528 | }
|
| 529 | }
|
| 530 | }
|
| 531 | close MAK;
|
| 532 | if ($rvctversion == 1)
|
| 533 | {
|
| 534 | if ($flag =~ /-internal/i)
|
| 535 | {
|
| 536 | if((exists $ENV{"RVCT31INC"})&&(exists $ENV{"RVCT31BIN"})&&(exists $ENV{"RVCT31LIB"}))
|
| 537 | {
|
| 538 | # system("pause");
|
| 539 | my $toolpath = $ENV{"RVCT31BIN"};
|
| 540 | #print $toolpath;
|
| 541 | my $chkarmccres = &ChkCompiler($toolpath,ARMCC,$flag);
|
| 542 | my $chktccres = &ChkCompiler($toolpath,TCC,$flag);
|
| 543 | my $chkarmlinkres = &Chkarmlink($toolpath,,$flag);
|
| 544 | my $chkarmfromelf = ChkFromelf($toolpath,,$flag);
|
| 545 | my $chkarmar = ChkArmar($toolpath,,$flag);
|
| 546 | if(-e $path_569){
|
| 547 | print "Start to check ARM B569 :\n";
|
| 548 | $reading ="Start to check ARM B569 :\n";
|
| 549 | print LOG $reading;
|
| 550 | my $chkarmccres_569 = &ChkCompiler($path_569,ARMCC,$flag);
|
| 551 | my $chktccres_569 = &ChkCompiler($path_569,TCC,$flag);
|
| 552 | my $chkarmlinkres_569 = &Chkarmlink($path_569,,$flag);
|
| 553 | my $chkarmfromelf_569 = ChkFromelf($toolpath,,$flag);
|
| 554 | my $chkarmarres_569 = &ChkArmar($path_569,$flag);
|
| 555 | }
|
| 556 | if (($chkarmccres == 1)&&($chkarmlinkres == 1)&&($chktccres == 1)&&($chkarmfromelf==1)&&($chkarmar == 1)&&($chkarmccres_569 == 1)&&($chkarmlinkres_569 == 1)&&($chktccres_569 == 1)&&($chkarmarres_569 == 1)&&($chkarmfromelf_569==1))
|
| 557 | {
|
| 558 | print "ARM RVCT31 environment is correct!\n";
|
| 559 | }
|
| 560 | }
|
| 561 | }
|
| 562 | elsif ($flag =~ /-customer/i)
|
| 563 | {
|
| 564 | my $toolpath = `cd`;
|
| 565 | my $chkarmccres = &ChkCompiler($toolpath,ARMCC,$flag);
|
| 566 | my $chktccres = &ChkCompiler($toolpath,TCC,$flag);
|
| 567 | my $chkarmlinkres = &Chkarmlink($toolpath,,$flag);
|
| 568 | my $chkarmfromelf = ChkFromelf($toolpath,,$flag);
|
| 569 | my $chkarmar = ChkArmar($toolpath,,$flag);
|
| 570 |
|
| 571 | if (($chkarmccres == 1)&&($chkarmlinkres == 1)&&(chktccres == 1)&&($chkarmfromelf==1)&&($chkarmar == 1))
|
| 572 | {
|
| 573 | print "ARM RVCT31 environment is correct!\n";
|
| 574 | if($log_flag == 1){
|
| 575 | $reading ="ARM RVCT3.1 environment is correct!\n";
|
| 576 | print LOG $reading;
|
| 577 | }
|
| 578 | }
|
| 579 | }
|
| 580 | else
|
| 581 | {
|
| 582 | print "The Environment configuration is unmatched!\n";
|
| 583 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 584 | $reading ="The Environment configuration is unmatched!\n";
|
| 585 | print LOG $reading;
|
| 586 | }
|
| 587 | }
|
| 588 | }
|
| 589 | }
|
| 590 |
|
| 591 |
|
| 592 | sub ChkCompiler
|
| 593 | {
|
| 594 | my ($path,$compiler,$flag_compiler) = @_;
|
| 595 | my $arm_compiler = 0;
|
| 596 | chdir($path);
|
| 597 |
|
| 598 | if ($flag_compiler =~ /-customer/i)
|
| 599 | {
|
| 600 | foreach (split(/[\r\n]+/, `$compiler -h 2>&1`))
|
| 601 | {
|
| 602 | chomp;
|
| 603 | #print $compiler;
|
| 604 | if(/\bRVCT3.1/i)
|
| 605 | {
|
| 606 | print $compiler." version is RVCT3.1 [OK] , ";
|
| 607 | if(/\bBuild(\s)*(\d+)/)
|
| 608 | {
|
| 609 | if($2 >= 569)
|
| 610 | {
|
| 611 | print "Build number is $2 [OK] .\n";
|
| 612 | if($log_flag == 1){
|
| 613 | $reading ="Build number is $2 [OK] .\n";
|
| 614 | print LOG $reading;
|
| 615 | }
|
| 616 | $arm_compiler = 1;
|
| 617 | &SetFlagFile(569,$load_path);
|
| 618 | last;
|
| 619 | }
|
| 620 | }
|
| 621 | }
|
| 622 | elsif(/\bRVCT4.0/i)
|
| 623 | {
|
| 624 | print $compiler." version is RVCT4.0 [OK] , ";
|
| 625 | if($log_flag == 1){
|
| 626 | $reading =$compiler." version is RVCT4.0 [OK] ,\n";
|
| 627 | print LOG $reading;
|
| 628 | }
|
| 629 | }
|
| 630 | else
|
| 631 | {
|
| 632 | print "ARMCC version is not RVCT3.1 or RVCT4.0\n";
|
| 633 | if($log_flag == 1){
|
| 634 | $reading ="ARMCC version is not RVCT3.1 or RVCT4.0\n";
|
| 635 | print LOG $reading;
|
| 636 | }
|
| 637 | last;
|
| 638 | }
|
| 639 | }
|
| 640 | }
|
| 641 | elsif ($flag_compiler =~ /-internal/i)
|
| 642 | {
|
| 643 | foreach (split(/[\r\n]+/, `$compiler -h 2>&1`))
|
| 644 | {
|
| 645 | chomp;
|
| 646 | #print $_;
|
| 647 | if(/\bRVCT3.1/i)
|
| 648 | {
|
| 649 | print $compiler." version is RVCT3.1 [OK] , ";
|
| 650 |
|
| 651 | if(/\bBuild(\s)*(\d+)/)
|
| 652 | {
|
| 653 | if($2 == 569)
|
| 654 | {
|
| 655 | print "Build number is $2 [OK] .\n";
|
| 656 | $arm_compiler = 1;
|
| 657 | last;
|
| 658 | }
|
| 659 | elsif($2 >= 1021)####
|
| 660 | {
|
| 661 | print "Build number is $2 [OK] .\n";
|
| 662 |
|
| 663 | $arm_compiler = 1;
|
| 664 | last;
|
| 665 | }
|
| 666 | else
|
| 667 | {
|
| 668 | if ($user_domain =~ /MBJ/i)
|
| 669 | {
|
| 670 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 671 | my $content = "The build number of ".$compiler." should be at least 1021!\n";
|
| 672 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 673 | }
|
| 674 | print "The build number of".$compiler." should be at least 1021!\n";
|
| 675 |
|
| 676 | exit(1);
|
| 677 | }
|
| 678 | }
|
| 679 | }
|
| 680 | else
|
| 681 | {
|
| 682 | print "ARMCC version is not RVCT3.1\n";
|
| 683 |
|
| 684 | last;
|
| 685 | }
|
| 686 | }
|
| 687 | }
|
| 688 | return $arm_compiler;
|
| 689 | }
|
| 690 |
|
| 691 | sub ChkArmar
|
| 692 | {
|
| 693 | my $armar = 0;
|
| 694 | my ($path,$flag_armar) = @_;
|
| 695 | chdir($path);
|
| 696 | foreach (split(/[\r\n]+/, `armar -h 2>&1`))
|
| 697 | {
|
| 698 | chomp;
|
| 699 | #print $_;
|
| 700 | if(/\bRVCT3.1/i)
|
| 701 | {
|
| 702 | print "ARMAR version is RVCT3.1 [OK] , ";
|
| 703 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 704 | $reading ="ARMAR version is RVCT3.1 [OK] , ";
|
| 705 | print LOG $reading;
|
| 706 | }
|
| 707 | if(/\bBuild(\s)*(\d+)/)
|
| 708 | {
|
| 709 | if($2 >= 1021)####
|
| 710 | {
|
| 711 | print "Build number is $2 [OK] .\n";
|
| 712 | if(($Flag =~ /-customer/i) && ($log_flag == 1)) {
|
| 713 | $reading ="Build number is $2 [OK] .\n";
|
| 714 | print LOG $reading;
|
| 715 | }
|
| 716 | $armar = 1;
|
| 717 | last;
|
| 718 | }
|
| 719 | else
|
| 720 | {
|
| 721 | print "The build number of ARMAR should be at least 1021! => [ERROR]\n";
|
| 722 | if(($Flag =~ /-customer/i) && ($log_flag == 1)) {
|
| 723 | $reading ="The build number of ARMAR should be at least 1021! => [ERROR]\n";
|
| 724 | print LOG $reading;
|
| 725 | }
|
| 726 | #exit(1);
|
| 727 | last;
|
| 728 | }
|
| 729 | }
|
| 730 | }
|
| 731 | else
|
| 732 | {
|
| 733 | print "ARMAR version is not RVCT3.1\n";
|
| 734 | if(($Flag =~ /-customer/i) && ($log_flag == 1)) {
|
| 735 | $reading ="ARMAR version is not RVCT3.1\n";
|
| 736 | print LOG $reading;
|
| 737 | }
|
| 738 | last;
|
| 739 | }
|
| 740 | }
|
| 741 | return $armar;
|
| 742 | }
|
| 743 |
|
| 744 | sub ChkFromelf
|
| 745 | {
|
| 746 | my $arm_elf = 0;
|
| 747 | my ($path,$flag_elf) = @_;
|
| 748 | chdir($path);
|
| 749 | if ($flag_elf =~ /-customer/i) #customers
|
| 750 | {
|
| 751 | foreach (split(/[\r\n]+/, `fromelf -h 2>&1`))
|
| 752 | {
|
| 753 | chomp;
|
| 754 | #print $_;
|
| 755 | if(/\bRVCT3.1/i)
|
| 756 | {
|
| 757 | print "FROMELF version is RVCT3.1 [OK] , ";
|
| 758 | if($log_flag == 1){
|
| 759 | $reading ="FROMELF version is RVCT3.1 [OK] , \n";
|
| 760 | print LOG $reading;
|
| 761 | }
|
| 762 | if(/\bBuild(\s)*(\d+)/)
|
| 763 | {
|
| 764 | if($2 >= 569)####
|
| 765 | {
|
| 766 | print "Build number is $2 [OK] .\n";
|
| 767 | if($log_flag == 1){
|
| 768 | $reading ="Build number is $2 [OK] .\n";
|
| 769 | print LOG $reading;
|
| 770 | }
|
| 771 | $arm_elf = 1;
|
| 772 | last;
|
| 773 | }
|
| 774 | }
|
| 775 | }
|
| 776 | }
|
| 777 | }
|
| 778 | elsif ($flag_elf =~ /-internal/i)
|
| 779 | {
|
| 780 | foreach (split(/[\r\n]+/, `fromelf -h 2>&1`))
|
| 781 | {
|
| 782 | chomp;
|
| 783 | #print $_;
|
| 784 | if(/\bRVCT3.1/i)
|
| 785 | {
|
| 786 | print "FROMELF version is RVCT3.1 [OK] , ";
|
| 787 |
|
| 788 | if(/\bBuild(\s)*(\d+)/)
|
| 789 | {
|
| 790 | if($2 == 569)####
|
| 791 | {
|
| 792 | print "Build number is $2 [OK] .\n";
|
| 793 | $arm_link = 1;
|
| 794 | last;
|
| 795 | }
|
| 796 | elsif($2 >= 1021)####
|
| 797 | {
|
| 798 | print "Build number is $2 [OK] .\n";
|
| 799 | $arm_elf = 1;
|
| 800 | last;
|
| 801 | }
|
| 802 | else
|
| 803 | {
|
| 804 | if ($user_domain =~ /MBJ/i)
|
| 805 | {
|
| 806 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 807 | my $content = "The build number of FROMELF should be at least 1021!\n";
|
| 808 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 809 | }
|
| 810 | print "The build number of FROMELF should be at least 1021!\n";
|
| 811 | exit(1);
|
| 812 | }
|
| 813 | }
|
| 814 | }
|
| 815 | else
|
| 816 | {
|
| 817 | print "FROMELF version is not RVCT3.1\n";
|
| 818 | last;
|
| 819 | }
|
| 820 | }
|
| 821 | }
|
| 822 | return $arm_elf;
|
| 823 | }
|
| 824 |
|
| 825 | sub Chkarmlink
|
| 826 | {
|
| 827 | my $arm_link = 0;
|
| 828 | my ($path,$flag_linker) = @_;
|
| 829 | chdir($path);
|
| 830 | if ($flag_linker =~ /-customer/i) #customers
|
| 831 | {
|
| 832 | foreach (split(/[\r\n]+/, `armlink -h 2>&1`))
|
| 833 | {
|
| 834 | chomp;
|
| 835 | #print $_;
|
| 836 | if(/\bRVCT3.1/i)
|
| 837 | {
|
| 838 | print "ARMLINK version is RVCT3.1 [OK] , ";
|
| 839 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 840 | $reading ="ARMLINK version is RVCT3.1 [OK] , ";
|
| 841 | print LOG $reading;
|
| 842 | }
|
| 843 | if(/\bBuild(\s)*(\d+)/)
|
| 844 | {
|
| 845 | if($2 >= 569)####
|
| 846 | {
|
| 847 | print "Build number is $2 [OK] .\n";
|
| 848 | if(($Flag =~ /-customer/i) && ($log_flag == 1)){
|
| 849 | $reading ="Build number is $2 [OK] .\n";
|
| 850 | print LOG $reading;
|
| 851 | }
|
| 852 | $arm_link = 1;
|
| 853 | last;
|
| 854 | }
|
| 855 | }
|
| 856 | }
|
| 857 | }
|
| 858 | }
|
| 859 | elsif ($flag_linker =~ /-internal/i)
|
| 860 | {
|
| 861 | foreach (split(/[\r\n]+/, `armlink -h 2>&1`))
|
| 862 | {
|
| 863 | chomp;
|
| 864 | #print $_;
|
| 865 | if(/\bRVCT3.1/i)
|
| 866 | {
|
| 867 | print "ARMLINK version is RVCT3.1 [OK] , ";
|
| 868 | if(/\bBuild(\s)*(\d+)/)
|
| 869 | {
|
| 870 | if($2 == 569)####
|
| 871 | {
|
| 872 | print "Build number is $2 [OK] .\n";
|
| 873 |
|
| 874 | $arm_link = 1;
|
| 875 | last;
|
| 876 | }
|
| 877 |
|
| 878 | elsif($2 >= 1021)####
|
| 879 | {
|
| 880 | print "Build number is $2 [OK] .\n";
|
| 881 |
|
| 882 | $arm_link = 1;
|
| 883 | last;
|
| 884 | }
|
| 885 | else
|
| 886 | {
|
| 887 | if ($user_domain =~ /MBJ/i)
|
| 888 | {
|
| 889 | my $subject = "[$ts_name: Compile Enviroment error]";
|
| 890 | my $content = "The build number of ARMLINK should be at least 1021!\n";
|
| 891 | #&SendEmailNotify($ToList, $CcList, $subject, $content);
|
| 892 | }
|
| 893 | print "The build number of ARMLINK should be at least 1021!\n";
|
| 894 |
|
| 895 | exit(1);
|
| 896 | }
|
| 897 | }
|
| 898 | }
|
| 899 | else
|
| 900 | {
|
| 901 | print "ARMLINK version is not RVCT3.1\n";
|
| 902 | last;
|
| 903 | }
|
| 904 | }
|
| 905 | }
|
| 906 | return $arm_link;
|
| 907 | }
|
| 908 |
|
| 909 | sub SetFlagFile
|
| 910 | {
|
| 911 | my($buildNo,$path) = @_;
|
| 912 | # print "buildno= $buildNo";
|
| 913 | my $file = "$path\\pcore\\tools\\RVCTBuildNo.tmp";
|
| 914 | # print "file =$file\n";
|
| 915 | open (FH,">$file") or die "$!";
|
| 916 | print FH "RVCT_CUS_BUILD_NO = ".$buildNo;
|
| 917 | close FH;
|
| 918 | }
|