Subversion Repositories OpenARM Single-board Computer

Rev

Rev 335 | Rev 419 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 335 Rev 337
Line 1... Line 1...
1
#!/usr/bin/perl -w
1
#!/usr/bin/perl -w
2
use strict;
2
use strict;
3
# $Id: inventory.pl 335 2008-12-29 22:03:42Z agaran $
3
# $Id: inventory.pl 337 2009-01-23 16:29:03Z 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 73... Line 73...
73
                        "\t--docdir|-d <dir> tells script where information.txt files should be searched\n".
73
                        "\t--docdir|-d <dir> tells script where information.txt files should be searched\n".
74
                        "\t--define <something>=<somethingelseornot> defines some configration value\n".
74
                        "\t--define <something>=<somethingelseornot> defines some configration value\n".
75
                        "\t--verbose|-v [level] sets verbosity level\nOrder of options DOES matter\n".
75
                        "\t--verbose|-v [level] sets verbosity level\nOrder of options DOES matter\n".
76
                        "\t--bomdir|-b <dir> tells script where boms should be searched\n".
76
                        "\t--bomdir|-b <dir> tells script where boms should be searched\n".
77
                        "\t--outfile|-o <file> tells where script shall save output data\n".
77
                        "\t--outfile|-o <file> tells where script shall save output data\n".
78
                        "\t--force|-f forces script to save data even if file exist already\n";
78
                        "\t--force|-f forces script to save data even if file exist already\n".
-
 
79
                        "\t-l <num> repeat title for output tables every <num> rows\n";
79
80
80
                print "\t\e[0;31mThis Help Is created especially for \e[0;33mJelle\e[0;29m\n".
81
                print "\t\e[0;31mThis Help Is created especially for \e[0;33mJelle\e[0;29m\n".
81
                        "\tThis script search all directories below specified ones to find interesting files\n";
82
                        "\tThis script search all directories below specified ones to find interesting files\n";
82
                return;
83
                return;
83
        }
84
        }
Line 432... Line 433...
432
        "define|D=s" => sub { my ($p,$q) = split(/=/,$_[1],2); $Config{$p} = $q; },
433
        "define|D=s" => sub { my ($p,$q) = split(/=/,$_[1],2); $Config{$p} = $q; },
433
        "verbose|v:+" => sub { $Config{$_[0]} = ($_[1]>1?0:$Config{$_[0]}) + $_[1]; },
434
        "verbose|v:+" => sub { $Config{$_[0]} = ($_[1]>1?0:$Config{$_[0]}) + $_[1]; },
434
        "help|h|?:s" => sub { $show_help = 1; },
435
        "help|h|?:s" => sub { $show_help = 1; },
435
        "outfile|o=s" => sub { $Config{$_[0]} = $_[1]; },
436
        "outfile|o=s" => sub { $Config{$_[0]} = $_[1]; },
436
        "force|f" => sub { $Config{$_[0]} = 1 },
437
        "force|f" => sub { $Config{$_[0]} = 1 },
-
 
438
        "lines|l=i" => sub { $Config{$_[0]} = abs(int($_[1]));},
437
439
438
        # options 
440
        # options 
439
);
441
);
440
if (!$result) {
442
if (!$result) {
441
        printf "Usage: %s [-d directory] [-v]\n",basename($0);
443
        printf "Usage: %s [-d directory] [-v]\n",basename($0);
Line 555... Line 557...
555
printf $out "file generated at %s\n\n", scalar localtime(time());
557
printf $out "file generated at %s\n\n", scalar localtime(time());
556
558
557
print $out $bomtable->rule('-','+');
559
print $out $bomtable->rule('-','+');
558
print $out $bomtable->title();
560
print $out $bomtable->title();
559
print $out $bomtable->rule('-','+');
561
print $out $bomtable->rule('-','+');
-
 
562
unless (defined $Config{'lines'}) {
560
print $out $bomtable->body();
563
        print $out $bomtable->body();
-
 
564
} else {
-
 
565
        my @p = split(/\n/,$bomtable->body());
-
 
566
        while (@p) {
-
 
567
                my @sub = splice @p,0,$Config{'lines'};
-
 
568
                print $out join("\n",@sub)."\n";
-
 
569
                if (scalar @p > 0) {
-
 
570
                        print $out $bomtable->rule('-','+');
-
 
571
                        print $out $bomtable->title();
-
 
572
                        print $out $bomtable->rule('-','+');
-
 
573
                }
-
 
574
        }
-
 
575
}
561
print $out $bomtable->rule('-','+');
576
print $out $bomtable->rule('-','+');
562
577
563
printf $out "\nTotal cost: %.3f\n\n\n", $cost;
578
printf $out "\nTotal cost: %.3f\n\n\n", $cost;
564
579
565
580
Line 581... Line 596...
581
}
596
}
582
597
583
print $out $parttable->rule('-','+');
598
print $out $parttable->rule('-','+');
584
print $out $parttable->title();
599
print $out $parttable->title();
585
print $out $parttable->rule('-','+');
600
print $out $parttable->rule('-','+');
-
 
601
unless (defined $Config{'lines'}) {
586
print $out $parttable->body();
602
        print $out $parttable->body();
-
 
603
} else {
-
 
604
        my @p = split(/\n/,$parttable->body());
-
 
605
        while (@p) {
-
 
606
                my @sub = splice @p,0,$Config{'lines'};
-
 
607
                print $out join("\n",@sub)."\n";
-
 
608
                if (scalar @p > 0) {
-
 
609
                        print $out $parttable->rule('-','+');
-
 
610
                        print $out $parttable->title();
-
 
611
                        print $out $parttable->rule('-','+');
-
 
612
                }
-
 
613
        }
-
 
614
}
587
print $out $parttable->rule('-','+');
615
print $out $parttable->rule('-','+');
588
616
589
617
590
#close PARTMAP;
618
#close PARTMAP;
591
619