releasing/cbrtools/perl/RemoveRel
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, 'RemoveRel');
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    34
my $comp;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    35
my $source;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    36
my $force;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    37
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    38
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    39
# Main.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    40
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    41
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    42
ProcessCommandLine();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    43
RemoveRel();
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    44
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    45
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    46
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    47
# Subs.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    48
#
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    49
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    50
sub ProcessCommandLine {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    51
  Getopt::Long::Configure ("bundling");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    52
  my $help;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    53
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    54
  GetOptions("h" => \$help, "v+" => \$verbose, "s" => \$source, "f" => \$force);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    55
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    56
  if ($help) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    57
    Usage(0);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    58
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    59
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    60
  $comp = shift @ARGV;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    61
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    62
  unless (defined $comp and $#ARGV == -1) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    63
    print "Error: Invalid number of arguments\n";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    64
    Usage(1);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    65
  }
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 Usage {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    69
  my $exitCode = shift;
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    70
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    71
  Utils::PrintDeathMessage($exitCode, "\nUsage: removerel [options] <component>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    72
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    73
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    74
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    75
-h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    76
-s  remove source also
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    77
-f  (deprecated)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    78
-v  verbose output (-vv very verbose)\n");
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    79
}
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    80
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    81
sub RemoveRel {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    82
  my $envDb = EnvDb->Open($iniData, $verbose);
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    83
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    84
  if (!$envDb->ComponentExistsInDatabase($comp)) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    85
    die "Error: $comp not currently installed\n";
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
  eval {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    89
    if($source) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    90
      $envDb->DeleteSource($comp, undef, 1);
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
  if ($@) {
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    94
    print "$@";
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    95
  }
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    96
  
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
    97
  $envDb->RemoveComponent($comp);
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
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   101
__END__
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   102
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   103
=head1 NAME
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   104
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   105
RemoveRel - Removes the binaries of a component release from the current environment.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   106
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   107
=head1 SYNOPSIS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   108
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   109
  removerel [options] <component>
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   110
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   111
options:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   112
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   113
  -h  help
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   114
  -f  (deprecated)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   115
  -v  verbose output (-vv very verbose)
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   116
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   117
=head1 DESCRIPTION
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   118
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   119
When the binaries from a component release are installed into an environment using either C<GetRel> or C<GetEnv>, a file is stored in F<\epoc32\relinfo> containing details of the files that were unpacked. This information is used by C<RemoveRel> to remove the installed binaries. C<RemoveRel> also updates the environment database to reflect this change. Note, C<RemoveRel> makes no attempt to the remove the release's source code.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   120
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   121
=head1 KNOWN BUGS
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   122
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   123
None.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   124
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   125
=head1 COPYRIGHT
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   126
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   127
 Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   128
 All rights reserved.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   129
 This component and the accompanying materials are made available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   130
 under the terms of the License "Eclipse Public License v1.0"
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   131
 which accompanies this distribution, and is available
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   132
 at the URL "http://www.eclipse.org/legal/epl-v10.html".
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   133
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   134
 Initial Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   135
 Nokia Corporation - initial contribution.
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   136
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   137
 Contributors:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   138
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   139
 Description:
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   140
 
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   141
3145852acc89 add releasing to new structure
jjkang
parents:
diff changeset
   142
=cut