[6] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
[18] | 3 | # Project Builder configuration file handler
|
---|
[6] | 4 | # For project pb ;-)
|
---|
| 5 | #
|
---|
| 6 | # $Id$
|
---|
| 7 | #
|
---|
| 8 | use strict;
|
---|
[17] | 9 | use AppConfig qw(ARGCOUNT_HASH);
|
---|
[19] | 10 | use Data::Dumper;
|
---|
[6] | 11 |
|
---|
| 12 | sub pb_init {
|
---|
| 13 |
|
---|
| 14 | my $conffile = shift;
|
---|
[7] | 15 | my $ptr;
|
---|
[21] | 16 | my $trace;
|
---|
[6] | 17 |
|
---|
[22] | 18 | if ($debug > 0) {
|
---|
[21] | 19 | $trace = 1;
|
---|
| 20 | } else {
|
---|
| 21 | $trace = 0;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
[6] | 24 | my $config = AppConfig->new({
|
---|
| 25 | # Auto Create variables mentioned in Conf file
|
---|
| 26 | CREATE => 1,
|
---|
[21] | 27 | DEBUG => $trace,
|
---|
[17] | 28 | GLOBAL => {
|
---|
| 29 | # Each conf item is a hash
|
---|
[19] | 30 | DEFAULT => { },
|
---|
| 31 | ARGCOUNT => AppConfig::ARGCOUNT_HASH,
|
---|
[17] | 32 | }
|
---|
[6] | 33 | });
|
---|
| 34 | $config->file($conffile);
|
---|
| 35 |
|
---|
| 36 | # Root of the project to build
|
---|
| 37 | # needs at least 2 levels of dir as in the upper
|
---|
[18] | 38 | # other dirs will be created and used
|
---|
[6] | 39 |
|
---|
[18] | 40 | # main parameter hash (mandatory)
|
---|
| 41 | $ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
|
---|
| 42 | %confparam = %$ptr;
|
---|
[21] | 43 | print "DEBUG: confparam: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
[18] | 44 |
|
---|
| 45 | # List of pkg to build by default (mandatory)
|
---|
[7] | 46 | $ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
|
---|
| 47 | %defpkgdir = %$ptr;
|
---|
[21] | 48 | print "DEBUG: defpkgdir: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
[6] | 49 |
|
---|
[18] | 50 | # List of additional pkg to build when all is called (optional)
|
---|
[7] | 51 | $ptr = $config->get("extpkgdir");
|
---|
[21] | 52 | print "DEBUG: extpkgdir1: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
[18] | 53 | if (not defined $ptr) {
|
---|
| 54 | %extpkgdir = ();
|
---|
| 55 | } else {
|
---|
| 56 | %extpkgdir = %$ptr;
|
---|
| 57 | }
|
---|
[21] | 58 | print "DEBUG: extpkgdir: ".Dumper(\%extpkgdir)."\n" if ($debug >= 1);
|
---|
[6] | 59 |
|
---|
[18] | 60 | # Valid version names (optional)
|
---|
[7] | 61 | $ptr = $config->get("version");
|
---|
[18] | 62 | if (not defined $ptr) {
|
---|
| 63 | %version = ();
|
---|
| 64 | } else {
|
---|
| 65 | %version = %$ptr;
|
---|
| 66 | }
|
---|
[21] | 67 | print "DEBUG: version: ".Dumper(\%version)."\n" if ($debug >= 1);
|
---|
[6] | 68 |
|
---|
[18] | 69 | # List of files to filter (optional)
|
---|
[15] | 70 | $ptr = $config->get("filteredfiles");
|
---|
[18] | 71 | if (not defined $ptr) {
|
---|
| 72 | %filteredfiles = ();
|
---|
| 73 | } else {
|
---|
| 74 | %filteredfiles = %$ptr;
|
---|
| 75 | }
|
---|
[21] | 76 | print "DEBUG: filteredfiles: ".Dumper(\%filteredfiles)."\n" if ($debug >= 1);
|
---|
[15] | 77 |
|
---|
[6] | 78 | }
|
---|
| 79 | 1;
|
---|