bldsystemtools/commonbldutils/RmInstalledEnv.pl
changeset 0 83f4b4db085c
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 #!/usr/bin/perl
       
     2 
       
     3 =head1 NAME
       
     4 
       
     5 RmInstalledEnv.pl
       
     6 
       
     7 =head1 SYNOPSIS
       
     8 
       
     9 RmInstalledEnv.pl
       
    10 
       
    11 =head1 DESCRIPTION
       
    12 
       
    13 This script is designed to use RemoveRel command from the CBR tools to remove the installed environment.
       
    14 
       
    15 =head1 COPYRIGHT
       
    16 
       
    17 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
    18 All rights reserved.
       
    19 
       
    20 =cut
       
    21 
       
    22 use strict;
       
    23 use Getopt::Long;
       
    24 
       
    25 
       
    26 my ($iIncludeFile) = ProcessCommandLine();
       
    27 
       
    28 open(INPUT, "<$iIncludeFile");
       
    29 my (@includecomponentlist) = <INPUT>;
       
    30 close(INPUT);
       
    31 foreach my $includecomponent ( @includecomponentlist ){
       
    32   chomp($includecomponent);
       
    33   my ($component, $version ) = split(/=>/, $includecomponent);
       
    34   $component =~  s/^\s+//;
       
    35   $component =~  s/\s+$//;
       
    36   print "removerel $component \n";
       
    37   my $getrelresult = `removerel $component `;
       
    38   print $getrelresult ;
       
    39 }
       
    40 
       
    41 # ProcessCommandLine
       
    42 #
       
    43 # Description
       
    44 # This function processes the commandline
       
    45 sub ProcessCommandLine {
       
    46   my ($iHelp, $iIncludeFile);
       
    47 
       
    48   GetOptions('h' => \$iHelp,  'x=s' => \$iIncludeFile);
       
    49 
       
    50   if ($iHelp)
       
    51   {
       
    52     &Usage();
       
    53   } else {
       
    54     return($iIncludeFile);
       
    55   }
       
    56 }
       
    57 
       
    58 # Usage
       
    59 #
       
    60 # Output Usage Information.
       
    61 #
       
    62 
       
    63 sub Usage {
       
    64   print <<USAGE_EOF;
       
    65 
       
    66   Usage: RmInstalledEnv.pl [Args/options]
       
    67 
       
    68   Args: (required)
       
    69   -x  <file> with list of components to remove  
       
    70   
       
    71   options:
       
    72   
       
    73   -h                    help
       
    74   
       
    75   
       
    76   Example Commandline
       
    77   RmInstalledEnv.pl -x includes_phase3.txt 
       
    78 
       
    79 USAGE_EOF
       
    80 	exit 1;
       
    81 }