| 227 |
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 : Package Entry
|
|
|
11 |
#
|
|
|
12 |
# New Create a new package entry instance.
|
|
|
13 |
#
|
|
|
14 |
# RuleInc Check whether the specific 'include' path should
|
|
|
15 |
# be included within the PINCDIRS list.
|
|
|
16 |
#
|
|
|
17 |
# RuleLib Check whether the specific 'lib' path should
|
|
|
18 |
# be included within the PLIBDIRS list.
|
|
|
19 |
#
|
|
|
20 |
# Cleanup Performs any record cleanup required prior to the
|
|
|
21 |
# entry being published.
|
|
|
22 |
#
|
|
|
23 |
# Usage:
|
|
|
24 |
#
|
|
|
25 |
# Version Who Date Description
|
|
|
26 |
#
|
|
|
27 |
#......................................................................#
|
|
|
28 |
|
| 255 |
dpurdie |
29 |
require 5.006_001;
|
| 227 |
dpurdie |
30 |
use strict;
|
|
|
31 |
use warnings;
|
|
|
32 |
|
|
|
33 |
use DescPkg;
|
|
|
34 |
use JatsError;
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
our $BUILDNAME_PACKAGE;
|
|
|
38 |
our $BUILDNAME_VERSION;
|
|
|
39 |
our $BUILDNAME_PROJECT;
|
|
|
40 |
our $BUILDINTERFACE;
|
|
|
41 |
our @BUILDTOOLS;
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
package PackageEntry;
|
|
|
45 |
|
|
|
46 |
our %DescPkgCache = (); # Hash of known packages
|
|
|
47 |
our %PackageDefined = (); # Quick defined package test
|
|
|
48 |
our @PackageList = (); # Ordered array of packages
|
|
|
49 |
|
| 311 |
dpurdie |
50 |
|
|
|
51 |
#-------------------------------------------------------------------------------
|
|
|
52 |
# Function : EmptyEntry
|
|
|
53 |
#
|
|
|
54 |
# Description : Create an empty class element
|
|
|
55 |
# Populated with the basic items
|
|
|
56 |
#
|
|
|
57 |
# Inputs : None
|
|
|
58 |
#
|
|
|
59 |
# Returns : New, empty entry
|
|
|
60 |
#
|
|
|
61 |
sub EmptyEntry
|
| 227 |
dpurdie |
62 |
{
|
|
|
63 |
my ($self) = {
|
|
|
64 |
PINCDIRS => [],
|
|
|
65 |
PLIBDIRS => [],
|
|
|
66 |
LIBEXAMINED => {},
|
|
|
67 |
INCEXAMINED => {},
|
|
|
68 |
TOOLDIRS => [],
|
|
|
69 |
THXDIRS => [],
|
|
|
70 |
};
|
| 311 |
dpurdie |
71 |
return bless $self, __PACKAGE__;
|
|
|
72 |
}
|
| 227 |
dpurdie |
73 |
|
| 311 |
dpurdie |
74 |
sub New
|
|
|
75 |
{
|
| 331 |
dpurdie |
76 |
my ($base, $name, $version, $sandbox, $type, $local) = @_;
|
| 311 |
dpurdie |
77 |
my $self = EmptyEntry();
|
|
|
78 |
|
|
|
79 |
# Load package description ...
|
|
|
80 |
#
|
|
|
81 |
# If a sandbox link, parse the build.pl and retrieve the BuildName()
|
|
|
82 |
# otherwise, load the description from the 'descpkg'.
|
|
|
83 |
#
|
|
|
84 |
# Note: The results are cached within DescPkgCache
|
|
|
85 |
#..
|
| 227 |
dpurdie |
86 |
if ( ! exists( $DescPkgCache{$base} ) )
|
|
|
87 |
{
|
|
|
88 |
my ($rec);
|
|
|
89 |
my ($desc) = "";
|
|
|
90 |
|
|
|
91 |
if ( $sandbox )
|
|
|
92 |
{
|
|
|
93 |
open (BUILDPL, "$base/build.pl") ||
|
|
|
94 |
::Error( "cannot open '$base/build.pl'" );
|
|
|
95 |
while (<BUILDPL>) {
|
|
|
96 |
if ( $_ =~ /^\s*BuildName\s*\(\s*[\"\'](.*)[\'\"]\s*\)/ ) {
|
|
|
97 |
$desc = $1; # BuildName() argument
|
|
|
98 |
($rec->{NAME}, $rec->{VERSION}, $rec->{PROJ}) = split( ' ', $desc );
|
|
|
99 |
last;
|
|
|
100 |
}
|
|
|
101 |
}
|
|
|
102 |
close (BUILDPL);
|
|
|
103 |
}
|
|
|
104 |
elsif ( -f "$base/descpkg" )
|
|
|
105 |
{
|
|
|
106 |
$rec = ::ReadDescpkg( "$base/descpkg", 1 );
|
|
|
107 |
}
|
|
|
108 |
else
|
|
|
109 |
{ # doesn't exist
|
|
|
110 |
::Error( "Package description does not exist",
|
|
|
111 |
"Package Location: $base" )
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
::Error("Cannot determine package description",
|
|
|
115 |
"Package Location: $base" )
|
|
|
116 |
unless ( $rec );
|
|
|
117 |
|
|
|
118 |
::Warning( "Package names do not match: $rec->{NAME}, $name" )
|
|
|
119 |
if ( $rec->{NAME} ne $name );
|
|
|
120 |
|
| 331 |
dpurdie |
121 |
if ( $local || substr($version,0,8) eq '!current' ||
|
| 227 |
dpurdie |
122 |
substr($version,0,8) eq '!sandbox' )
|
|
|
123 |
{ # display results
|
| 331 |
dpurdie |
124 |
my $logPrefix = " ->";
|
|
|
125 |
if ( $local ) {
|
|
|
126 |
::Log( "$logPrefix $base" );
|
|
|
127 |
} elsif ($rec->{NAME} eq "") {
|
|
|
128 |
::Log( "$logPrefix n/a" );
|
| 227 |
dpurdie |
129 |
} else {
|
| 331 |
dpurdie |
130 |
::Log( "$logPrefix $rec->{NAME} $rec->{VERSION} $rec->{PROJ}" );
|
| 227 |
dpurdie |
131 |
}
|
|
|
132 |
}
|
|
|
133 |
elsif ( $rec->{VERSION_FULL} ne $version )
|
|
|
134 |
{
|
|
|
135 |
::Warning( "Package versions do not match: $name : $rec->{VERSION_FULL}, $version" );
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
#
|
|
|
139 |
# Extend the package information to contain suffiecient data
|
|
|
140 |
# for general use. Information will be retained to allow the
|
|
|
141 |
# user to extact specific package information
|
|
|
142 |
#
|
|
|
143 |
$version =~ m~(\d+\.\d+\.\d+)\.(\w+)~ ;
|
|
|
144 |
my $vnum = $1 || $version;
|
|
|
145 |
my $proj = $2 || '';
|
|
|
146 |
|
|
|
147 |
$rec->{UNAME} = $name;
|
|
|
148 |
$rec->{UVERSION} = $version;
|
|
|
149 |
$rec->{UVNUM} = $vnum;
|
|
|
150 |
$rec->{UPROJ} = $proj;
|
|
|
151 |
$rec->{type} = $type;
|
|
|
152 |
|
|
|
153 |
$PackageDefined{$name}{$proj}{$vnum} = $base;
|
|
|
154 |
push @PackageList, $base;
|
|
|
155 |
|
|
|
156 |
$DescPkgCache{$base} = $rec; # cache result
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
# Build the package entry record
|
|
|
160 |
#..
|
|
|
161 |
my ($descpkg) = $DescPkgCache{$base}; # descpkg details
|
|
|
162 |
|
|
|
163 |
$self->{'base'} = $base;
|
|
|
164 |
$self->{'base'} .= "/local"
|
|
|
165 |
if ( $sandbox );
|
|
|
166 |
|
|
|
167 |
$self->{'name'} = $name;
|
|
|
168 |
$self->{'version'} = $version;
|
|
|
169 |
$self->{'sandbox'} = $sandbox;
|
|
|
170 |
$self->{'dname'} = $descpkg->{NAME};
|
|
|
171 |
$self->{'dversion'} = $descpkg->{VERSION};
|
|
|
172 |
$self->{'dproj'} = $descpkg->{PROJ} || $descpkg->{UPROJ} || '';
|
|
|
173 |
$self->{'packages'} = $descpkg->{PACKAGES};
|
|
|
174 |
$self->{'type'} = $type;
|
|
|
175 |
$self->{'cfgdir'} = "/gbe"
|
|
|
176 |
if ( $sandbox || -d $base."/gbe" );
|
|
|
177 |
|
| 311 |
dpurdie |
178 |
return $self;
|
| 227 |
dpurdie |
179 |
}
|
|
|
180 |
|
| 311 |
dpurdie |
181 |
#-------------------------------------------------------------------------------
|
|
|
182 |
# Function : Interface
|
|
|
183 |
#
|
|
|
184 |
# Description : Create a specialised 'interface' entry
|
|
|
185 |
#
|
|
|
186 |
# Inputs : $base - Path to the Interface directory
|
|
|
187 |
#
|
|
|
188 |
# Returns : Ref to this class
|
|
|
189 |
#
|
|
|
190 |
sub Interface
|
|
|
191 |
{
|
|
|
192 |
my ($base) = @_;
|
|
|
193 |
my $self = EmptyEntry();
|
|
|
194 |
|
|
|
195 |
$self->{'base'} = $base;
|
|
|
196 |
$self->{'name'} = 'INTERFACE';
|
|
|
197 |
$self->{'version'} = '0.0.0';
|
|
|
198 |
$self->{'sandbox'} = 0;
|
|
|
199 |
$self->{'dname'} = $self->{'name'};
|
|
|
200 |
$self->{'dversion'} = $self->{'version'};
|
|
|
201 |
$self->{'dproj'} = '';
|
|
|
202 |
$self->{'packages'} = '';
|
|
|
203 |
$self->{'type'} = 'interface';
|
|
|
204 |
$self->{'cfgdir'} = '/gbe';
|
|
|
205 |
|
|
|
206 |
return $self;
|
|
|
207 |
|
|
|
208 |
}
|
|
|
209 |
|
| 227 |
dpurdie |
210 |
sub RuleInc
|
|
|
211 |
{
|
|
|
212 |
my( $self ) = shift;
|
|
|
213 |
my( $path ) = @_;
|
|
|
214 |
my( $examined ) = $self->{INCEXAMINED};
|
|
|
215 |
my( $list ) = $self->{PINCDIRS};
|
|
|
216 |
|
|
|
217 |
return if ( $$examined{$path} );
|
|
|
218 |
$$examined{$path} = 1;
|
|
|
219 |
|
|
|
220 |
push @$list, $path if ( $self->{'sandbox'} || -d $self->{'base'}.$path );
|
|
|
221 |
}
|
|
|
222 |
|
|
|
223 |
#
|
|
|
224 |
# Examine Path to ensure that it is a directory and that it contains files
|
|
|
225 |
# Simplify Lib Path searching by removing useless paths.
|
|
|
226 |
#
|
|
|
227 |
# If there are ANY files then the directory is useful
|
|
|
228 |
# If there are no files ( only subdirectories ) then the directory is not useful
|
|
|
229 |
#
|
|
|
230 |
sub isUsefulDir
|
|
|
231 |
{
|
|
|
232 |
my ($path) = @_;
|
|
|
233 |
|
|
|
234 |
if ( -d $path )
|
|
|
235 |
{
|
|
|
236 |
opendir (USEFUL, $path) or ::Error ("Cannot open $path");
|
|
|
237 |
my @dirlist = readdir USEFUL;
|
| 285 |
dpurdie |
238 |
closedir USEFUL;
|
| 227 |
dpurdie |
239 |
|
|
|
240 |
foreach ( @dirlist )
|
|
|
241 |
{
|
|
|
242 |
return 1 if ( -f "$path/$_" );
|
|
|
243 |
}
|
|
|
244 |
}
|
|
|
245 |
return 0;
|
|
|
246 |
}
|
|
|
247 |
|
|
|
248 |
sub RuleLib
|
|
|
249 |
{
|
|
|
250 |
my( $self ) = shift;
|
|
|
251 |
my( $path ) = @_;
|
|
|
252 |
my( $examined ) = $self->{LIBEXAMINED};
|
|
|
253 |
my( $list ) = $self->{PLIBDIRS};
|
|
|
254 |
|
|
|
255 |
return if ( $$examined{$path} );
|
|
|
256 |
$$examined{$path} = 1;
|
|
|
257 |
|
|
|
258 |
push @$list, $path."D" if ( $self->{'sandbox'} || isUsefulDir($self->{'base'}.$path."D") );
|
|
|
259 |
push @$list, $path."P" if ( $self->{'sandbox'} || isUsefulDir($self->{'base'}.$path."P") );
|
|
|
260 |
push @$list, $path if ( $self->{'sandbox'} || isUsefulDir($self->{'base'}.$path) );
|
|
|
261 |
}
|
|
|
262 |
|
|
|
263 |
#-------------------------------------------------------------------------------
|
|
|
264 |
# Function : ExamineToolPath
|
|
|
265 |
#
|
|
|
266 |
# Description : Given the root of a package, locate any
|
|
|
267 |
# toolset extension paths within the tree. These will be
|
|
|
268 |
# saved and later used when user tools and scripts are
|
|
|
269 |
# invoked.
|
|
|
270 |
#
|
|
|
271 |
# Examine:
|
|
|
272 |
# - tools/bin/GBE_MACHTYPE - Hardware specfic tools
|
|
|
273 |
# - tools/bin - Hardware independent tools - scripts
|
|
|
274 |
# - tools/scripts/GBE_MACHINE - Hardware specific scripts
|
|
|
275 |
# - tools/scripts - Hardware independent scripts (too)
|
|
|
276 |
#
|
|
|
277 |
# Inputs : self
|
|
|
278 |
#
|
|
|
279 |
# Returns : Nothing
|
|
|
280 |
#
|
|
|
281 |
sub ExamineToolPath
|
|
|
282 |
{
|
|
|
283 |
my( $self ) = shift;
|
|
|
284 |
|
|
|
285 |
#
|
|
|
286 |
# Determine base dir
|
|
|
287 |
# LinkPkgArchive : From the package
|
|
|
288 |
# BuildPkgArchive : From the interface directory
|
|
|
289 |
#
|
|
|
290 |
my $base_dir = $self->{'base'};
|
|
|
291 |
$base_dir = "$::Cwd/$BUILDINTERFACE"
|
|
|
292 |
if ( $self->{'type'} eq 'build' );
|
|
|
293 |
|
|
|
294 |
for my $path ("/tools/bin", "/tools/scripts" )
|
|
|
295 |
{
|
|
|
296 |
foreach my $suffix ( "/$::GBE_MACHTYPE", "" )
|
|
|
297 |
{
|
|
|
298 |
my $dir = $base_dir . $path . $suffix;
|
|
|
299 |
if ( isUsefulDir( $dir ) )
|
|
|
300 |
{
|
|
|
301 |
::UniquePush( \@{$self->{'TOOLDIRS'}}, $dir );
|
|
|
302 |
::UniquePush( \@BUILDTOOLS, $dir );
|
|
|
303 |
}
|
|
|
304 |
}
|
|
|
305 |
}
|
|
|
306 |
}
|
|
|
307 |
|
|
|
308 |
#-------------------------------------------------------------------------------
|
|
|
309 |
# Function : ExamineThxPath
|
|
|
310 |
#
|
|
|
311 |
# Description : Given the root of a package, locate some well known
|
|
|
312 |
# packaging directories for later use.
|
|
|
313 |
#
|
|
|
314 |
# Examine:
|
|
|
315 |
# /thx/$platform
|
|
|
316 |
# /thx
|
|
|
317 |
#
|
|
|
318 |
# Inputs : self
|
|
|
319 |
# platform - Current build platform
|
|
|
320 |
#
|
|
|
321 |
# Returns : nothing
|
|
|
322 |
#
|
|
|
323 |
sub ExamineThxPath
|
|
|
324 |
{
|
|
|
325 |
my( $self, $platform ) = @_;
|
|
|
326 |
|
|
|
327 |
my $dir = $self->{'base'} . '/thx';
|
|
|
328 |
if ( -d $dir )
|
|
|
329 |
{
|
|
|
330 |
push @{$self->{'THXDIRS'}}, "/thx/$platform" if isUsefulDir( "$dir/$platform" );
|
|
|
331 |
push @{$self->{'THXDIRS'}}, "/thx" if isUsefulDir( $dir );
|
|
|
332 |
}
|
|
|
333 |
}
|
|
|
334 |
|
|
|
335 |
sub Cleanup
|
|
|
336 |
{
|
|
|
337 |
my ($self) = shift;
|
|
|
338 |
|
|
|
339 |
delete $self->{LIBEXAMINED};
|
|
|
340 |
delete $self->{INCEXAMINED};
|
|
|
341 |
}
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
#-------------------------------------------------------------------------------
|
|
|
345 |
# Function : GetBaseDir
|
|
|
346 |
#
|
|
|
347 |
# Description : Return the base directory of a given package
|
|
|
348 |
# Simple getter function
|
|
|
349 |
#
|
|
|
350 |
# Inputs : self
|
|
|
351 |
# path - Optional path within package
|
|
|
352 |
#
|
|
|
353 |
# Returns : The base directory of the package
|
|
|
354 |
#
|
|
|
355 |
sub GetBaseDir
|
|
|
356 |
{
|
|
|
357 |
my ($self, $path) = @_;
|
|
|
358 |
my $dir = $self->{'base'};
|
|
|
359 |
$dir .= '/' . $path if ( $path );
|
|
|
360 |
return $dir;
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
|
|
|
364 |
#-------------------------------------------------------------------------------
|
|
|
365 |
# Function : SanityTest
|
|
|
366 |
#
|
|
|
367 |
# Description : Examine all the packages used in the current build.pl
|
|
|
368 |
# and all the packages used to build them. Then generate
|
|
|
369 |
# warning if there are mismatches.
|
|
|
370 |
#
|
|
|
371 |
# All the data has been collected and stored within
|
|
|
372 |
# $DescPkgCache. This routine processes the data and
|
|
|
373 |
# constructs a data structure to locate packages with
|
|
|
374 |
# multiple versions.
|
|
|
375 |
#
|
|
|
376 |
# The project name is considered to be a part of the package
|
|
|
377 |
# name. Thus aaaa_11.22.33.mass is different to aaaa_11.22.33.syd
|
|
|
378 |
#
|
|
|
379 |
# Inputs :
|
|
|
380 |
#
|
|
|
381 |
# Returns :
|
|
|
382 |
#
|
|
|
383 |
my %package_list;
|
|
|
384 |
|
|
|
385 |
sub AddEntry
|
|
|
386 |
{
|
|
|
387 |
my( $root, $rver, $rproj, $name, $version ) = @_;
|
|
|
388 |
my $ver;
|
|
|
389 |
my $proj;
|
|
|
390 |
|
|
|
391 |
if ($version eq "!current") {
|
|
|
392 |
$ver = "current";
|
|
|
393 |
$proj = "";
|
|
|
394 |
} else {
|
|
|
395 |
$version =~ m~(.*)\.(.*?)$~;
|
|
|
396 |
$ver = $1 || 'BadVer';
|
|
|
397 |
$proj = $2 || 'BadProj';
|
|
|
398 |
}
|
|
|
399 |
|
|
|
400 |
::UniquePush( \@{$package_list{"$name$;$proj"}{$ver}}, "${root}_${rver}.${rproj}");
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
sub SanityTest
|
|
|
404 |
{
|
|
|
405 |
foreach my $package ( keys %DescPkgCache )
|
|
|
406 |
{
|
|
|
407 |
my $pptr = $DescPkgCache{$package};
|
|
|
408 |
my $lver = $pptr->{'VERSION'};
|
|
|
409 |
$lver .= '.' . $pptr->{'PROJ'} if ( $pptr->{'PROJ'} );
|
|
|
410 |
AddEntry( $BUILDNAME_PACKAGE, $BUILDNAME_VERSION, $BUILDNAME_PROJECT, $pptr->{'NAME'}, $lver );
|
|
|
411 |
|
|
|
412 |
|
|
|
413 |
foreach my $subpkg ( @{$pptr->{'PACKAGES'}} )
|
|
|
414 |
{
|
|
|
415 |
my $name = $subpkg->{name};
|
|
|
416 |
my $ver = $subpkg->{version};
|
|
|
417 |
|
|
|
418 |
AddEntry( $pptr->{'NAME'}, $pptr->{'VERSION'}, $pptr->{'PROJ'}, $name, $ver );
|
|
|
419 |
}
|
|
|
420 |
}
|
|
|
421 |
|
|
|
422 |
#::DebugDumpData("XXX", \%package_list );
|
|
|
423 |
|
|
|
424 |
#
|
|
|
425 |
# Detect and print warnings about multiple entries
|
|
|
426 |
#
|
|
|
427 |
my $first_found = 0;
|
|
|
428 |
foreach my $pentry ( sort keys %package_list)
|
|
|
429 |
{
|
|
|
430 |
my @versions = keys %{$package_list{$pentry}};
|
|
|
431 |
|
|
|
432 |
if ( $#versions > 0 )
|
|
|
433 |
{
|
|
|
434 |
::Warning("Package mismatchs detected.") unless ( $first_found++ );
|
|
|
435 |
|
|
|
436 |
my ($pname, $pproj) = split $;, $pentry ;
|
|
|
437 |
foreach my $version ( @versions )
|
|
|
438 |
{
|
|
|
439 |
::Warning("Package ${pname}_${version}.${pproj} used by:", @{$package_list{$pentry}{$version}});
|
|
|
440 |
}
|
|
|
441 |
}
|
|
|
442 |
|
|
|
443 |
}
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
#-------------------------------------------------------------------------------
|
|
|
447 |
# Function : Exists
|
|
|
448 |
#
|
|
|
449 |
# Description : A class function to determine if a given package is known
|
|
|
450 |
# to the PackageEntry manager. Used to detect multiple package
|
|
|
451 |
# definitions.
|
|
|
452 |
#
|
|
|
453 |
# The test ignores package versions
|
|
|
454 |
# It is not possible to include different versions of the
|
|
|
455 |
# same package. The test ignores the project part of the
|
|
|
456 |
# version. This allows for
|
|
|
457 |
# sysbasetypes aa.bb.cc.mas and
|
|
|
458 |
# sysbasetypes xx.yy.zz.syd
|
|
|
459 |
#
|
|
|
460 |
# Inputs : $name - User package name
|
|
|
461 |
# $version - User version ( with project )
|
|
|
462 |
#
|
|
|
463 |
# Returns : True: Package exists
|
|
|
464 |
#
|
|
|
465 |
|
|
|
466 |
sub Exists
|
|
|
467 |
{
|
|
|
468 |
my ($name, $version) = @_;
|
|
|
469 |
|
|
|
470 |
$version =~ m~(\d+\.\d+\.\d+)\.(\w+)~ ;
|
|
|
471 |
my $vnum = $1 || $version;
|
|
|
472 |
my $proj = $2 || '';
|
|
|
473 |
|
|
|
474 |
return exists( $PackageDefined{$name}{$proj} );
|
|
|
475 |
}
|
|
|
476 |
|
|
|
477 |
#-------------------------------------------------------------------------------
|
|
|
478 |
# Function : GetPackageList
|
|
|
479 |
#
|
|
|
480 |
# Description : A class function to return a list of packages
|
|
|
481 |
# The list cannot be used directory. It is really a set of
|
|
|
482 |
# keys to an internal data structure.
|
|
|
483 |
#
|
|
|
484 |
# The result can be used to iterate over the list of packages
|
|
|
485 |
# using other functions.
|
|
|
486 |
#
|
|
|
487 |
# Inputs : None
|
|
|
488 |
#
|
|
|
489 |
# Returns : An array of package tags
|
|
|
490 |
# The array is ordered by package definition order
|
|
|
491 |
#
|
|
|
492 |
sub GetPackageList
|
|
|
493 |
{
|
|
|
494 |
return @PackageList;
|
|
|
495 |
}
|
|
|
496 |
|
|
|
497 |
#-------------------------------------------------------------------------------
|
|
|
498 |
# Function : GetPackageData
|
|
|
499 |
#
|
|
|
500 |
# Description : A class function to return specific data for a given package
|
|
|
501 |
#
|
|
|
502 |
# Inputs : $tag - An iteration tag provided by GetPackageList()
|
|
|
503 |
#
|
|
|
504 |
# Returns : A list of
|
|
|
505 |
# Package name
|
|
|
506 |
# Package version
|
|
|
507 |
# Package type : build or link
|
|
|
508 |
#
|
|
|
509 |
sub GetPackageData
|
|
|
510 |
{
|
|
|
511 |
my ($tag) = @_;
|
|
|
512 |
my $rec = $DescPkgCache{$tag};
|
|
|
513 |
return $rec->{UNAME}, $rec->{UVERSION}, $rec->{type};
|
|
|
514 |
}
|
|
|
515 |
|
|
|
516 |
#-------------------------------------------------------------------------------
|
|
|
517 |
# Function : GetPackageVersionList
|
|
|
518 |
#
|
|
|
519 |
# Description : A class function to return a list of package names as used
|
|
|
520 |
# to generate version strings
|
|
|
521 |
#
|
|
|
522 |
#
|
|
|
523 |
# Inputs : None
|
|
|
524 |
#
|
|
|
525 |
# Returns : An array of version list entries
|
|
|
526 |
# Each element of the form: "name (version)"
|
|
|
527 |
#
|
|
|
528 |
sub GetPackageVersionList
|
|
|
529 |
{
|
|
|
530 |
my @list;
|
|
|
531 |
foreach my $tag ( @PackageList )
|
|
|
532 |
{
|
|
|
533 |
my $rec = $DescPkgCache{$tag};
|
|
|
534 |
push @list, "$rec->{UNAME} ($rec->{UVERSION})";
|
|
|
535 |
}
|
|
|
536 |
|
|
|
537 |
return @list;
|
|
|
538 |
}
|
|
|
539 |
|
|
|
540 |
### End of package: PackageEntry
|
|
|
541 |
|
|
|
542 |
1;
|
|
|
543 |
|