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