rjw | 6c1fd8f | 2022-11-30 14:33:01 +0800 | [diff] [blame] | 1 | #!/usr/bin/perl -w |
| 2 | # |
| 3 | # Copyright Statement: |
| 4 | # -------------------- |
| 5 | # This software is protected by Copyright and the information contained |
| 6 | # herein is confidential. The software may not be copied and the information |
| 7 | # contained herein may not be used or disclosed except with the written |
| 8 | # permission of MediaTek Inc. (C) 2006 |
| 9 | # |
| 10 | # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES |
| 11 | # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE") |
| 12 | # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON |
| 13 | # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES, |
| 14 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF |
| 15 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT. |
| 16 | # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE |
| 17 | # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR |
| 18 | # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH |
| 19 | # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO |
| 20 | # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S |
| 21 | # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM. |
| 22 | # |
| 23 | # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE |
| 24 | # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE, |
| 25 | # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE, |
| 26 | # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO |
| 27 | # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. |
| 28 | # |
| 29 | # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE |
| 30 | # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF |
| 31 | # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND |
| 32 | # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER |
| 33 | # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC). |
| 34 | # |
| 35 | # |
| 36 | #***************************************************************************** |
| 37 | #* |
| 38 | #* Filename: |
| 39 | #* --------- |
| 40 | #* 3rdPartiesLicChk.pl |
| 41 | #* |
| 42 | #* Project: |
| 43 | #* -------- |
| 44 | #* Maui_Software |
| 45 | #* |
| 46 | #* Description: |
| 47 | #* ------------ |
| 48 | #* This script will check the licences of third party tools |
| 49 | #* |
| 50 | #* |
| 51 | #* Author: |
| 52 | #* ------- |
| 53 | #* Xxxxx Xxxx (mtkxxxx) |
| 54 | #* |
| 55 | #*============================================================================ |
| 56 | #* HISTORY |
| 57 | #* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 58 | #*------------------------------------------------------------------------------ |
| 59 | #* $Revision: $ |
| 60 | #* $Modtime: $ |
| 61 | #* $Log: $ |
| 62 | #* |
| 63 | #*------------------------------------------------------------------------------ |
| 64 | #* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! |
| 65 | #*============================================================================ |
| 66 | |
| 67 | #Since there is symbolic references @line 137, cannot use strict; |
| 68 | #use strict; |
| 69 | use warnings; |
| 70 | |
| 71 | &Usage() if ($#ARGV < 1); # be compatible with executing in standalone mode without feature's source level license check |
| 72 | &Usage() if ($#ARGV > 1 && $#ARGV < 5); |
| 73 | |
| 74 | use lib "/perl"; |
| 75 | use Spreadsheet::ParseExcel; |
| 76 | use Cwd; |
| 77 | use File::Basename; |
| 78 | use File::Copy; |
| 79 | use Net::SMTP; |
| 80 | use LWP::UserAgent; |
| 81 | use Time::HiRes qw(gettimeofday tv_interval); |
| 82 | |
| 83 | my $CWD = cwd(); |
| 84 | chomp $CWD; |
| 85 | $CWD =~ s/\/$// if ($CWD =~ /\/$/); |
| 86 | |
| 87 | my $DefaultThrdPtyLicFile = '\\\\glbfs14/wcp/sw_releases/@Portal_Material/Custom_Release_Info/customer_3rdparty_info/WCP-SA-Customer_Management.xls'; |
| 88 | my $AplixFeatSettingChgLogPth = '\\\\glbfs14/wcp/sw_releases/@Portal_Material/Custom_Release_Info/customer_3rdparty_info/Aplix_Feature_Setting_Changes'; |
| 89 | my $AACPlusFeatSettingChgLogPth = '\\\\glbfs14/wcp/sw_releases/@Portal_Material/Custom_Release_Info/customer_3rdparty_info/AACPlus_Feature_Setting_Changes'; |
| 90 | |
| 91 | |
| 92 | #parse command line arguments |
| 93 | my $InputPrjFile = $ARGV[0]; |
| 94 | my $InputLicFile = ($ARGV[1] eq "")? $DefaultThrdPtyLicFile : $ARGV[1]; |
| 95 | my $Feat2ModTbl = (defined $ARGV[2])? $ARGV[2] : ''; |
| 96 | my @SRCModList = (defined $ARGV[3])? split(' ',$ARGV[3]) : (); |
| 97 | my @PSRCModList = (defined $ARGV[4])? split(' ',$ARGV[4]) : (); |
| 98 | my @OBJModList = (defined $ARGV[5])? split(' ',$ARGV[5]) : (); |
| 99 | |
| 100 | if (!-e $InputPrjFile) |
| 101 | { |
| 102 | print "$InputPrjFile does NOT exist!!!\n"; |
| 103 | &Usage(); |
| 104 | } |
| 105 | |
| 106 | if (!-e $InputLicFile) |
| 107 | { |
| 108 | print "$InputLicFile does NOT exist!!!\n"; |
| 109 | &Usage(); |
| 110 | } |
| 111 | |
| 112 | if ($Feat2ModTbl eq '') |
| 113 | { |
| 114 | warn "Skip 3rd party feature's source level license check due to NOT specify \"Feat2ModTbl\" argument on command line!!!\n"; |
| 115 | } |
| 116 | else |
| 117 | { |
| 118 | warn "$Feat2ModTbl does NOT exist, skip 3rd party feature's source level license check!!!" if (!-e $Feat2ModTbl); |
| 119 | warn "skip 3rd party feature's source level license check due to NOT specify \"CUS_REL_SRC_COMP\" argument on command line!!!" if (!@SRCModList); |
| 120 | warn "skip 3rd party feature's source level license check due to NOT specify \"CUS_REL_PAR_SRC_COMP\" argument on command line!!!" if (!@PSRCModList); |
| 121 | warn "skip 3rd party feature's source level license check due to NOT specify \"CUS_REL_MTK_COMP\" argument on command line!!!" if (!@OBJModList); |
| 122 | } |
| 123 | |
| 124 | my $ProjectMF = basename($InputPrjFile); |
| 125 | my $ProjectNm = basename($ProjectMF, ".mak"); |
| 126 | my $MFPath = dirname($InputPrjFile); |
| 127 | $MFPath =~ s/\/$//; |
| 128 | open(MF, "<$MFPath/$ProjectMF") or die "cannot open $MFPath/$ProjectMF!!!\n"; |
| 129 | while (<MF>) |
| 130 | { |
| 131 | next if (/^\s*#/); |
| 132 | if (/^\s*(\w+)\s*=\s*(\w+)/) |
| 133 | { |
| 134 | my $keyname = uc($1); |
| 135 | $$keyname = uc($2); |
| 136 | } |
| 137 | } |
| 138 | close(MF); |
| 139 | |
| 140 | |
| 141 | #***************************************************************************** |
| 142 | # feature related modules setting for source level license check |
| 143 | # such as @WAP_SUPPORT_OBIGO_Q03C = qw(obigo03cadp obigo03capp obigo03clib) |
| 144 | #***************************************************************************** |
| 145 | if (($Feat2ModTbl ne '') && (-e $Feat2ModTbl)) |
| 146 | { |
| 147 | $Feat2ModTbl = (dirname($Feat2ModTbl) =~ /:|^\\\\\w/)? $Feat2ModTbl : "$CWD/$Feat2ModTbl"; |
| 148 | open(FH, "<$Feat2ModTbl") or die "cannot open $Feat2ModTbl!!!\n"; |
| 149 | while (<FH>) |
| 150 | { |
| 151 | next if (/^\s*#/); |
| 152 | if (/^\s*(\w+)\s*=\s*(\w+(\s+\w+)*)\s*/) |
| 153 | { |
| 154 | my $keyname = uc($1); |
| 155 | @$keyname = split(' ',$2); |
| 156 | } |
| 157 | } |
| 158 | close(FH); |
| 159 | } |
| 160 | |
| 161 | |
| 162 | # Data Structure |
| 163 | #my $ThirdPartiesLicInfo = |
| 164 | #{ |
| 165 | # CustID => string, |
| 166 | # ActFlg => boolean, |
| 167 | # CustNm => string, |
| 168 | # ShrtNm => string, |
| 169 | # LicToken => { Opt1 => boolean, |
| 170 | # Opt2 => boolean, |
| 171 | # Opt3 => boolean, |
| 172 | # ......, |
| 173 | # Optn => boolean}, |
| 174 | # # if customer have Aplix or RollTech license, |
| 175 | # # the following two elements will be available |
| 176 | # AplixLicToken => { Opt1 => boolean, |
| 177 | # Opt2 => boolean, |
| 178 | # ......, |
| 179 | # Optn => boolean}, |
| 180 | # RollTechLicToken => { Opt1 => boolean, |
| 181 | # Opt2 => boolean, |
| 182 | # ......, |
| 183 | # Optn => boolean} |
| 184 | #}; |
| 185 | #***************************************************************************** |
| 186 | # Read all customers' 3rd party feature license info. from license table |
| 187 | #***************************************************************************** |
| 188 | my $PrintLicInfoonScrn = 0; #dump license info. or NOT |
| 189 | my $ErrMsg = ''; |
| 190 | my $ErrCnt = 0; # Err. counter |
| 191 | |
| 192 | # global varialbes setting for Main table 'Customer_3rdParties' |
| 193 | my $CustID_col = 0; |
| 194 | my $IsCustActive_col = 2; |
| 195 | my $MainShtCustNm_col = 4; |
| 196 | my $MainShtShrtNm_col = 5; |
| 197 | my $MainShtFirstOpt_col = 7; |
| 198 | my $MainShtFeatSeting_row = 1; |
| 199 | my $MainShtFirstCust_row = 4; |
| 200 | |
| 201 | # global varialbes setting for Aplix table 'Aplix' |
| 202 | my $AplixShtCustNm_col = 1; |
| 203 | my $AplixShtShrtNm_col = 2; |
| 204 | my $AplixShtFirstOpt_col = 5; |
| 205 | my $AplixShtFeatSeting_row = 3; |
| 206 | my $AplixShtFirstCust_row = 4; |
| 207 | my $AplixFeature = ''; |
| 208 | my $AplixIgrptrn = '^\s*SW release request date\s*$|^\s*Expiration date\s*$|^\s*Contract type\s*$|^\s*Note\s*$'; |
| 209 | |
| 210 | # global varialbes setting for RollTech table 'RollTech' |
| 211 | my $RollTechShtCustNm_col = 22; |
| 212 | my $RollTechShtShrtNm_col = 3; |
| 213 | my $RollTechShtFirstOpt_col = 4; |
| 214 | my $RollTechShtFeatSeting_row = 1; |
| 215 | my $RollTechShtFirstCust_row = 2; |
| 216 | my $RollTechFeature = ''; |
| 217 | my $RollTechIgrptrn = '^\s*Scope\s*$|^\s*Platform or Project\s*$|^\s*Note\s*$'; |
| 218 | |
| 219 | # copy the excel file and open it |
| 220 | my @ActCustLicInfo = (); |
| 221 | my ($seconds, $microseconds) = gettimeofday; |
| 222 | my $ThirdPartyLicFile = (dirname($InputLicFile) =~ /:|^\\\\\w/)? $InputLicFile : "$CWD/$InputLicFile"; |
| 223 | my $ThirdPartyLicFileCpy = "$CWD/".basename($ThirdPartyLicFile,'.xls')."_" .$microseconds.'.xls'; |
| 224 | my $ExcelParser = Spreadsheet::ParseExcel->new(); |
| 225 | copy($ThirdPartyLicFile,$ThirdPartyLicFileCpy) or die "Copy failed: $!"; |
| 226 | my $Book = $ExcelParser->parse($ThirdPartyLicFileCpy); |
| 227 | |
| 228 | # get the last row and column |
| 229 | my $MainSheet = $Book->Worksheet('Customer_3rdParties'); # most 3rd parties license table |
| 230 | my ($MainShtcol_min, $MainShtLastOpt_col) = $MainSheet->col_range(); |
| 231 | my ($MainShtrow_min, $MainShtLastCust_row) = $MainSheet->row_range(); |
| 232 | |
| 233 | my $AplixSheet = $Book->Worksheet('Aplix'); |
| 234 | my ($AplixShtcol_min, $AplixShtLastOpt_col) = $AplixSheet->col_range(); |
| 235 | my ($AplixShtrow_min, $AplixShtLastCust_row) = $AplixSheet->row_range(); |
| 236 | |
| 237 | my $RollTechSheet = $Book->Worksheet('RollTech'); |
| 238 | my ($RollTechShtcol_min, $RollTechShtLastOpt_col) = $RollTechSheet->col_range(); |
| 239 | my ($RollTechShtrow_min, $RollTechShtLastCust_row) = $RollTechSheet->row_range(); |
| 240 | #***************************************************************************** |
| 241 | # Main Table(Customer_3rdParties), Most 3rd party feature license info. for all customers |
| 242 | #***************************************************************************** |
| 243 | |
| 244 | foreach my $row ($MainShtFirstCust_row..$MainShtLastCust_row) |
| 245 | { |
| 246 | my $ThirdPartiesLicInfo = {}; |
| 247 | next unless defined $MainSheet->get_cell($row,$IsCustActive_col); |
| 248 | next unless defined $MainSheet->get_cell($row,$IsCustActive_col)->value(); |
| 249 | next unless $MainSheet->get_cell($row,$IsCustActive_col)->value() =~ /^\s*Y\s*$/i; |
| 250 | next unless defined $MainSheet->get_cell($row,$MainShtShrtNm_col); |
| 251 | next unless defined $MainSheet->get_cell($row,$MainShtShrtNm_col)->value(); |
| 252 | next if($MainSheet->get_cell($row,$MainShtShrtNm_col)->value() eq ""); |
| 253 | $ThirdPartiesLicInfo->{CustID} = $MainSheet->get_cell($row,$CustID_col)->value(); |
| 254 | push (@ActCustLicInfo, $ThirdPartiesLicInfo); |
| 255 | $ThirdPartiesLicInfo->{ActFlg} = $MainSheet->get_cell($row,$IsCustActive_col)->value(); |
| 256 | $ThirdPartiesLicInfo->{CustNm} = $MainSheet->get_cell($row,$MainShtCustNm_col)->value(); |
| 257 | $ThirdPartiesLicInfo->{ShrtNm} = $MainSheet->get_cell($row,$MainShtShrtNm_col)->value(); |
| 258 | $ThirdPartiesLicInfo->{LicToken} = {}; |
| 259 | foreach my $col ($MainShtFirstOpt_col..$MainShtLastOpt_col) |
| 260 | { |
| 261 | next unless defined $MainSheet->get_cell($MainShtFeatSeting_row,$col); |
| 262 | next unless defined $MainSheet->get_cell($MainShtFeatSeting_row,$col)->value(); |
| 263 | next if($MainSheet->get_cell($MainShtFeatSeting_row,$col)->value() eq ""); |
| 264 | my $OptSetting = uc($MainSheet->get_cell($MainShtFeatSeting_row,$col)->value()); |
| 265 | $OptSetting =~ s/\s//g; |
| 266 | $AplixFeature = "$OptSetting" if (($AplixFeature eq '') && ($OptSetting =~ /^J2ME_SUPPORT=JBLENDIA$/i)); |
| 267 | $RollTechFeature = "$OptSetting" if (($RollTechFeature eq '') && ($OptSetting =~ /^J2ME_SUPPORT=IJET$/i)); |
| 268 | if (!defined $MainSheet->get_cell($row,$col) || |
| 269 | !defined $MainSheet->get_cell($row,$col)->value()) |
| 270 | { |
| 271 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 0 if (!defined $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"}); |
| 272 | next; |
| 273 | } |
| 274 | |
| 275 | if ($MainSheet->get_cell($row,$col)->value() =~ /^\s*V.*(Partial Source|PSRC)/i) |
| 276 | {# feature with partial source |
| 277 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 3; |
| 278 | } |
| 279 | elsif ($MainSheet->get_cell($row,$col)->value() =~ /^\s*V.*(Source|SRC)/i) |
| 280 | {# feature with full source |
| 281 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 4; |
| 282 | } |
| 283 | elsif ($MainSheet->get_cell($row,$col)->value() =~ /^\s*V.*(Object|OBJ)/i) |
| 284 | {# feature ONLY with library |
| 285 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 2; |
| 286 | } |
| 287 | elsif ($MainSheet->get_cell($row,$col)->value() =~ /^\s*V/i) |
| 288 | { |
| 289 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 1; |
| 290 | } |
| 291 | elsif (!defined $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"}) |
| 292 | { |
| 293 | $ThirdPartiesLicInfo->{LicToken}->{"$OptSetting"} = 0; |
| 294 | } |
| 295 | }# foreach my $col ($MainShtFirstOpt_col..$MainShtLastOpt_col) |
| 296 | |
| 297 | $ThirdPartiesLicInfo->{LicToken}->{"AAC_PLUS_DECODE=TRUE"} = 1; # for recording AAC Plus rel. info. |
| 298 | } |
| 299 | |
| 300 | |
| 301 | #***************************************************************************** |
| 302 | # Read Aplix JAVA feature license info. of customers |
| 303 | #***************************************************************************** |
| 304 | @ActCustLicInfo = &ReadJavaLicInfo(\@ActCustLicInfo, |
| 305 | 'Aplix', |
| 306 | $AplixFeature, |
| 307 | $AplixShtFirstCust_row, |
| 308 | $AplixShtLastCust_row, |
| 309 | $AplixShtShrtNm_col, |
| 310 | $AplixShtFirstOpt_col, |
| 311 | $AplixShtLastOpt_col, |
| 312 | $AplixShtFeatSeting_row, |
| 313 | 'AplixLicToken', |
| 314 | $AplixIgrptrn); |
| 315 | |
| 316 | #***************************************************************************** |
| 317 | # Read RollTech JAVA feature license info. of customers |
| 318 | #***************************************************************************** |
| 319 | @ActCustLicInfo = &ReadJavaLicInfo(\@ActCustLicInfo, |
| 320 | 'RollTech', |
| 321 | $RollTechFeature, |
| 322 | $RollTechShtFirstCust_row, |
| 323 | $RollTechShtLastCust_row, |
| 324 | $RollTechShtShrtNm_col, |
| 325 | $RollTechShtFirstOpt_col, |
| 326 | $RollTechShtLastOpt_col, |
| 327 | $RollTechShtFeatSeting_row, |
| 328 | 'RollTechLicToken', |
| 329 | $RollTechIgrptrn); |
| 330 | |
| 331 | unlink $ThirdPartyLicFileCpy or die "Delete failed: $!"; |
| 332 | #***************************************************************************** |
| 333 | # Checking license for 3rd party features |
| 334 | #***************************************************************************** |
| 335 | @ActCustLicInfo = sort {$a->{ShrtNm} cmp $b->{ShrtNm}} @ActCustLicInfo; |
| 336 | @ActCustLicInfo = reverse @ActCustLicInfo; |
| 337 | foreach my $cust (@ActCustLicInfo) |
| 338 | { |
| 339 | if ($cust->{ShrtNm} && $ProjectMF =~ /^$cust->{ShrtNm}/i) |
| 340 | { |
| 341 | ($ErrMsg, $ErrCnt) = &ChkLicense($cust->{CustNm}, $cust->{LicToken}, $ErrMsg, $ErrCnt); |
| 342 | ($ErrMsg, $ErrCnt) = &ChkJavaLicense($J2ME_SUPPORT, $cust, $ErrMsg, $ErrCnt) if (defined $J2ME_SUPPORT); |
| 343 | ($ErrMsg, $ErrCnt) = &ChkSrcLvlLic($cust->{CustNm}, $cust->{LicToken}, $ErrMsg, $ErrCnt); |
| 344 | |
| 345 | last; |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | #***************************************************************************** |
| 350 | # Dump 3rd party features license info. to temp. file if necessary |
| 351 | # Print the checking result on screen |
| 352 | #***************************************************************************** |
| 353 | &PrintLicInfoonScrn(\@ActCustLicInfo) if ($PrintLicInfoonScrn); |
| 354 | &PrintChkRst($ErrMsg, $ErrCnt, $ThirdPartyLicFile); |
| 355 | |
| 356 | |
| 357 | #****************************************************************************** |
| 358 | ## FUNCTION |
| 359 | ## ReadJavaLicInfo |
| 360 | ## ... |
| 361 | ## ... |
| 362 | ## ... |
| 363 | ##****************************************************************************** |
| 364 | sub ReadJavaLicInfo |
| 365 | { |
| 366 | my ($arr_ref, |
| 367 | $JavaVendor, |
| 368 | $JavaFeature, |
| 369 | $JavaShtFirstCust_row, |
| 370 | $JavaShtLastCust_row, |
| 371 | $JavaShtShrtNm_col, |
| 372 | $JavaShtFirstOpt_col, |
| 373 | $JavaShtLastOpt_col, |
| 374 | $JavaShtFeatSeting_row, |
| 375 | $JavaLicToken, |
| 376 | $JavaTblIgrPtrn) = @_; |
| 377 | my $JavaSheet = $Book->Worksheet($JavaVendor); |
| 378 | foreach my $customer (@$arr_ref) |
| 379 | { |
| 380 | next if (!$customer->{LicToken}->{$JavaFeature}); |
| 381 | foreach my $row ($JavaShtFirstCust_row..$JavaShtLastCust_row) |
| 382 | { |
| 383 | next unless defined $JavaSheet->get_cell($row,$JavaShtShrtNm_col); |
| 384 | next unless defined $JavaSheet->get_cell($row,$JavaShtShrtNm_col)->value(); |
| 385 | if ($customer->{ShrtNm} eq $JavaSheet->get_cell($row,$JavaShtShrtNm_col)->value()) |
| 386 | { |
| 387 | $customer->{$JavaLicToken} = {}; |
| 388 | foreach my $col ($JavaShtFirstOpt_col..$JavaShtLastOpt_col) |
| 389 | { |
| 390 | next unless defined $JavaSheet->get_cell($JavaShtFeatSeting_row,$col); |
| 391 | next unless defined $JavaSheet->get_cell($JavaShtFeatSeting_row,$col)->value(); |
| 392 | next if ($JavaSheet->get_cell($JavaShtFeatSeting_row,$col)->value() =~ |
| 393 | /$JavaTblIgrPtrn/i); |
| 394 | |
| 395 | my $OptSetting = uc($JavaSheet->get_cell($JavaShtFeatSeting_row,$col)->value()); |
| 396 | $OptSetting =~ s/\s//g; |
| 397 | |
| 398 | if (!defined $JavaSheet->get_cell($row,$col)->value()) |
| 399 | { |
| 400 | $customer->{$JavaLicToken}->{"$OptSetting"} = 0; |
| 401 | next; |
| 402 | } |
| 403 | if ($JavaSheet->get_cell($row,$col)->value() =~ /^\s*V/i) |
| 404 | { |
| 405 | $customer->{$JavaLicToken}->{"$OptSetting"} = 1; |
| 406 | } |
| 407 | else |
| 408 | { |
| 409 | $customer->{$JavaLicToken}->{"$OptSetting"} = 0; |
| 410 | } |
| 411 | }# foreach my $col ($JavaShtFirstOpt_col..$JavaShtLastOpt_col) |
| 412 | last; |
| 413 | }# if ($customer->{ShrtNm} eq $JavaSheet->get_cell($row,$JavaShtShrtNm_col)->value()) |
| 414 | }# foreach my $row ($JavaShtFirstCust_row..$JavaShtLastCust_row) |
| 415 | }# foreach my $customer (@$arr_ref) |
| 416 | return @$arr_ref; |
| 417 | } |
| 418 | |
| 419 | |
| 420 | #****************************************************************************** |
| 421 | ## FUNCTION |
| 422 | ## ChkJavaLicense |
| 423 | ## ... |
| 424 | ## ... |
| 425 | ## ... |
| 426 | ##****************************************************************************** |
| 427 | sub ChkJavaLicense |
| 428 | { |
| 429 | my ($javasln, $hash_ref, $str, $i) = @_; |
| 430 | my $tmpcnt = $i; |
| 431 | |
| 432 | if ($javasln eq 'JBLENDIA') |
| 433 | { |
| 434 | ($str, $i) = &ChkLicense($hash_ref->{CustNm}, $hash_ref->{AplixLicToken}, $str, $i); |
| 435 | |
| 436 | if ($i != $tmpcnt) |
| 437 | { # the customer has no JBLENDIA license, need notify Aplix |
| 438 | my ($OrgJavaFeatSet, $RelJavaFeatSet) = &GetJBLDFeatChgs($AplixFeatSettingChgLogPth); |
| 439 | if (($OrgJavaFeatSet ne "") && ($RelJavaFeatSet ne "")) |
| 440 | { |
| 441 | my ($CustStr, $modem) = &GetCustStrAndMODEM($ProjectMF); |
| 442 | my (undef, $week, $branch) = &GetVernoInfo("$MFPath/Verno_$CustStr\.bld"); |
| 443 | my $CustNameStr = &CPMQuery($CustStr, "Customer"); |
| 444 | my $sender = 'justin.chu@mediatek.com'; |
| 445 | my $toAplix = 'mtk-biz@aplix.co.jp'; |
| 446 | my $toSWPM = 'wcp_mt_cpm2@mediatek.com'; |
| 447 | my $cc = 'justin.chu@mediatek.com, money.kang@mediatek.com'; |
| 448 | my $subject = "Change project feature set notification from MTK"; |
| 449 | my $body = "Dear Aplix partners,\n\n" |
| 450 | . " Please be informed that MediaTek will change the feature set of $CustStr($week) project with $PLATFORM chipset on $branch branch " |
| 451 | . "for $CustNameStr customer. Since the feature set is different with the last released, " |
| 452 | . "please help confirm whether the feature set is acceptable for release to the " |
| 453 | . "above-mentioned customer by providing a return e-mail to MediaTek within two (2) " |
| 454 | . "business days of this e-mail. This release request shall be deemed automatically " |
| 455 | . "accepted by Aplix if MediaTek receives no response from Aplix within two (2) business days of this e-mail./n/n"; |
| 456 | $body .= "The two feature sets are as follows,\n" |
| 457 | . "Original Feature Set:\n" |
| 458 | . "$OrgJavaFeatSet\n" |
| 459 | . "Released Feature Set:\n" |
| 460 | . "$RelJavaFeatSet"; |
| 461 | |
| 462 | &SendEmailNotify($sender, $toAplix, $cc, $subject, $body); |
| 463 | &SendEmailNotify($sender, $toSWPM, $cc, $subject, $body); |
| 464 | } |
| 465 | } |
| 466 | } |
| 467 | elsif ($javasln eq 'IJET') |
| 468 | { |
| 469 | ($str, $i) = &ChkLicense($hash_ref->{CustNm}, $hash_ref->{RollTechLicToken}, $str, $i); |
| 470 | } |
| 471 | return ($str, $i); |
| 472 | } |
| 473 | |
| 474 | |
| 475 | #****************************************************************************** |
| 476 | ## FUNCTION |
| 477 | ## ChkLicense |
| 478 | ## ... |
| 479 | ## ... |
| 480 | ## ... |
| 481 | ##****************************************************************************** |
| 482 | sub ChkLicense |
| 483 | { |
| 484 | my ($customer, $hash_ref, $str, $i) = @_; |
| 485 | foreach my $opt (keys %{$hash_ref}) |
| 486 | { |
| 487 | if ($opt =~ /^(AAC_PLUS_DECODE)=TRUE$/) |
| 488 | {# AAC_PLUS_DECODE |
| 489 | if (defined $AAC_PLUS_DECODE && $AAC_PLUS_DECODE =~ /^TRUE$/) |
| 490 | { |
| 491 | my ($CustStr, $modem) = &GetCustStrAndMODEM($ProjectMF); |
| 492 | my ($VernoStr,undef,undef) = &GetVernoInfo("$MFPath/Verno_$CustStr\.bld"); |
| 493 | &RecAACPlusRelInfo("$AACPlusFeatSettingChgLogPth/AACPlusRelInfo.log", |
| 494 | &GetCurTime(), |
| 495 | $customer, |
| 496 | $VernoStr, |
| 497 | $ProjectNm, |
| 498 | "AAC Plus"); |
| 499 | } |
| 500 | }# if ($opt =~ /^(AAC_PLUS_DECODE)=TRUE$/) |
| 501 | elsif ($opt =~ /^(AAC_PLUS_PS_DECODE)=TRUE$/) |
| 502 | {# AAC_PLUS_PS_DECODE |
| 503 | if (defined $AAC_PLUS_PS_DECODE && $AAC_PLUS_PS_DECODE =~ /^TRUE$/) |
| 504 | { |
| 505 | my ($CustStr, $modem) = &GetCustStrAndMODEM($ProjectMF); |
| 506 | my ($VernoStr,undef,undef) = &GetVernoInfo("$MFPath/Verno_$CustStr\.bld"); |
| 507 | &RecAACPlusRelInfo("$AACPlusFeatSettingChgLogPth//AACPlusV2RelInfo.log", |
| 508 | &GetCurTime(), |
| 509 | $customer, |
| 510 | $VernoStr, |
| 511 | $ProjectNm, |
| 512 | "AAC Plus V2"); |
| 513 | } |
| 514 | }# if ($opt =~ /^(AAC_PLUS_PS_DECODE)=TRUE$/) |
| 515 | elsif ($opt =~ /^(SYNCML_DM_SUPPORT)=TRUE$/) |
| 516 | {# SYNCML_DM_SUPPORT |
| 517 | my $OptNm = $1; |
| 518 | if ((defined $OPTR_SPEC && $OPTR_SPEC =~ /^CMCC/ && $OPTR_SPEC !~ /SEGA/) && defined $$OptNm && !$hash_ref->{$opt}) |
| 519 | { |
| 520 | $i += 1; |
| 521 | $str .= "$i: $customer has no license for feature \"$opt\"!!!\n"; |
| 522 | } |
| 523 | }# if ($opt =~ /^(SYNCML_DM_SUPPORT)=TRUE$/) |
| 524 | elsif ($opt =~ /^(SINGLE_SIM_MMI_ONLY)=FALSE$/) |
| 525 | {# SINGLE_SIM_MMI_ONLY (dual sim) |
| 526 | my $OptNm = $1; |
| 527 | if ((defined $GEMINI && $GEMINI =~ /^TRUE$/) && (defined $SINGLE_SIM_MMI_ONLY && $SINGLE_SIM_MMI_ONLY =~ /^FALSE$/) && !$hash_ref->{$opt}) |
| 528 | { |
| 529 | $i += 1; |
| 530 | $str .= "$i: $customer has no license for feature \"$opt\"!!!\n"; |
| 531 | } |
| 532 | }# elsif ($opt =~ /^(SINGLE_SIM_MMI_ONLY)=FALSE$/) |
| 533 | elsif ($opt =~ /^(\w+)=(\w+)$/) |
| 534 | { |
| 535 | my $OptNm = $1; |
| 536 | my $OptVal = $2; |
| 537 | if (defined $$OptNm && ($$OptNm eq $OptVal) && !$hash_ref->{$opt}) |
| 538 | { |
| 539 | $i += 1; |
| 540 | $str .= "$i: $customer has no license for feature \"$opt\"!!!\n"; |
| 541 | } |
| 542 | }# elsif ($opt =~ /^(\w+)=(\w+)$/) |
| 543 | elsif ($opt =~ /^(\w+)=((\w+)\.+)$/) |
| 544 | {# CMCC_...... |
| 545 | my $OptNm = $1; |
| 546 | my $OptValPfx = $3; |
| 547 | if (defined $$OptNm && ($$OptNm =~ /^$OptValPfx/) && !$hash_ref->{$opt}) |
| 548 | { |
| 549 | $i += 1; |
| 550 | $str .= "$i: $customer has no license for feature \"$OptNm=$$OptNm\"!!!\n"; |
| 551 | } |
| 552 | }# elsif ($opt =~ /^(\w+)=((\w+)\.+)$/) |
| 553 | } |
| 554 | return ($str, $i); |
| 555 | } |
| 556 | |
| 557 | |
| 558 | #****************************************************************************** |
| 559 | ## FUNCTION |
| 560 | ## ChkSrcLvlLic |
| 561 | ## ... |
| 562 | ## ... |
| 563 | ## ... |
| 564 | ##****************************************************************************** |
| 565 | sub ChkSrcLvlLic |
| 566 | { |
| 567 | my ($customer, $hash_ref, $str, $i) = @_; |
| 568 | foreach my $opt (keys %{$hash_ref}) |
| 569 | { |
| 570 | if ($opt =~ /^(\w+)=(\w+)$/) |
| 571 | { |
| 572 | my $ArrNm = $1.'_'.$2; |
| 573 | if (@$ArrNm) |
| 574 | { |
| 575 | if (($hash_ref->{$opt} == 4) && !&IsSubArr(\@$ArrNm, \@SRCModList)) |
| 576 | { |
| 577 | $i += 1; |
| 578 | $str .= "$i: $customer should have source release for feature \"$opt\"!!!\n"; |
| 579 | } |
| 580 | if (($hash_ref->{$opt} == 3) && !&IsSubArr(\@$ArrNm, \@PSRCModList)) |
| 581 | { |
| 582 | $i += 1; |
| 583 | $str .= "$i: $customer should have partial source release for feature \"$opt\"!!!\n"; |
| 584 | } |
| 585 | if (($hash_ref->{$opt} == 2) && !&IsSubArr(\@$ArrNm, \@OBJModList)) |
| 586 | { |
| 587 | $i += 1; |
| 588 | $str .= "$i: $customer should have library release for feature \"$opt\"!!!\n"; |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | return ($str, $i); |
| 594 | } |
| 595 | |
| 596 | |
| 597 | #****************************************************************************** |
| 598 | ## FUNCTION |
| 599 | ## IsSubArr |
| 600 | ## ... |
| 601 | ## ... |
| 602 | ## ... |
| 603 | ##****************************************************************************** |
| 604 | sub IsSubArr |
| 605 | { |
| 606 | my ($arr_ref1, $arr_ref2) = @_; |
| 607 | my $cnt = 0; |
| 608 | foreach my $i (@$arr_ref1) |
| 609 | { |
| 610 | $cnt++ if (grep(/^$i$/, @$arr_ref2)); |
| 611 | } |
| 612 | return 1 if ($cnt == @$arr_ref1); |
| 613 | return 0; |
| 614 | } |
| 615 | |
| 616 | sub PrintChkRst |
| 617 | { |
| 618 | my ($str, $i, $licfile) = @_; |
| 619 | if ($i) |
| 620 | { |
| 621 | print $i == 1? |
| 622 | "There is license problem in the following $i feature setting.\n": |
| 623 | "There are license problems in the following $i features setting.\n"; |
| 624 | print $str; |
| 625 | print "PLEASE check details from 3rd party feature license table \"$licfile\" !!!\n"; |
| 626 | exit 1; |
| 627 | } |
| 628 | else |
| 629 | { |
| 630 | print "Checking 3rd party features license DONE!!!\n"; |
| 631 | exit 0; |
| 632 | } |
| 633 | } |
| 634 | |
| 635 | |
| 636 | #****************************************************************************** |
| 637 | ## FUNCTION |
| 638 | ## PrintLicInfoonScrn |
| 639 | ## ... |
| 640 | ## Print the the cusotmer's 3rd party feature License info. |
| 641 | ## ... |
| 642 | ## ... |
| 643 | ##****************************************************************************** |
| 644 | sub PrintLicInfoonScrn |
| 645 | { |
| 646 | open(FH,">~3rdPtyLicInfo.tmp") or die "Cannot open ~3rdPtyLicInfo.tmp!!!\n"; |
| 647 | my $arr_ref = shift; |
| 648 | foreach my $i (@$arr_ref) |
| 649 | { |
| 650 | print FH "#****************************************************\n"; |
| 651 | print FH "# $i->{CustNm}\n"; |
| 652 | print FH "#****************************************************\n"; |
| 653 | # $i ===> $ThirdPartyLicFile |
| 654 | foreach my $k (keys %{$i}) |
| 655 | {#$k ===> CustID, ActFlg, CustNm, ShrtNm, LicToken |
| 656 | if ($k =~ /^LicToken$/i) |
| 657 | { |
| 658 | print FH "[License Token]\n"; |
| 659 | foreach my $t (keys %{$i->{$k}}) |
| 660 | { # $i->{$k} ===> $ThirdPartyLicFile->{LicToken} |
| 661 | # $t ===> Opt1,Opt2,...,Optn |
| 662 | printf FH "%-70s%5d\n",$t,$i->{$k}->{$t}; |
| 663 | } |
| 664 | }# if ($k =~ /^LicToken$/i) |
| 665 | elsif ($k =~ /^AplixLicToken$/i) |
| 666 | { |
| 667 | print FH "[Aplix License Token]\n"; |
| 668 | foreach my $t (keys %{$i->{$k}}) |
| 669 | { # $i->{$k} ===> $ThirdPartyLicFile->{LicToken} |
| 670 | # $t ===> Opt1,Opt2,...,Optn |
| 671 | printf FH "%-70s%5d\n",$t,$i->{$k}->{$t}; |
| 672 | } |
| 673 | }# elsif ($k =~ /^AplixLicToken$/i) |
| 674 | elsif ($k =~ /^RollTechLicToken$/i) |
| 675 | { |
| 676 | print FH "[Rolltech License Token]\n"; |
| 677 | foreach my $t (keys %{$i->{$k}}) |
| 678 | { # $i->{$k} ===> $ThirdPartyLicFile->{LicToken} |
| 679 | # $t ===> Opt1,Opt2,...,Optn |
| 680 | printf FH "%-70s%5d\n",$t,$i->{$k}->{$t}; |
| 681 | } |
| 682 | }# elsif ($k =~ /^RollTechLicToken$/i) |
| 683 | else |
| 684 | { |
| 685 | printf FH "%-70s%5s\n",$k,$i->{$k}; |
| 686 | # CustID: string |
| 687 | # ActFlg: boolean |
| 688 | # CustNm: string |
| 689 | # ShrtNm: string |
| 690 | } |
| 691 | } |
| 692 | } |
| 693 | close(FH); |
| 694 | } |
| 695 | |
| 696 | |
| 697 | #****************************************************************************** |
| 698 | ## FUNCTION |
| 699 | ## CPMQuery |
| 700 | ## ... |
| 701 | ## ... |
| 702 | ## ... |
| 703 | ##****************************************************************************** |
| 704 | sub CPMQuery |
| 705 | { |
| 706 | my ($string1, $string2) = @_; |
| 707 | my ($statuscode, $headers, $file) = (); |
| 708 | my $my_result = (); |
| 709 | my $CPM_address = "/CPM/httpService/CPMService.cfm"; |
| 710 | |
| 711 | my ($Srv, $UsrNm, $Pwd); |
| 712 | my $CPMAuthInfo = dirname($DefaultThrdPtyLicFile)."/CPMAuthInfo.ini"; |
| 713 | open(AUTHFILE, $CPMAuthInfo) or die "can NOT open $CPMAuthInfo!\n"; |
| 714 | while(<AUTHFILE>) |
| 715 | { |
| 716 | chomp; |
| 717 | $Srv = $1 if (/^\s*CPM_SERVER\s*=\s*(.*)/); |
| 718 | $UsrNm = $1 if (/^\s*CPM_ACCOUNT\s*=\s*(.*)/); |
| 719 | $Pwd = $1 if (/^\s*CPM_PWD\s*=\s*(.*)/); |
| 720 | } |
| 721 | close(AUTHFILE); |
| 722 | |
| 723 | my $url; |
| 724 | my $Connection = LWP::UserAgent->new(); |
| 725 | $Connection->credentials($Srv, "realm-name", $UsrNm => $Pwd); |
| 726 | if ($string2 ne "Customer") |
| 727 | { |
| 728 | |
| 729 | $url = "http://".$Srv."$CPM_address?func=getFeatureValuOfProject\&project=$string1\&feature=$string2"; |
| 730 | } |
| 731 | else |
| 732 | { |
| 733 | $url = "http://".$Srv."$CPM_address?func=getCustomerNameOfProject\&project=$string1"; |
| 734 | } |
| 735 | $response = $Connection->get($url); |
| 736 | if ($response->is_success) |
| 737 | { |
| 738 | $statuscode = $response->code; |
| 739 | $headers = $response->headers; |
| 740 | $file = $response->content; |
| 741 | } |
| 742 | else |
| 743 | { |
| 744 | die "Cannot connect to CPM $url $!\n".$response->status_line; |
| 745 | } |
| 746 | |
| 747 | $my_result = $file; |
| 748 | $my_result =~ s/<[^\<\>]*>//g; |
| 749 | |
| 750 | return $my_result; |
| 751 | } |
| 752 | |
| 753 | |
| 754 | #****************************************************************************** |
| 755 | ## FUNCTION |
| 756 | ## RGetJBLDFeatChgs |
| 757 | ## ... |
| 758 | ## ... |
| 759 | ## ... |
| 760 | ##****************************************************************************** |
| 761 | sub GetJBLDFeatChgs |
| 762 | { |
| 763 | my $logpath = shift; |
| 764 | my $ChgCnt = 0; |
| 765 | my @OrgSet = (); |
| 766 | my @CurSet = (); |
| 767 | my ($CustStr, $modem) = &GetCustStrAndMODEM($ProjectMF); |
| 768 | my ($VernoStr,undef,undef) = &GetVernoInfo("$MFPath/Verno_$CustStr\.bld"); |
| 769 | my $logfile = $VernoStr."_".$CustStr."_".$modem."\.log"; # the log is generated by project creation process |
| 770 | |
| 771 | if (-e "$logpath/$logfile") |
| 772 | { |
| 773 | open(LOGFILE,"<$logpath/$logfile") or die "can NOT open $logpath/$logfile!\n"; |
| 774 | while(<LOGFILE>) |
| 775 | { |
| 776 | next if (/^\s*#/); |
| 777 | if (/^\s*(\w+)\s*=\s*(\w+)/) |
| 778 | { |
| 779 | my $opt = $1; |
| 780 | my $orgval = $2; |
| 781 | next if ($opt =~ /^CHIP_VER$/); |
| 782 | push(@OrgSet, "$opt = $orgval"); |
| 783 | push(@CurSet, "$opt = $$opt"); |
| 784 | $ChgCnt++ if ($$opt ne $orgval); |
| 785 | } |
| 786 | } |
| 787 | close(LOGFILE); |
| 788 | } |
| 789 | if (!$ChgCnt) |
| 790 | { |
| 791 | @OrgSet = (); |
| 792 | @CurSet = (); |
| 793 | } |
| 794 | return (join("\n",@OrgSet), join("\n",@CurSet)); |
| 795 | } |
| 796 | |
| 797 | |
| 798 | #****************************************************************************** |
| 799 | ## FUNCTION |
| 800 | ## GetCustStrAndMODEM |
| 801 | ## ... |
| 802 | ## ... |
| 803 | ## ... |
| 804 | ##****************************************************************************** |
| 805 | sub GetCustStrAndMODEM |
| 806 | { |
| 807 | my $pMF = shift; |
| 808 | my $modem = ''; |
| 809 | my $CustStr = ''; |
| 810 | my @modem_type = qw (LIS BASIC GSM GPRS UMTS UDVT HSPA TDD128 TDD128DPA TDD128HSPA); |
| 811 | foreach my $p (@modem_type) |
| 812 | { |
| 813 | if ($pMF =~ /(.*)_$p\.mak$/i) |
| 814 | { |
| 815 | $CustStr = $1; |
| 816 | $modem = $p; |
| 817 | last; |
| 818 | } |
| 819 | } |
| 820 | return ($CustStr, $modem); |
| 821 | } |
| 822 | |
| 823 | |
| 824 | #****************************************************************************** |
| 825 | ## FUNCTION |
| 826 | ## GetVernoInfo |
| 827 | ## ... |
| 828 | ## ... |
| 829 | ## ... |
| 830 | ##****************************************************************************** |
| 831 | sub GetVernoInfo |
| 832 | { |
| 833 | my $vernofile = shift; |
| 834 | my $verno = ''; |
| 835 | my $weekStr = ''; |
| 836 | my $branchStr = ''; |
| 837 | open(VERNOFILE, "<$vernofile") or die "can NOT open $vernofile!\n"; |
| 838 | while(<VERNOFILE>) |
| 839 | { |
| 840 | if (/^\s*VERNO\s*=\s*(MAUI\.((\w+)\.)?(W\d\d\.\d\d)\.?(((OF|MP|SP)\w*)\.?)?.*)/i) |
| 841 | { |
| 842 | $verno = $1; |
| 843 | $weekStr = $4; |
| 844 | my ($elem3, $elem5, $elem6) = ($3, $5, $6); |
| 845 | my $tmp = $weekStr; |
| 846 | $tmp =~ s/\.//; |
| 847 | $branchStr = ((defined($elem3) && ($elem3 ne ""))? $elem3 : "MAUI") |
| 848 | . ((defined($elem5) && ($elem5 ne ""))? $tmp.$elem6 : ""); |
| 849 | } |
| 850 | } |
| 851 | close(VERNOFILE); |
| 852 | return ($verno, $weekStr, $branchStr); |
| 853 | } |
| 854 | |
| 855 | |
| 856 | #****************************************************************************** |
| 857 | ## FUNCTION |
| 858 | ## RecAACPlusReInfo |
| 859 | ## ... |
| 860 | ## ... |
| 861 | ## ... |
| 862 | ##****************************************************************************** |
| 863 | sub RecAACPlusRelInfo |
| 864 | { |
| 865 | my $writed = 0; |
| 866 | my ($logfile, $timestr, $customer, $verno, $projectname, $featurename) = @_; |
| 867 | for (1..20) |
| 868 | { |
| 869 | if(open(LOGFILE, ">>$logfile")) |
| 870 | { |
| 871 | print LOGFILE "$timestr\t$customer\t$verno\t$projectname\t$featurename\n"; |
| 872 | close(LOGFILE); |
| 873 | $writed = 1; |
| 874 | last; |
| 875 | } |
| 876 | else |
| 877 | { |
| 878 | system("echo cannot open $logfile Wait 3 sec to open again"); |
| 879 | sleep(3); |
| 880 | } |
| 881 | } |
| 882 | if(!$writed) |
| 883 | { |
| 884 | die "cannot open $timestr\t$customer\t$verno\t$projectname\t$featurename"; |
| 885 | } |
| 886 | } |
| 887 | |
| 888 | |
| 889 | #****************************************************************************** |
| 890 | ## FUNCTION |
| 891 | ## GetCurTime |
| 892 | ## ... |
| 893 | ## ... |
| 894 | ## ... |
| 895 | ##****************************************************************************** |
| 896 | sub GetCurTime |
| 897 | { |
| 898 | my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time); |
| 899 | my $timeStr = sprintf("%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d", $year+1900, $mon+1, $mday, $hour, $min, $sec); |
| 900 | return $timeStr; |
| 901 | } |
| 902 | |
| 903 | |
| 904 | #****************************************************************************** |
| 905 | ## FUNCTION |
| 906 | ## SendEmailNotify |
| 907 | ## ... |
| 908 | ## ... |
| 909 | ## ... |
| 910 | ##****************************************************************************** |
| 911 | sub SendEmailNotify |
| 912 | { |
| 913 | my ($sender, $to_list, $cc_list, $mail_subject, $mail_content) = @_; |
| 914 | my $smtp_server = 'mtksmtp2.mtk.com.tw'; #"172.21.100.20" |
| 915 | my $msg = <<__EOFNOTIFY |
| 916 | To: $to_list |
| 917 | Cc: $cc_list |
| 918 | Subject: $mail_subject |
| 919 | From: $sender |
| 920 | |
| 921 | $mail_content |
| 922 | |
| 923 | __EOFNOTIFY |
| 924 | ; |
| 925 | my $smtp = Net::SMTP->new($smtp_server); |
| 926 | $smtp->mail($sender); |
| 927 | map { $smtp->to($_); } split(/,/, $to_list); |
| 928 | map { $smtp->cc($_); } split(/,/, $cc_list); |
| 929 | $smtp->data($msg); |
| 930 | $smtp->quit; |
| 931 | } |
| 932 | |
| 933 | |
| 934 | #****************************************************************************** |
| 935 | ## FUNCTION |
| 936 | ## Usage |
| 937 | ## ... |
| 938 | ## ... |
| 939 | ## ... |
| 940 | ##****************************************************************************** |
| 941 | sub Usage |
| 942 | { |
| 943 | print <<"__EOFUSAGE"; |
| 944 | |
| 945 | usage: $0 PrjMF 3rdPtyLicFile [<Feat2ModTbl> <CUS_REL_SRC_COMP> <CUS_REL_PAR_SRC_COMP> <CUS_REL_MTK_COMP>] |
| 946 | |
| 947 | PrjMF project makefile |
| 948 | |
| 949 | 3rdPtyLicFile 3rd parties license table, if specified as "", |
| 950 | the default licese table will be used |
| 951 | |
| 952 | Feat2ModTbl Mapping file for feature and its module(s) |
| 953 | should be specified together with CUS_REL_SRC_COMP, |
| 954 | CUS_REL_PAR_SRC_COMP & CUS_REL_MTK_COMP |
| 955 | |
| 956 | CUS_REL_SRC_COMP SRC module list |
| 957 | should be specified together with Feat2ModTbl, |
| 958 | CUS_REL_PAR_SRC_COMP & CUS_REL_MTK_COMP |
| 959 | |
| 960 | CUS_REL_PAR_SRC_COMP PSRC module list |
| 961 | should be specified together with Feat2ModTbl, |
| 962 | CUS_REL_SRC_COMP & CUS_REL_MTK_COMP |
| 963 | |
| 964 | CUS_REL_MTK_COMP OBJ module list |
| 965 | should be specified together with Feat2ModTbl, |
| 966 | CUS_REL_SRC_COMP & CUS_REL_PAR_SRC_COMP |
| 967 | __EOFUSAGE |
| 968 | exit 1; |
| 969 | } |