| 392 |
dpurdie |
1 |
#! perl
|
|
|
2 |
########################################################################
|
|
|
3 |
# Copyright ( C ) 2004 ERG Limited, All rights reserved
|
|
|
4 |
#
|
|
|
5 |
# Module name : jats.sh
|
|
|
6 |
# Module type : Makefile system
|
|
|
7 |
# Compiler(s) : n/a
|
|
|
8 |
# Environment(s): jats
|
|
|
9 |
#
|
|
|
10 |
# Description : Uses a "raw_data.txt file to extract data to draw pretty
|
|
|
11 |
# pictures. Not used any more
|
|
|
12 |
#
|
|
|
13 |
# Usage:
|
|
|
14 |
#
|
|
|
15 |
# Version Who Date Description
|
|
|
16 |
#
|
|
|
17 |
#......................................................................#
|
|
|
18 |
|
|
|
19 |
require 5.006_001;
|
|
|
20 |
use strict;
|
|
|
21 |
use warnings;
|
|
|
22 |
use Data::Dumper;
|
|
|
23 |
use Cwd;
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
#-------------------------------------------------------------------------------
|
|
|
27 |
# Globals
|
|
|
28 |
#
|
|
|
29 |
my %packages;
|
|
|
30 |
my %required_packages;
|
|
|
31 |
my %needed_by;
|
|
|
32 |
|
|
|
33 |
|
|
|
34 |
#-------------------------------------------------------------------------------
|
|
|
35 |
# Read in the build.xml file
|
|
|
36 |
#
|
|
|
37 |
|
|
|
38 |
open FH, '<raw_data.txt' or die "Can't open build.xml";
|
|
|
39 |
while ( <FH> )
|
|
|
40 |
{
|
|
|
41 |
chomp;
|
|
|
42 |
# print "$_\n";
|
|
|
43 |
|
|
|
44 |
AddPackage( $_ );
|
|
|
45 |
|
|
|
46 |
}
|
|
|
47 |
close FH;
|
|
|
48 |
|
|
|
49 |
#
|
|
|
50 |
# Display results
|
|
|
51 |
#
|
|
|
52 |
|
|
|
53 |
DebugDumpData ('Packages', \%packages );
|
|
|
54 |
DebugDumpData ('Inverse', \%needed_by );
|
|
|
55 |
|
|
|
56 |
|
|
|
57 |
#
|
|
|
58 |
# Extract package information
|
|
|
59 |
# Given a package 'xxx' determine the packages that are needed to build it
|
|
|
60 |
#
|
|
|
61 |
#AddToPackages( 'daf_br.syd' , 'daf_services.syd' );# , 'AVMApplicationEngine.syd', 'AVMComponentLayer.syd', 'gate_ferry.syd', 'gate_monorail.syd', 'gate_rail.syd', 'hcp5000.syd', 'IDC.syd', 'IDCDB.syd', 'ocp5000.syd', 'PDTD.syd', 'safpd.syd', 'ssu5000.syd', 'StaAvmMainIo.syd', 'tp5000.syd', 'vcp5000.syd');
|
|
|
62 |
AddToPackages( 'safpd.syd' );
|
|
|
63 |
|
|
|
64 |
DebugDumpData ('Needed Packages', \%required_packages );
|
|
|
65 |
|
|
|
66 |
#
|
|
|
67 |
# Display details of the required packages
|
|
|
68 |
#
|
|
|
69 |
print "Required Packages and versions\n";
|
|
|
70 |
foreach my $alias ( sort keys %required_packages )
|
|
|
71 |
{
|
|
|
72 |
my $name = $packages{$alias}{'name'};
|
|
|
73 |
my $ext = $packages{$alias}{'ext'};
|
|
|
74 |
my $version = $packages{$alias}{'version'};
|
|
|
75 |
my $label = $packages{$alias}{'label'};
|
|
|
76 |
my $path = $packages{$alias}{'path'};
|
|
|
77 |
|
|
|
78 |
print STDERR "ERROR: No name for: $alias\n" unless $name;
|
|
|
79 |
print STDERR "ERROR: No version for: $alias\n" unless $version;
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
my $pname = $name . '_' . $version;
|
|
|
83 |
$pname .= $ext if ( $ext );
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
printf( "%-40s, %-50s, %s\n", $pname, $label, $path);
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
exit 0;
|
|
|
91 |
|
|
|
92 |
#-------------------------------------------------------------------------------
|
|
|
93 |
# Function : AddPackage
|
|
|
94 |
#
|
|
|
95 |
# Description : Extract package information
|
|
|
96 |
#
|
|
|
97 |
# Inputs :
|
|
|
98 |
#
|
|
|
99 |
# Returns :
|
|
|
100 |
#
|
|
|
101 |
sub AddPackage
|
|
|
102 |
{
|
|
|
103 |
my %data;
|
|
|
104 |
my ( $line ) = @_;
|
|
|
105 |
my ( $alias, $name, $ext, $version, $planned, $label, $path, @depends )
|
|
|
106 |
= split ',', $line;
|
|
|
107 |
|
|
|
108 |
# print "Name: $data{name}\n";
|
|
|
109 |
# print "Value:$data{value}\n";
|
|
|
110 |
|
|
|
111 |
$label = '' if ( !$label || $label =~ m~^n/?a$~i || $label =~ m~^none$~i);
|
|
|
112 |
$path = '' if ( !$path || $path =~ m~^n/?a$~i || $path =~ m~^none$~i || $path =~ m~^not applicable$~i);
|
|
|
113 |
|
|
|
114 |
|
|
|
115 |
unless ( $path =~ m~^/\w~ )
|
|
|
116 |
{
|
|
|
117 |
printf ("WARNING: Bad path: %-40s : %s\n", $alias, $path );
|
|
|
118 |
}
|
|
|
119 |
|
|
|
120 |
$packages{$alias}{'name'} = $name;
|
|
|
121 |
$packages{$alias}{'ext'} = $ext;
|
|
|
122 |
$packages{$alias}{'version'} = $version;
|
|
|
123 |
$packages{$alias}{'plannel'} = $planned if $planned;
|
|
|
124 |
$packages{$alias}{'label'} = $label;
|
|
|
125 |
$packages{$alias}{'path'} = $path;
|
|
|
126 |
|
|
|
127 |
my @clean_depends;
|
|
|
128 |
foreach ( @depends )
|
|
|
129 |
{
|
|
|
130 |
s~\${~~;
|
|
|
131 |
s~}~~;
|
|
|
132 |
push @clean_depends, $_;
|
|
|
133 |
push @{$needed_by{$_}}, $alias;
|
|
|
134 |
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
$packages{$alias}{'depends'} = \@clean_depends;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
#-------------------------------------------------------------------------------
|
|
|
141 |
# Function : AddToPackages
|
|
|
142 |
#
|
|
|
143 |
# Description : Add packages to the list of required packages
|
|
|
144 |
#
|
|
|
145 |
# Inputs :
|
|
|
146 |
#
|
|
|
147 |
# Returns :
|
|
|
148 |
#
|
|
|
149 |
sub AddToPackages
|
|
|
150 |
{
|
|
|
151 |
foreach my $pkg ( @_ )
|
|
|
152 |
{
|
|
|
153 |
next if ( exists $required_packages{$pkg} );
|
|
|
154 |
|
|
|
155 |
if ( exists $packages{$pkg} )
|
|
|
156 |
{
|
|
|
157 |
AddToPackages( @{$packages{$pkg}{'depends'}})
|
|
|
158 |
}
|
|
|
159 |
else
|
|
|
160 |
{
|
|
|
161 |
print "ERROR: Package not found: $pkg\n";
|
|
|
162 |
}
|
|
|
163 |
|
|
|
164 |
$required_packages{$pkg} = 1;
|
|
|
165 |
|
|
|
166 |
}
|
|
|
167 |
}
|
|
|
168 |
|
|
|
169 |
#-------------------------------------------------------------------------------
|
|
|
170 |
# Function : DebugDumpData
|
|
|
171 |
#
|
|
|
172 |
# Description : Display data structures
|
|
|
173 |
#
|
|
|
174 |
# Inputs :
|
|
|
175 |
#
|
|
|
176 |
# Returns :
|
|
|
177 |
#
|
|
|
178 |
sub DebugDumpData
|
|
|
179 |
{
|
|
|
180 |
my ($name, @refp) = @_;
|
|
|
181 |
|
|
|
182 |
my $ii = 0;
|
|
|
183 |
foreach ( @refp )
|
|
|
184 |
{
|
|
|
185 |
print Data::Dumper->Dump ( [$_], ["[Arg:$ii] $name" ]);
|
|
|
186 |
$ii++
|
|
|
187 |
}
|
|
|
188 |
}
|
|
|
189 |
|
|
|
190 |
|
|
|
191 |
|