[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;
|
---|
[39] | 9 | use AppConfig qw(ARGCOUNT_HASH ARGCOUNT_ONE);
|
---|
[19] | 10 | use Data::Dumper;
|
---|
[49] | 11 | use vars qw (%pbroot);
|
---|
[6] | 12 |
|
---|
| 13 | sub pb_init {
|
---|
| 14 |
|
---|
| 15 | my $conffile = shift;
|
---|
[38] | 16 | my $trace;
|
---|
| 17 |
|
---|
| 18 | if ($debug > 0) {
|
---|
| 19 | $trace = 1;
|
---|
| 20 | } else {
|
---|
| 21 | $trace = 0;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 |
|
---|
| 25 | my $config = AppConfig->new({
|
---|
| 26 | # Auto Create variables mentioned in Conf file
|
---|
| 27 | CREATE => 1,
|
---|
| 28 | DEBUG => $trace,
|
---|
| 29 | GLOBAL => {
|
---|
| 30 | # Each conf item is a hash
|
---|
[49] | 31 | ARGCOUNT => ARGCOUNT_HASH,
|
---|
[39] | 32 | },
|
---|
[38] | 33 | });
|
---|
| 34 | $config->file($conffile);
|
---|
| 35 | my $ptr = $config->get("pbroot") || die "Unable to find pbroot in $conffile";
|
---|
[49] | 36 | print "DEBUG: pbroot: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
| 37 | %pbroot = %$ptr;
|
---|
[38] | 38 | }
|
---|
| 39 |
|
---|
| 40 | sub pb_conf_init {
|
---|
| 41 |
|
---|
| 42 | my $conffile = shift;
|
---|
[7] | 43 | my $ptr;
|
---|
[21] | 44 | my $trace;
|
---|
[6] | 45 |
|
---|
[22] | 46 | if ($debug > 0) {
|
---|
[21] | 47 | $trace = 1;
|
---|
| 48 | } else {
|
---|
| 49 | $trace = 0;
|
---|
| 50 | }
|
---|
| 51 |
|
---|
[6] | 52 | my $config = AppConfig->new({
|
---|
| 53 | # Auto Create variables mentioned in Conf file
|
---|
[21] | 54 | DEBUG => $trace,
|
---|
[39] | 55 | CREATE => '1',
|
---|
[17] | 56 | GLOBAL => {
|
---|
| 57 | # Each conf item is a hash
|
---|
[39] | 58 | ARGCOUNT => ARGCOUNT_HASH,
|
---|
| 59 | },
|
---|
[6] | 60 | });
|
---|
| 61 | $config->file($conffile);
|
---|
| 62 |
|
---|
| 63 | # Root of the project to build
|
---|
| 64 | # needs at least 2 levels of dir as in the upper
|
---|
[18] | 65 | # other dirs will be created and used
|
---|
[6] | 66 |
|
---|
[18] | 67 | # main parameter hash (mandatory)
|
---|
| 68 | $ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
|
---|
| 69 | %confparam = %$ptr;
|
---|
[21] | 70 | print "DEBUG: confparam: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
[18] | 71 |
|
---|
| 72 | # List of pkg to build by default (mandatory)
|
---|
[7] | 73 | $ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
|
---|
| 74 | %defpkgdir = %$ptr;
|
---|
[21] | 75 | print "DEBUG: defpkgdir: ".Dumper($ptr)."\n" if ($debug >= 1);
|
---|
[6] | 76 |
|
---|
[18] | 77 | # List of additional pkg to build when all is called (optional)
|
---|
[7] | 78 | $ptr = $config->get("extpkgdir");
|
---|
[18] | 79 | if (not defined $ptr) {
|
---|
| 80 | %extpkgdir = ();
|
---|
| 81 | } else {
|
---|
| 82 | %extpkgdir = %$ptr;
|
---|
| 83 | }
|
---|
[21] | 84 | print "DEBUG: extpkgdir: ".Dumper(\%extpkgdir)."\n" if ($debug >= 1);
|
---|
[6] | 85 |
|
---|
[18] | 86 | # Valid version names (optional)
|
---|
[7] | 87 | $ptr = $config->get("version");
|
---|
[18] | 88 | if (not defined $ptr) {
|
---|
| 89 | %version = ();
|
---|
| 90 | } else {
|
---|
| 91 | %version = %$ptr;
|
---|
| 92 | }
|
---|
[21] | 93 | print "DEBUG: version: ".Dumper(\%version)."\n" if ($debug >= 1);
|
---|
[6] | 94 |
|
---|
[18] | 95 | # List of files to filter (optional)
|
---|
[15] | 96 | $ptr = $config->get("filteredfiles");
|
---|
[18] | 97 | if (not defined $ptr) {
|
---|
| 98 | %filteredfiles = ();
|
---|
| 99 | } else {
|
---|
| 100 | %filteredfiles = %$ptr;
|
---|
| 101 | }
|
---|
[21] | 102 | print "DEBUG: filteredfiles: ".Dumper(\%filteredfiles)."\n" if ($debug >= 1);
|
---|
[15] | 103 |
|
---|
[6] | 104 | }
|
---|
| 105 | 1;
|
---|