author | marvin shi <marvin.shi@nokia.com> |
Wed, 17 Nov 2010 16:47:55 +0800 | |
changeset 696 | 30aa553e9465 |
parent 596 | 9f25be3da657 |
permissions | -rw-r--r-- |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
1 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
2 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
3 |
# All rights reserved. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
4 |
# This component and the accompanying materials are made available |
584 | 5 |
# under the terms of the License "Eclipse Public License v1.0" |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
6 |
# which accompanies this distribution, and is available |
584 | 7 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
8 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
9 |
# Initial Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
10 |
# Nokia Corporation - initial contribution. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
11 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
12 |
# Contributors: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
13 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
14 |
# Description: |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
15 |
# Enabler for overriding file and data entries from platform iby files. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
16 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
17 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
18 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
19 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
20 |
############################################################################## |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
21 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
22 |
# Example 1: Replace an existing file with a different source files |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
23 |
# This replaces the original line with the override line. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
24 |
# NOTE! One must define the ROM_IMAGE section for the overrides correctly. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
25 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
26 |
# Some platform.iby |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
27 |
# data=file.txt sys\bin\file.txt // In ROM_IMAGE[3] |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
28 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
29 |
# product.iby |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
30 |
# ROM_IMAGE[3] data-override=file_product.txt sys\bin\file.txt |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
31 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
32 |
# output |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
33 |
# data=file_product.txt sys\bin\file.txt |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
34 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
35 |
# Example 2: Remove an existing file from a platform iby |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
36 |
# This deletes the original line from the iby structure. |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
37 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
38 |
# Some platform.iby |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
39 |
# data=file.txt sys\bin\file.txt // In ROM_IMAGE[3] |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
40 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
41 |
# product.iby |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
42 |
# ROM_IMAGE[3] { |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
43 |
# data-override=empty sys\bin\file.txt |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
44 |
# } |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
45 |
# output |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
46 |
# REM OVERRIDE data=file_product.txt sys\bin\file.txt |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
47 |
# |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
48 |
############################################################################## |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
49 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
50 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
51 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
52 |
package override; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
53 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
54 |
use strict; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
55 |
use warnings; |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
56 |
use File::Basename; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
57 |
use plugincommon; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
58 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
59 |
# OVERRIDE TARGET FOUND OVERRIDE TARGET NOT FOUND |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
60 |
use constant REPLACE_ADD => 0; # Replace with override Add override |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
61 |
use constant REPLACE_SKIP => 1; # Replace with override Do nothing |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
62 |
use constant REPLACE_WARN => 2; # Replace with override Do nothing but warn |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
63 |
use constant SKIP_ADD => 3; # Do nothing Add override |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
64 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
65 |
BEGIN |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
66 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
67 |
use Exporter(); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
68 |
our ($VERSION, @ISA, @EXPORT); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
69 |
$VERSION = 1.00; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
70 |
@ISA = qw(Exporter); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
71 |
@EXPORT = qw(&override_info &override_init &override_process); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
72 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
73 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
74 |
my $conf; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
75 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
76 |
sub override_info |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
77 |
{ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
78 |
return({ |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
79 |
name => "override", |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
80 |
invocation => "InvocationPoint2", # tmp6.oby |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
81 |
initialize => "override::override_init", |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
82 |
single => "override::override_process"}); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
83 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
84 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
85 |
sub override_init |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
86 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
87 |
plugin_init(&override_info, $conf = shift(), 0); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
88 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
89 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
90 |
sub override_process |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
91 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
92 |
plugin_start(&override_info, $conf); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
93 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
94 |
my $obydata = shift(); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
95 |
my %targets = (); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
96 |
my @overrides = (); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
97 |
my @oconfstack = (REPLACE_WARN); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
98 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
99 |
# Go through all the tmp6.oby (InvocationPoint2) lines and store |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
100 |
# normal targets' data to %targets and override targets' data to @overrides |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
101 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
102 |
dprint(2, "Finding overrides..."); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
103 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
104 |
foreach (@{$obydata}) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
105 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
106 |
next if !(my $parse = parse_obyline($_)); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
107 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
108 |
if (($parse == 2) && ($gKeyword =~ /-?override$/i)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
109 |
# Override entry |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
110 |
$_ = "$gHandlestr $_", next if ($gImgid != $gRomidCmp); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
111 |
dprint(2, "#$gLnum: `$gLine'"); |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
112 |
push(@overrides, [$gLnum - 1, $oconfstack[$#oconfstack]]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
113 |
next; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
114 |
} |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
115 |
if (($parse == 2) && ($gKeyword =~ FILEBITMAPSPECKEYWORD)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
116 |
# Normal file specification entry |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
117 |
$targets{$gTgtCmp} = $targets{File::Basename::basename($gTgtCmp)} = $gLnum - 1 |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
118 |
if ($gImgid == $gRomidCmp); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
119 |
next; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
120 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
121 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
122 |
next if !/^\s*OVERRIDE_(?:(END)|(REPLACE\/ADD)|(REPLACE\/SKIP)|(REPLACE\/WARN)|SKIP\/ADD)\s*$/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
123 |
|
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
124 |
# Override configuration keyword |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
125 |
$_ = "$gHandlestr $_"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
126 |
next if $gRomid && ($gImgid != $gRomidCmp); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
127 |
if (defined($1)) { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
128 |
# OVERRIDE_END |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
129 |
pop(@oconfstack); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
130 |
} else { |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
131 |
# OVERRIDE_REPLACE/ADD|REPLACE/SKIP|REPLACE/WARN|SKIP/ADD |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
132 |
push(@oconfstack, defined($2) ? REPLACE_ADD : (defined($3) ? REPLACE_SKIP : (defined($4) ? REPLACE_WARN : SKIP_ADD))); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
133 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
134 |
dprint(2, "#$gLnum: `$gLine'"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
135 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
136 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
137 |
# Loop through all overrides and handle them |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
138 |
dprint(3, @overrides ? "Handling overrides..." : "No override entries found"); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
139 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
140 |
foreach (@overrides) |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
141 |
{ |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
142 |
my ($tlnum, $olnum, $type) = (0, @$_); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
143 |
parse_keyline(${$obydata}[$olnum]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
144 |
dprint(2, "Handling : `$gLine' (" . ("REPLACE/ADD", "REPLACE/SKIP", "REPLACE/WARN", "SKIP/ADD")[$type] . ")"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
145 |
${$obydata}[$olnum] = "$gHandlestr ${$obydata}[$olnum]"; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
146 |
|
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
147 |
if (defined($tlnum = $targets{$gTgtCmp}) || defined($tlnum = $targets{File::Basename::basename($gTgtCmp)})) { |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
148 |
# Override target found |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
149 |
my ($line, $keyword, $source, $attrib) = ($gLine, $gKeyword, $gSource, $gAttrib); |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
150 |
parse_keyline(${$obydata}[$tlnum]); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
151 |
dprint(2, "Target : `$gLine' (#" . ($tlnum + 1) . ")"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
152 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
153 |
if ($type == SKIP_ADD) { |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
154 |
dprint(2, "Do nothing : Target found and override type SKIP"); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
155 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
156 |
elsif ($source =~ /^empty$/i) { |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
157 |
# Empty keyword -> comment line out |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
158 |
${$obydata}[$tlnum] = "$gHandlestr ${$obydata}[$tlnum]"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
159 |
dprint(1, "Remove `$gLine' due to `$line'"); |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
160 |
dprint(2, "Replace with: `${$obydata}[$tlnum]' (Override source EMPTY)"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
161 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
162 |
else { |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
163 |
# Replace existing line with new line |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
164 |
$keyword =~ s/-?override$//i; |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
165 |
$attrib = ($attrib eq "" ? $gAttrib : ($attrib =~ /^\s*empty$/i ? "" : $attrib)); |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
166 |
$line = ${$obydata}[$tlnum] = ($keyword ne "" ? $keyword : $gKeyword) . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
167 |
($source =~ /\s/ ? "=\"$source\"" : "=$source") . " " . |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
168 |
($gTarget =~ /\s/ ? "\"$gTarget\"" : $gTarget) . "$attrib\n"; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
169 |
dprint(1, "Replace `$gLine' with `$line'"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
170 |
dprint(2, "Replace with: `$line'"); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
171 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
172 |
} |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
173 |
else { # Override target not found |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
174 |
if ($type == REPLACE_SKIP) { |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
175 |
dprint(2, "Do nothing : Target not found and override type SKIP"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
176 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
177 |
elsif ($type == REPLACE_WARN) { |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
178 |
dprint(-3, "Ignoring override target `$gTarget', target not found"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
179 |
dprint(2, "Do nothing : Target not found and override type WARN"); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
180 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
181 |
else { |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
182 |
# OVERRIDE_XXX/ADD |
596
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
183 |
(my $line = $gLine) =~ s/^(\S*?)-?override/$1/i; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
184 |
$line = ${$obydata}[$olnum] = ($1 ne "" ? "" : "data") . $line; |
9f25be3da657
Updated to iMaker version 10.24.01, 14-Jun-2010.
m2lahtel <>
parents:
584
diff
changeset
|
185 |
dprint(1, "Add `$line' from `$gLine'"); |
1
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
186 |
dprint(2, "Add new : `$line' (Target not found, override type ADD)"); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
187 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
188 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
189 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
190 |
plugin_end(); |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
191 |
} |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
192 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
193 |
1; |
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
194 |
|
be27ed110b50
Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff
changeset
|
195 |
__END__ # OF OVERRIDE.PM |