branch | HighFidelityModel |
changeset 206 | eccc98839441 |
parent 201 | 280dc2a9385b |
child 312 | 9527bd30de64 |
205:cf27962d27a8 | 206:eccc98839441 |
---|---|
1 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 # All rights reserved. |
|
3 # This component and the accompanying materials are made available |
|
4 # under the terms of "Eclipse Public License v1.0" |
|
5 # which accompanies this distribution, and is available |
|
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 # |
|
8 # Initial Contributors: |
|
9 # Nokia Corporation - initial contribution. |
|
10 # |
|
11 # Contributors: |
|
12 # |
|
13 # Description: |
|
14 # This will create a new root system definition file based on the provided template |
|
15 #!/usr/bin/perl |
|
16 |
|
1 use strict; |
17 use strict; |
2 |
18 |
3 |
19 |
4 use FindBin; # for FindBin::Bin |
20 use FindBin; # for FindBin::Bin |
5 use lib $FindBin::Bin; |
21 use lib $FindBin::Bin; |
23 my $warning = "Error"; |
39 my $warning = "Error"; |
24 my $placeholders=0; |
40 my $placeholders=0; |
25 |
41 |
26 my @tdOrder =("hb","se", "lo","dc", "vc" , "pr", "dm", "de", "mm", "ma" , "ui", "rt", "to" ); |
42 my @tdOrder =("hb","se", "lo","dc", "vc" , "pr", "dm", "de", "mm", "ma" , "ui", "rt", "to" ); |
27 |
43 |
28 # need to add options for controlling which metas are filtered out and which are included inline |
44 sub help |
45 { |
|
46 my $name= $0; $name=~s,^.*[\\/],,; |
|
47 print STDERR "usage: $name [options...] template\n\nThis will create a new root system definition file based on the provided template by globbing for pkgdefs in the filesystem. Any found pkgdef files are added to the end of their layer or at the end of their tech domain section, if one is defined", |
|
48 "\nvalid options are:\n", |
|
49 " -path [dir]\tspecifies the full system-model path to the file which is being processed. By default this is \"/os/deviceplatformrelease/foundation_system/system_model/system_definition.xml\"\n", |
|
50 "\t\tThis is only needed when creating a stand-alone sysdef as the output", |
|
51 |
|
52 " -output [file]\tspecifies the file to save the output to. If set, all hrefs will set to be relative to this location. If not specified all href will be absolute file URIs and this will write to stdout\n\n", |
|
53 |
|
54 " -w [Note|Warning|Error]\tspecifies prefix text for any notifications. Defautls to Error\n\n", |
|
55 " -root [dir]\tspecifies the root directory of the filesystem. All globbing will be done relative to this path\n\n", |
|
56 |
|
57 " -glob [wildcard path]\tThe wildcard search to look for pkgdef files. eg \"\*\*\package_definition.xml\". Can specify any number of these.\n", |
|
58 " -placeholders [bool]\tif set, all packages not found in the template will be left in as empty placeholders\n"; |
|
59 exit(1); |
|
60 } |
|
61 |
|
29 GetOptions |
62 GetOptions |
30 ( |
63 ( |
31 'path=s' => \$path, |
64 'path=s' => \$path, |
32 'output=s' => \$output, |
65 'output=s' => \$output, |
33 'w=s' => \$warning, |
66 'w=s' => \$warning, |
45 # output specifies the file this is saved in. If specified, all (relative) paths will be modified to be relative to it. If not, all paths will be absolute |
78 # output specifies the file this is saved in. If specified, all (relative) paths will be modified to be relative to it. If not, all paths will be absolute |
46 # w is the warning level: Note, Warning or Error. |
79 # w is the warning level: Note, Warning or Error. |
47 # root = -root g:\sf |
80 # root = -root g:\sf |
48 # glob = -glob "\*\*\package_definition.xml" |
81 # glob = -glob "\*\*\package_definition.xml" |
49 |
82 |
50 #rootsysdef.pl -root F:\dev\personal\sftest\sf\mcl -glob "\*\*\package_definition.xml" -output ..\..\..\deviceplatformrelease\nokia_system\system_definition.sf.xml ..\..\..\deviceplatformrelease\foundation_system\system_model\system_definition.xml |
83 #Example command lines: |
84 #rootsysdef.pl -root F:\sftest\mcl\sf -glob "\*\*\package_definition.xml" -output F:\sftest\mcl\build\system_definition.sf.xml F:\sftest\mcl\sf\os\deviceplatformrelease\foundation_system\system_model\system_definition.xml |
|
85 #rootsysdef.pl -root F:\sftest\mcl\sf -glob "\*\*\*\*\package_definition.xml" -output F:\sftest\mcl\build\system_definition.mine.xml F:\sftest\mcl\sf\os\deviceplatformrelease\foundation_system\system_model\system_definition.xml |
|
86 if(!scalar $ARGV) {&help()}; |
|
87 |
|
51 |
88 |
52 my %replacefile; |
89 my %replacefile; |
53 my $dir; |
90 my $dir; |
54 foreach(@searchpaths) |
91 foreach(@searchpaths) |
55 { |
92 { |
64 $add{&abspath($file)}=1; |
101 $add{&abspath($file)}=1; |
65 } |
102 } |
66 } |
103 } |
67 |
104 |
68 my $sysdef = &abspath(shift); # resolve the location of the root sysdef |
105 my $sysdef = &abspath(shift); # resolve the location of the root sysdef |
106 |
|
69 |
107 |
70 # rootmap is a mapping from the filesystem to the paths in the doc |
108 # rootmap is a mapping from the filesystem to the paths in the doc |
71 my %rootmap = &rootMap($path,$sysdef); |
109 my %rootmap = &rootMap($path,$sysdef); |
72 my %nsmap; |
110 my %nsmap; |
73 my %urimap; |
111 my %urimap; |
101 { |
139 { |
102 $modpath = &relativeTo(&abspath($output), $sysdef); |
140 $modpath = &relativeTo(&abspath($output), $sysdef); |
103 } |
141 } |
104 |
142 |
105 |
143 |
106 # find all the namespaces used in all trhe fragments and use that |
144 # find all the namespaces used in all the fragments and use that |
107 # to set the namespaces ni the root element of the created doc |
145 # to set the namespaces in the root element of the created doc |
108 # should be able to optimise by only parsing each doc once and |
146 # should be able to optimise by only parsing each doc once and |
109 # maybe skipping the contends of <meta> |
147 # maybe skipping the contends of <meta> |
110 my @nslist = &namespaces($sysdef,$sysdefdoc->getDocumentElement()); |
148 my @nslist = &namespaces($sysdef,$sysdefdoc->getDocumentElement()); |
111 |
149 |
112 my %replacing; |
150 my %replacing; |