Rev 327 | Rev 329 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 327 | Rev 328 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #!/usr/bin/perl -w
|
1 | #!/usr/bin/perl -w
|
2 | use strict; |
2 | use strict; |
3 | # $Id: inventory.pl 327 2008-12-29 17:53:35Z agaran $
|
3 | # $Id: inventory.pl 328 2008-12-29 18:07:00Z agaran $
|
4 | # Thu, 13 Nov 2008 21:06:23 +0100
|
4 | # Thu, 13 Nov 2008 21:06:23 +0100
|
5 | # Maciej 'agaran' Pijanka <agaran@pld-linux.org>
|
5 | # Maciej 'agaran' Pijanka <agaran@pld-linux.org>
|
6 | # for OpenARM SBC Project
|
6 | # for OpenARM SBC Project
|
7 | # license: gpl v3
|
7 | # license: gpl v3
|
8 | 8 | ||
Line 47... | Line 47... | ||
47 | # exit? or fail-exit here
|
47 | # exit? or fail-exit here
|
48 | }
|
48 | }
|
49 | 49 | ||
50 | sub wrn_printf($@) { |
50 | sub wrn_printf($@) { |
51 | my ($format, @args) = @_; |
51 | my ($format, @args) = @_; |
52 | - | ||
- | 52 | return if ($Config{verbose} <= 1) ; |
|
53 | printf STDERR "-W- ".$format."\n", @args; |
53 | printf STDERR "-W- ".$format."\n", @args; |
54 | }
|
54 | }
|
55 | 55 | ||
56 | sub inf_printf($@) { |
56 | sub inf_printf($@) { |
57 | my ($format, @args) = @_; |
57 | my ($format, @args) = @_; |
58 | - | ||
- | 58 | return if ($Config{verbose} <= 2) ; |
|
59 | printf STDERR "-I- ".$format."\n", @args; |
59 | printf STDERR "-I- ".$format."\n", @args; |
60 | }
|
60 | }
|
61 | 61 | ||
62 | sub Config_Show { |
62 | sub Config_Show { |
63 | printf "Config for %s\n----------------------------------------\n", basename($0); |
63 | printf "Config for %s\n----------------------------------------\n", basename($0); |
Line 215... | Line 215... | ||
215 | err_printf("Unhandled field %s in file %s", $name, |
215 | err_printf("Unhandled field %s in file %s", $name, |
216 | shortdir($filepath)); |
216 | shortdir($filepath)); |
217 | }
|
217 | }
|
218 | 218 | ||
219 | } else { |
219 | } else { |
220 | wrn_printf("Unparseable line `%s', forgot ; to set it as comment in file %s\n", $line, |
220 | wrn_printf("Unparseable line `%s', forgot ; to set it as comment in file %s", $line, |
221 | shortdir($filepath)); |
221 | shortdir($filepath)); |
222 | }
|
222 | }
|
223 | }
|
223 | }
|
224 | close(IN); |
224 | close(IN); |
225 | 225 | ||
Line 422... | Line 422... | ||
422 | Config_Show(); |
422 | Config_Show(); |
423 | exit; |
423 | exit; |
424 | }
|
424 | }
|
425 | 425 | ||
426 | # make Inventory
|
426 | # make Inventory
|
- | 427 | printf STDERR "Indexing information.txt (under %s)\n",shortdir($Config{docdir}); |
|
427 | file_lookup($Config{docdir}, 0, qr/\/information.txt$/, \&parse_ifile); |
428 | file_lookup($Config{docdir}, 0, qr/\/information.txt$/, \&parse_ifile); |
- | 429 | printf STDERR "\tFinished, %d entries loaded\n", scalar(@Inv)+1; |
|
428 | 430 | ||
429 | # process BOM files
|
431 | # process BOM files
|
- | 432 | printf STDERR "Loading bom data from %s\n", shortdir($Config{bomdir}); |
|
430 | file_lookup($Config{bomdir}, 0, qr/\.bom$/, \&parse_bom); |
433 | file_lookup($Config{bomdir}, 0, qr/\.bom$/, \&parse_bom); |
- | 434 | printf STDERR "\tLoaded, now processing\n"; |
|
431 | 435 | ||
432 | my $n = 1; |
436 | my $n = 1; |
433 | my $cost = 0.0; |
437 | my $cost = 0.0; |
434 | 438 | ||
435 | 439 | ||
Line 492... | Line 496... | ||
492 | 496 | ||
493 | printf $out "\nTotal cost: %.3f\n", $cost; |
497 | printf $out "\nTotal cost: %.3f\n", $cost; |
494 | 498 | ||
495 | close PARTMAP; |
499 | close PARTMAP; |
496 | 500 | ||
- | 501 | printf STDERR "\tFinished, output saved in %s\n", $Config{outdir}.'/output.txt'; |