releasing/cbrtools/perl/BinInfo
author marvin shi <marvin.shi@nokia.com>
Wed, 17 Nov 2010 14:05:07 +0800
changeset 691 9eeecb73a5d4
parent 602 3145852acc89
permissions -rw-r--r--
fix ou1cimx1#651819
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
602
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     1
#!perl
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     8
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    11
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    13
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    14
# Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    15
# 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    16
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    17
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    18
use strict;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    19
use FindBin;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    20
use lib "$FindBin::Bin";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    21
use Getopt::Long;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    22
use IniData;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    23
use EnvDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    24
use CommandController;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    25
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    26
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    27
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    28
# Globals.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    29
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    30
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    31
my $verbose = 0;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    32
my $iniData = IniData->New();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    33
my $commandController = CommandController->New($iniData, 'BinInfo');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $envDb;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
# Subs.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  GetOptions('h' => \$help, 'v+' => \$verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
    Usage(0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
  unless (scalar (@ARGV) == 1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
    print "Error: Invalid arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
  $envDb = EnvDb->Open($iniData, $verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
  if ($ARGV[0] =~ /[\*\?]/) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
    my $glob = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    66
    foreach my $entry (@{Utils::ReadGlob($glob)}) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    67
      Utils::AbsoluteFileName(\$entry);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    68
      print "\nFile:        $entry\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
      BinInfo($entry);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
    }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
  elsif (-f $ARGV[0]) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
    my $binary = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
    Utils::AbsoluteFileName(\$binary);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
    BinInfo($binary);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
  else {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
    my $comp = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
    ListBins($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
sub Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    86
  Utils::PrintDeathMessage($exitCode, "\nUsage: bininfo [options] <binary_file> | <component>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    87
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    88
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
-h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    91
-v  verbose output (-vv very verbose)\n");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    92
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    93
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
sub BinInfo {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  my $binary = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  my $info = $envDb->BinaryInfo($binary);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  $iniData->TableFormatter->PrintTable($info);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    98
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    99
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   100
sub ListBins {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
  my $comp = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
  unless ($envDb->Version($comp)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
    print "Error: \"$comp\" is not a file and is not a component that is currently installed\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
  my $info = $envDb->ListBins($comp);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
  $iniData->TableFormatter->PrintTable($info, 1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
BinInfo - Displays information about a currently installed binary file.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
  bininfo [options] <binary_file> | <component>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
  -h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
  -v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
If given a file name, prints the name of the component that owns the binary, the currently installed version and its status. For example:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
 D:\>bininfo \epoc32\release\wins\udeb\brdcst.dll
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
 Component:   brdcst
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
 Version:     001
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
 Status:      pending release
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
If given a component name, displays a list of all the binary files owned by that component and their status. For example:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
 D:\>bininfo brdcst
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
 File                                                     Status
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
 \EPOC32\INCLUDE\brdcst.h                                 clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
 \EPOC32\RELEASE\THUMB\UREL\BRDCST.DLL                    clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   143
 \EPOC32\RELEASE\THUMB\UREL\BRDCST.DLL.MAP                clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   144
 \EPOC32\RELEASE\THUMB\UREL\BRDCST.LIB                    clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   145
 \EPOC32\RELEASE\THUMB\UREL\BRDSRV.EXE                    clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   146
 \EPOC32\RELEASE\THUMB\UREL\BRDSRV.EXE.MAP                clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   147
 \EPOC32\RELEASE\THUMB\UREL\BRDSRV.LIB                    clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   148
 \EPOC32\RELEASE\WINS\UDEB\BRDCST.DLL                     clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   149
 \EPOC32\RELEASE\WINS\UDEB\BRDCST.LIB                     clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   150
 \EPOC32\RELEASE\WINS\UDEB\BRDCST.PDB                     clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   151
 \EPOC32\RELEASE\WINS\UDEB\BRDSRV.LIB                     clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   152
 \EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\PROGRAMS\BRDSRV.DLL   clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   153
 \EPOC32\RELEASE\WINS\UDEB\Z\SYSTEM\PROGRAMS\BRDSRV.PDB   clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   154
 \EPOC32\rom\include\brdcst.iby                           clean
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   155
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   156
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   157
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   158
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   159
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   160
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   161
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   162
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   163
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   164
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   165
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   166
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   167
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   168
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   169
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   170
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   171
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   172
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   173
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   174
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   175
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   176
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   177
=cut