releasing/cbrtools/perl/listcomponents
changeset 607 378360dbbdba
parent 602 3145852acc89
equal deleted inserted replaced
591:22486c9c7b15 607:378360dbbdba
       
     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 
       
    24 
       
    25 #
       
    26 # Globals.
       
    27 #
       
    28 
       
    29 my $iniData = IniData->New();
       
    30 
       
    31 
       
    32 #
       
    33 # Main.
       
    34 #
       
    35 
       
    36 ProcessCommandLine();
       
    37 PrintListComponents();
       
    38 
       
    39 #
       
    40 # Subs.
       
    41 #
       
    42 
       
    43 sub ProcessCommandLine {
       
    44   Getopt::Long::Configure ("bundling");
       
    45   my $help;
       
    46   GetOptions('h' => \$help);
       
    47 
       
    48   if ($help) {
       
    49     Usage(0);
       
    50   }
       
    51 
       
    52   unless ($#ARGV == -1) {
       
    53     print "Error: Invalid arguments\n";
       
    54     Usage(1);
       
    55   }
       
    56 }
       
    57 
       
    58 sub Usage {
       
    59   my $exitCode = shift;
       
    60 
       
    61   Utils::PrintDeathMessage($exitCode, "\nUsage: listcomponents [options] 
       
    62 
       
    63 options:
       
    64 
       
    65 -h  help\n");
       
    66 }
       
    67 
       
    68 sub PrintListComponents {
       
    69   my @Components = ();
       
    70   
       
    71   foreach my $component (sort @{$iniData->PathData->ListComponents()}){
       
    72     my $found = 0;
       
    73     
       
    74     $component = lc($component);
       
    75 
       
    76     foreach(@Components){
       
    77       if($component eq $_){
       
    78         $found = 1;
       
    79 	last;
       
    80       }
       
    81     }
       
    82     
       
    83     unless($found){
       
    84       push(@Components, $component);
       
    85     }
       
    86   }
       
    87 
       
    88   foreach(@Components){
       
    89     print "$_\n";
       
    90   }
       
    91 }
       
    92 
       
    93 __END__
       
    94 
       
    95 =head1 NAME
       
    96 
       
    97 ListComponents - Prints a list of the components on the local archive.
       
    98 
       
    99 =head1 SYNOPSIS
       
   100 
       
   101   listcomponents [options] 
       
   102 
       
   103 options:
       
   104 
       
   105   -h  help
       
   106 
       
   107 =head1 DESCRIPTION
       
   108 
       
   109 Lists all the components on the local archive.
       
   110 
       
   111 =head1 KNOWN BUGS
       
   112 
       
   113 None.
       
   114 
       
   115 =head1 COPYRIGHT
       
   116 
       
   117  Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   118  All rights reserved.
       
   119  This component and the accompanying materials are made available
       
   120  under the terms of the License "Eclipse Public License v1.0"
       
   121  which accompanies this distribution, and is available
       
   122  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   123  
       
   124  Initial Contributors:
       
   125  Nokia Corporation - initial contribution.
       
   126  
       
   127  Contributors:
       
   128  
       
   129  Description:
       
   130  
       
   131 
       
   132 =cut