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