blob: 89d3af5efe9471f219fe777ff14df989143ea849 [file] [log] [blame]
yu.dongc33b3072024-08-21 23:14:49 -07001#!/usr/bin/perl
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) 2005
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
38use strict;
39use warnings;
40use tools::mbis;
41
42#*****************************************************************************
43# Global Variable Declaration and Initialization
44#*****************************************************************************
45our $argv_count;
46our $command;
47our $info;
48our $argv;
49our $folder;
50
51# get -s|-t|-i|-o|-e|-c
52$argv = shift(@ARGV);
53
54# get the arguments number
55$argv_count = @ARGV;
56
57
58if ($argv =~ /^-s$/i && $argv_count >= 1){
59 &mbisLogCommand(1,@ARGV);
60}
61elsif ($argv =~ /^-t$/i && $argv_count == 1){
62 $info = shift(@ARGV);
63 &mbisLogTimeStamp(1,$info);
64}
65elsif ($argv =~ /^-i$/i && $argv_count == 1){
66 $info = shift(@ARGV);
67 &mbisLogInfo(1,$info);
68}
69elsif ($argv =~ /^-o$/i && $argv_count == 1){
70 $folder = shift(@ARGV);
71 &mergeLogFile(1,$folder);
72}
73elsif ($argv =~ /^-e$/i && $argv_count == 0){
74 &mbisPostProcess(1);
75}
76elsif ($argv =~ /^-c$/i && $argv_count == 0){
77 &writeTimeLogFromTempfile(1);
78}
79else{
80 &usage;
81}
82
83
84
85sub usage{
86 warn << "__END_OF_USAGE";
87
88Usage:
89 mbis.pl [-s|-i|-t|-o|-e|-c] \@argvs
90
91Description:
92 -s \@argv :
93 log the original command and arguments into mbis info MBIS_BUILD_INFO_LOG.
94 -i $info :
95 log the info message into MBIS_BUILD_INFO_LOG.
96 -t $info :
97 log the info message and timestamp into MBIS_BUILD_TIME_TMP.
98 -o $folder :
99 merge the content of all the *.mbis files $folder into MBIS_BUILD_TIME_TMP.
100 -e :
101 rewrite MBIS_BUILD_INFO_LOG and MBIS_BUILD_TIME_LOG and add mbis process time info.
102 -c :
103 calculate the time duration in MBIS_BUILD_TIME_TMP and rewrite into MBIS_BUILD_TIME_LOG file.
104
105__END_OF_USAGE
106
107 exit 1;
108}