author | Bob Rosenberg <bob.rosenberg@nokia.com> |
Fri, 06 Aug 2010 10:52:54 +0100 | |
changeset 635 | 945d232265c4 |
parent 624 | f70b728ea30c |
permissions | -rw-r--r-- |
624
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
1 |
# Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
2 |
# All rights reserved. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
3 |
# This component and the accompanying materials are made available |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
4 |
# under the terms of "Eclipse Public License v1.0" |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
5 |
# which accompanies this distribution, and is available |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
7 |
# |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
8 |
# Initial Contributors: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
9 |
# Nokia Corporation - initial contribution. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
10 |
# |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
11 |
# Contributors: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
12 |
# |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
13 |
# Description: |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
14 |
# Script to validate the unit links in a system definition or package definition XML file |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
15 |
#!/usr/bin/perl |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
16 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
17 |
use strict; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
18 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
19 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
20 |
use FindBin; # for FindBin::Bin |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
21 |
use lib $FindBin::Bin; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
22 |
use lib "$FindBin::Bin/lib"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
23 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
24 |
use Cwd; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
25 |
use Cwd 'abs_path'; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
26 |
use Getopt::Long; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
27 |
use File::Basename; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
28 |
use File::Spec; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
29 |
use XML::DOM; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
30 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
31 |
my $output; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
32 |
my $path; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
33 |
my %defineParams; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
34 |
my %defines; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
35 |
my $defaultns = 'http://www.symbian.org/system-definition'; # needed if no DTD |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
36 |
my $realloc; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
37 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
38 |
# need to add options for controlling which metas are filtered out and which are included inline |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
39 |
GetOptions |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
40 |
( |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
41 |
'path=s' => $path, |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
42 |
'effective-sysdef=s' => \$realloc |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
43 |
); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
44 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
45 |
# -path specifies the full system-model path to the file which is being processed. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
46 |
# This must be an absolute path if you're processing a root sysdef. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
47 |
# If processing a pkgdef file, you can use "./package_definition.xml" to leave all links relative. Though I can't really see the use case for this. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
48 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
49 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
50 |
# if config is not set, no confguration will be done. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
51 |
# If it is set, all configuration metadata will be processed and stripped from the output, even if the confguration data is empty |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
52 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
53 |
if($path eq '') {$path = '/os/deviceplatformrelease/foundation_system/system_model/system_definition.xml'} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
54 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
55 |
($#ARGV == -1 ) && &help(); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
56 |
my $sysdef = &abspath(shift); # resolve the location of the root sysdef |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
57 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
58 |
$realloc = $realloc || $sysdef; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
59 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
60 |
my %unitmap; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
61 |
my @p1=reverse(split(/[\\\/]/,$path)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
62 |
my @p2=reverse(split(/[\\\/]/,$realloc)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
63 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
64 |
shift(@p1);shift(@p2); # don't care abt file name |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
65 |
while(lc($p1[0]) eq lc($p2[0])) {shift(@p1);shift(@p2)} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
66 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
67 |
$unitmap{join('/',reverse(@p1))} = join("/",reverse(@p2)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
68 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
69 |
my @p1=reverse(split(/[\\\/]/,$sysdef)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
70 |
my @p2=reverse(split(/[\\\/]/,$realloc)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
71 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
72 |
shift(@p1);shift(@p2); # don't care abt file name |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
73 |
while(lc($p1[0]) eq lc($p2[0]) && scalar(@p1)) {shift(@p1);shift(@p2)} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
74 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
75 |
$unitmap{join('/',reverse(@p1))} = join("/",reverse(@p2)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
76 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
77 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
78 |
# rootmap is a mapping from the filesystem to the paths in the doc |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
79 |
my %rootmap = &rootMap($path,$sysdef); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
80 |
my %nsmap; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
81 |
my %urimap; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
82 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
83 |
my $parser = new XML::DOM::Parser; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
84 |
my $sysdefdoc; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
85 |
eval { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
86 |
$sysdefdoc = $parser->parsefile ($sysdef); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
87 |
}; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
88 |
if(!$sysdefdoc) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
89 |
die "ERROR: could not open $sysdef\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
90 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
91 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
92 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
93 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
94 |
my $maxschema = $sysdefdoc->getDocumentElement()->getAttribute('schema'); # don't check value, just store it. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
95 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
96 |
my $docroot = $sysdefdoc->getDocumentElement; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
97 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
98 |
my $ns = $docroot->getAttribute('id-namespace'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
99 |
if(!$ns && $nsmap{''}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
100 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
101 |
$docroot->setAttribute('id-namespace',$nsmap{''}); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
102 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
103 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
104 |
$docroot->setAttribute('schema',$maxschema); # output has the largest syntax version of all includes |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
105 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
106 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
107 |
while(my($pre,$uri) = each(%nsmap)) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
108 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
109 |
$pre ne '' || next ; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
110 |
$docroot->setAttribute("xmlns:$pre",$uri); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
111 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
112 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
113 |
&walk($sysdef,$docroot); # process the XML |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
114 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
115 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
116 |
sub abspath |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
117 |
{ # normalize the path into an absolute one |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
118 |
my ($name,$path) = fileparse($_[0]); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
119 |
$path=~tr,\\,/,; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
120 |
if( -e $path) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
121 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
122 |
return abs_path($path)."/$name"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
123 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
124 |
my @dir = split('/',$_[0]); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
125 |
my @new; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
126 |
foreach my $d (@dir) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
127 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
128 |
if($d eq '.') {next} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
129 |
if($d eq '..') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
130 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
131 |
pop(@new); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
132 |
next; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
133 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
134 |
push(@new,$d) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
135 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
136 |
return join('/',@new); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
137 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
138 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
139 |
sub rootMap { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
140 |
my @pathdirs = split(/\//,$_[0]); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
141 |
my @rootdirs = split(/\//,$_[1]); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
142 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
143 |
while(lc($rootdirs[$#rootdirs]) eq lc($pathdirs[$#pathdirs]) ) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
144 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
145 |
pop(@rootdirs); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
146 |
pop(@pathdirs); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
147 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
148 |
return (join('/',@rootdirs) => join('/',@pathdirs) ); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
149 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
150 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
151 |
sub rootMapMeta { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
152 |
# find all the explict path mapping from the link-mapping metadata |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
153 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
154 |
foreach my $child (@{$node->getChildNodes}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
155 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
156 |
if ($child->getNodeType==1 && $child->getTagName eq 'map-prefix') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
157 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
158 |
my $from = $child->getAttribute('link'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
159 |
my $to = $child->getAttribute('to'); # optional, but blank if not set |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
160 |
$rootmap{$from} = $to; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
161 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
162 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
163 |
# once this is processed we have no more need for it. Remove from output |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
164 |
$node->getParentNode->removeChild($node); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
165 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
166 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
167 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
168 |
sub walk |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
169 |
{ # walk through the doc, resolving all links |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
170 |
my $file = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
171 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
172 |
my $type = $node->getNodeType; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
173 |
if($type!=1) {return} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
174 |
my $tag = $node->getTagName; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
175 |
if($tag=~/^(layer|package|collection|component)$/ ) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
176 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
177 |
my $link= $node->getAttribute('href'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
178 |
if($link) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
179 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
180 |
my $file = &resolvePath($file,$link); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
181 |
if(-e $file) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
182 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
183 |
&combineLink($node,$file); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
184 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
185 |
else |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
186 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
187 |
print "Note: $file not found\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
188 |
$node->removeAttribute('href'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
189 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
190 |
return; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
191 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
192 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
193 |
elsif($tag=~/^(SystemDefinition|systemModel)$/ ) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
194 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
195 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
196 |
elsif($tag eq 'unit') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
197 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
198 |
my %at = &atts($node); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
199 |
my $pro; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
200 |
foreach my $o (keys(%at)) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
201 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
202 |
if($o eq 'proFile' || $o=~/:proFile$/) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
203 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
204 |
$pro = $at{$o}; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
205 |
last; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
206 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
207 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
208 |
my $filter=$node->getParentNode()->getAttribute('filter'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
209 |
if($filter ne '' && $at{'filter'}) {$filter.=','.$at{'filter'}} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
210 |
elsif($at{'filter'}) {$filter=$at{'filter'}} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
211 |
if($filter ne '') {$filter="\t($filter)"} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
212 |
foreach my $atr ('bldFile','mrp','base') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
213 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
214 |
my $ext; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
215 |
my $link= $at{$atr}; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
216 |
if($atr eq 'bldFile') { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
217 |
$ext = ($pro ne '') ? "/$pro" : '/bld.inf' |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
218 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
219 |
if($link ne '') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
220 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
221 |
my $ok = 0; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
222 |
my $trylink; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
223 |
if($link && !($link=~/^\//)) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
224 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
225 |
$link= &abspath(File::Basename::dirname($file)."/$link"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
226 |
$ok = (-e "$link$ext"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
227 |
if(!$ok) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
228 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
229 |
foreach my $a (keys %rootmap) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
230 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
231 |
$link=~s,^$a,$rootmap{$a},ie; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
232 |
# remove leading ./ which is used to indicate that paths should remain relative |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
233 |
$link=~s,^\./([^/]),$1,; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
234 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
235 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
236 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
237 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
238 |
if(!$ok) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
239 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
240 |
foreach my $a (keys %unitmap) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
241 |
if($a eq substr($link,0,length($a))) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
242 |
$trylink = $unitmap{$a}.substr($link,length($a)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
243 |
if(-e "$trylink$ext") { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
244 |
$ok=1; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
245 |
$link = $trylink; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
246 |
last; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
247 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
248 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
249 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
250 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
251 |
if(!$ok) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
252 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
253 |
print "Error: $atr not found in ",($trylink ne '') ? $trylink : $link,"$filter\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
254 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
255 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
256 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
257 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
258 |
elsif($tag eq 'meta') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
259 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
260 |
my $rel= $node->getAttribute('rel') || 'Generic'; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
261 |
my $link= $node->getAttribute('href'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
262 |
$link=~s,^file://(/([a-z]:/))?,$2,; # convert file URI to absolute path |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
263 |
if ($link ne '' ) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
264 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
265 |
if($link=~/^[\/]+:/) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
266 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
267 |
print "Note: Remote URL $link not validated\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
268 |
next; # do not alter children |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
269 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
270 |
if(! ($link=~/^\//)) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
271 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
272 |
$link= &abspath(File::Basename::dirname($file)."/$link"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
273 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
274 |
if(! -e $link) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
275 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
276 |
if(! -e &realPath($link)) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
277 |
print "Warning: Local metadata file not found: $link\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
278 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
279 |
next; # do not alter children |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
280 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
281 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
282 |
if($node->getAttribute('rel') eq 'link-mapping') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
283 |
{# need to process this now |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
284 |
&rootMapMeta($node); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
285 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
286 |
return; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
287 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
288 |
else {return} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
289 |
my $checkversion=0; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
290 |
foreach my $item (@{$node->getChildNodes}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
291 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
292 |
#print $item->getNodeType,"\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
293 |
&walk($file,$item); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
294 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
295 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
296 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
297 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
298 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
299 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
300 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
301 |
sub realPath |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
302 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
303 |
my $link = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
304 |
foreach my $a (keys %unitmap) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
305 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
306 |
if($a eq substr($link,0,length($a))) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
307 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
308 |
my $trylink = $unitmap{$a}.substr($link,length($a)); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
309 |
if(-e $trylink) {return $trylink} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
310 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
311 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
312 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
313 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
314 |
sub combineLink |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
315 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
316 |
# combine data from linked sysdef fragment w/ equivalent element in parent document |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
317 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
318 |
my $file = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
319 |
my $getfromfile = &localfile($file); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
320 |
$getfromfile eq '' && return; # already raised warning, no need to repeat |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
321 |
my $doc; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
322 |
eval { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
323 |
$doc = $parser->parsefile ($getfromfile); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
324 |
}; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
325 |
if(!$doc) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
326 |
print "ERROR: could not open $getfromfile\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
327 |
return; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
328 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
329 |
my $item =&firstElement($doc->getDocumentElement); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
330 |
$item || die "badly formatted $file"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
331 |
my @upid = &getNamespaceAndValue($node,'id'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
332 |
my @downid = &getNamespaceAndValue($item,'id'); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
333 |
(($upid[0] eq $downid[0]) && ($upid[1] eq $downid[1])) || die "$upid[1] ($upid[0]) differs from $downid[1] ($downid[0]) "; # make sure the link is valid |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
334 |
&walk($getfromfile,$item); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
335 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
336 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
337 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
338 |
sub copyInto |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
339 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
340 |
# make a deep copy the node (2nd arg) into the element (1st arg) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
341 |
my $parent=shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
342 |
my $item = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
343 |
my $doc = $parent->getOwnerDocument; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
344 |
my $type = $item->getNodeType; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
345 |
my $new; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
346 |
if($type==1) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
347 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
348 |
$new = $doc->createElement($item->getTagName); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
349 |
my %down = &atts($item); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
350 |
foreach my $ordered ('id','name','bldFile','mrp','level','levels','introduced','deprecated','filter') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
351 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
352 |
if($down{$ordered}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
353 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
354 |
$new->setAttribute($ordered,$down{$ordered}); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
355 |
delete $down{$ordered} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
356 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
357 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
358 |
while(my($a,$b) = each(%down)) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
359 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
360 |
$new->setAttribute($a,$b); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
361 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
362 |
foreach my $child (@{$item->getChildNodes}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
363 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
364 |
©Into($new,$child); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
365 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
366 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
367 |
elsif($type==3) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
368 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
369 |
$new = $doc->createTextNode ($item->getData); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
370 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
371 |
elsif($type==8) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
372 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
373 |
$new = $doc->createComment ($item->getData); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
374 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
375 |
if($new) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
376 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
377 |
$parent->appendChild($new); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
378 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
379 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
380 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
381 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
382 |
sub getNamespaceAndValue |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
383 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
384 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
385 |
my $attr = shift || 'id'; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
386 |
my $id = $node->getAttribute($attr); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
387 |
if($id eq '') {return} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
388 |
my $ns; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
389 |
if($id=~s/^(.*)://) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
390 |
{ # it's got a ns, find out what it is |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
391 |
$ns=&getNs($node,$1); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
392 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
393 |
else |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
394 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
395 |
$ns = $node->getOwnerDocument->getDocumentElement->getAttribute("id-namespace") || |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
396 |
$defaultns; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
397 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
398 |
return ($ns,$id);; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
399 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
400 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
401 |
sub getNs |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
402 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
403 |
# find the namespace URI that applies to the specified prefix. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
404 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
405 |
my $pre = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
406 |
my $uri = $node->getAttribute("xmlns:$pre"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
407 |
if($uri) {return $uri} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
408 |
my $parent = $node->getParentNode; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
409 |
if($parent && $parent->getNodeType==1) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
410 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
411 |
return getNs($parent,$pre); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
412 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
413 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
414 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
415 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
416 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
417 |
sub firstElement { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
418 |
# return the first element in this node |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
419 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
420 |
foreach my $item (@{$node->getChildNodes}) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
421 |
if($item->getNodeType==1) {return $item} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
422 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
423 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
424 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
425 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
426 |
sub atts { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
427 |
# return a hash of all attribtues defined for this element |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
428 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
429 |
my %at = $node->getAttributes; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
430 |
my %list; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
431 |
foreach my $a (keys %{$node->getAttributes}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
432 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
433 |
if($a ne '') |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
434 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
435 |
$list{$a} = $node->getAttribute ($a); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
436 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
437 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
438 |
return %list; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
439 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
440 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
441 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
442 |
sub ns |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
443 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
444 |
# return a hash of ns prefix and uri -- the xmlns: part is stripped off |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
445 |
my $node = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
446 |
my %list; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
447 |
foreach my $a (keys %{$node->getAttributes}) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
448 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
449 |
my $pre = $a; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
450 |
if($pre=~s/^xmlns://) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
451 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
452 |
$list{$pre} = $node->getAttribute ($a); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
453 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
454 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
455 |
return %list; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
456 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
457 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
458 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
459 |
sub resolvePath |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
460 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
461 |
# return full path to 2nd arg relative to first (path or absolute URI) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
462 |
my $base = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
463 |
my $path = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
464 |
if($path=~m,^/,) {return $path } # path is absolute, but has no drive. Let OS deal with it. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
465 |
if($path=~s,^file:///([a-zA-Z]:/),$1,) {return $path } # file URI with drive letter |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
466 |
if($path=~m,^file://,) {return $path } # file URI with no drive letter (unit-style). Just pass on as is with leading / and let OS deal with it |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
467 |
if($path=~m,^[a-z0-9][a-z0-9]+:,i) {return $path } # absolute URI -- no idea how to handle, so just return |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
468 |
return &abspath(File::Basename::dirname($base)."/$path"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
469 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
470 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
471 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
472 |
sub resolveURI |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
473 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
474 |
# return full path to 2nd arg relative to first (path or absolute URI) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
475 |
my $base = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
476 |
my $path = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
477 |
if($path=~m,[a-z0-9][a-z0-9]+:,i) {return $path } # absolute URI -- just return |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
478 |
if($path=~m,^/,) {return $path } # path is absolute, but has no drive. Let OS deal with it. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
479 |
return &abspath(File::Basename::dirname($base)."/$path"); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
480 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
481 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
482 |
sub localfile |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
483 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
484 |
my $file = shift; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
485 |
if($file=~s,file:///([a-zA-Z]:/),$1,) {return $file } # file URI with drive letter |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
486 |
if($file=~m,file://,) {return $file } # file URI with no drive letter (unit-style). Just pass on as is with leading / and let OS deal with it |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
487 |
if($file=~m,^([a-z0-9][a-z0-9]+):,i) |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
488 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
489 |
print "ERROR: $1 scheme not supported\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
490 |
return; # return empty string if not supported. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
491 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
492 |
return $file |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
493 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
494 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
495 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
496 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
497 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
498 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
499 |
sub help |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
500 |
{ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
501 |
my $name= $0; $name=~s,^.*[\\/],,; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
502 |
my $text; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
503 |
format STDERR = |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
504 |
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
505 |
$text, |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
506 |
^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~ |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
507 |
$text |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
508 |
. |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
509 |
print STDERR "usage: $name [options...] sysdef\n valid options are:\n\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
510 |
foreach ( |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
511 |
"-path [sm-path]\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\"", |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
512 |
" This must be an absolute path if you're processing a root sysdef.", |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
513 |
" If processing a pkgdef file, you can use \"./package_definition.xml\" to leave all links relative.", |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
514 |
"effective-sysdef [local-file]\tspecifies another local filesystem location the sysdef should be considered when resolving linked metas and unit paths, but not system model item hrefs. This is mainly used for testing system-wide changes to pkgdefs since it allows the pkgdefs to exist in a separate location to the rest of the codeline" |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
515 |
) { |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
516 |
$text = $_; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
517 |
write STDERR; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
518 |
print STDERR "\n"; |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
519 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
520 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
521 |
exit(1); |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
522 |
} |
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
523 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
524 |
|
f70b728ea30c
Move sysdeftools from buildtools package into build package
Bob Rosenberg <bob.rosenberg@nokia.com>
parents:
diff
changeset
|
525 |