gen_openpower_fru: Allow multiple instances
Add support for allowing multiple instances of the same MRW type.
Before, since the type was deleted out of %targetHash, it wouldn't
save it in the output again.
Now it will only skip adding the results to the @targetTypes and
@paths arrays if the type is empty, or it is not in %targetHash
and also not already in @targetTypes.
Tested: Will now see multiple instances:
FRUS=PANEL,BMC,VRM,VRM,ETHERNET
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ifca9a492fea1341a6d75ab0955badf8e85604bf6
diff --git a/gen_openpower_fru.pl b/gen_openpower_fru.pl
index 3eefc3e..85f5b9e 100755
--- a/gen_openpower_fru.pl
+++ b/gen_openpower_fru.pl
@@ -55,7 +55,11 @@
if (!$targets->isBadAttribute($item->{TARGET}, "TYPE")) {
$targetType = $targets->getAttribute($item->{TARGET}, "TYPE");
}
- next if (not exists $targetHash{$targetType});
+
+ my @types = grep(/$targetType$/, @targetTypes);
+
+ next if (length($targetType) == 0 ||
+ ((not exists $targetHash{$targetType}) && (scalar @types == 0)));
push @targetTypes, $targetType;
push @paths, $item->{OBMC_NAME};