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