mirror of
git://projects.qi-hardware.com/wernermisc.git
synced 2024-11-15 12:55:20 +02:00
m1r4/dsv/bomshelf: support adding components to the BOM
Also removed a comment that is now in Makefile.
This commit is contained in:
parent
19e2f84c75
commit
dd3c0c205b
@ -1,10 +1,4 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
#
|
|
||||||
# Source:
|
|
||||||
# http://downloads.qi-hardware.com/hardware/milkymist_one/bom/rc3/milkymist_one_bom_rc3.ods
|
|
||||||
# - save as CVS
|
|
||||||
# - edit to remove embedded newlines
|
|
||||||
#
|
|
||||||
|
|
||||||
sub csv
|
sub csv
|
||||||
{
|
{
|
||||||
@ -50,19 +44,34 @@ while (<F>) {
|
|||||||
next if /^\s*#/;
|
next if /^\s*#/;
|
||||||
next if /^\s*$/;
|
next if /^\s*$/;
|
||||||
if (/^[Cc]:\s*/) {
|
if (/^[Cc]:\s*/) {
|
||||||
|
undef $p if $clear;
|
||||||
|
$clear = 0;
|
||||||
|
if (defined $p) {
|
||||||
|
$cr{$p} = $';
|
||||||
|
for $c (&csv($')) {
|
||||||
|
warn "\"$c\" (supplement) used for $r{$c} ".
|
||||||
|
"and $p" if defined $r{$c};
|
||||||
|
$r{$c} = $p;
|
||||||
|
}
|
||||||
|
next;
|
||||||
|
}
|
||||||
die "unknown component reference $'" unless defined $r{$'};
|
die "unknown component reference $'" unless defined $r{$'};
|
||||||
$p = $r{$'};
|
$p = $r{$'};
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^[Pp]:\s*/) {
|
if (/^[Pp]:\s*/) {
|
||||||
$p = $';
|
$p = $';
|
||||||
|
$clear = 0;
|
||||||
next if defined $cr{$p};
|
next if defined $cr{$p};
|
||||||
@a = grep { $_ =~ /^$p/ } keys %cr;
|
@a = grep { $_ =~ /^$p/ } keys %cr;
|
||||||
die "key $p* is ambiguous" if scalar @a > 1;
|
die "key $p* is ambiguous" if scalar @a > 1;
|
||||||
if (!@a) {
|
if (!@a) {
|
||||||
@a = grep { $_ =~ /$p/ } keys %cr;
|
@a = grep { $_ =~ /$p/ } keys %cr;
|
||||||
die "key *$p* is ambiguous" if scalar @a > 1;
|
die "key *$p* is ambiguous" if scalar @a > 1;
|
||||||
die "key $p matches nothing" unless @a;
|
if (!@a) {
|
||||||
|
warn "adding $p as supplement";
|
||||||
|
next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$p = $a[0];
|
$p = $a[0];
|
||||||
next;
|
next;
|
||||||
@ -70,10 +79,12 @@ while (<F>) {
|
|||||||
if (/^[Aa]:\s*/) {
|
if (/^[Aa]:\s*/) {
|
||||||
$a{$p} .= "," if defined $a{$p};
|
$a{$p} .= "," if defined $a{$p};
|
||||||
$a{$p} .= $';
|
$a{$p} .= $';
|
||||||
|
$clear = 1;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
if (/^[Dd]:\s*/) {
|
if (/^[Dd]:\s*/) {
|
||||||
$url{$p} = $';
|
$url{$p} = $';
|
||||||
|
$clear = 1;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
die "don't recognize \"$_\"";
|
die "don't recognize \"$_\"";
|
||||||
|
Loading…
Reference in New Issue
Block a user