[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;
|
---|
[6] | 16 |
|
---|
| 17 | my $config = AppConfig->new({
|
---|
| 18 | # Auto Create variables mentioned in Conf file
|
---|
| 19 | CREATE => 1,
|
---|
[19] | 20 | DEBUG => 1,
|
---|
[17] | 21 | GLOBAL => {
|
---|
| 22 | # Each conf item is a hash
|
---|
[19] | 23 | DEFAULT => { },
|
---|
| 24 | ARGCOUNT => AppConfig::ARGCOUNT_HASH,
|
---|
[17] | 25 | }
|
---|
[6] | 26 | });
|
---|
| 27 | $config->file($conffile);
|
---|
| 28 |
|
---|
| 29 | # Root of the project to build
|
---|
| 30 | # needs at least 2 levels of dir as in the upper
|
---|
[18] | 31 | # other dirs will be created and used
|
---|
[6] | 32 |
|
---|
[18] | 33 | # main parameter hash (mandatory)
|
---|
| 34 | $ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
|
---|
| 35 | %confparam = %$ptr;
|
---|
[19] | 36 | print "confparam: ".Dumper($ptr)."\n";
|
---|
[18] | 37 |
|
---|
| 38 | # List of pkg to build by default (mandatory)
|
---|
[7] | 39 | $ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
|
---|
| 40 | %defpkgdir = %$ptr;
|
---|
[19] | 41 | print "defpkgdir: ".Dumper($ptr)."\n";
|
---|
[6] | 42 |
|
---|
[18] | 43 | # List of additional pkg to build when all is called (optional)
|
---|
[7] | 44 | $ptr = $config->get("extpkgdir");
|
---|
[19] | 45 | print "extpkgdir1: ".Dumper($ptr)."\n";
|
---|
[18] | 46 | if (not defined $ptr) {
|
---|
| 47 | %extpkgdir = ();
|
---|
| 48 | } else {
|
---|
| 49 | %extpkgdir = %$ptr;
|
---|
| 50 | }
|
---|
[19] | 51 | print "extpkgdir: ".Dumper(\%extpkgdir)."\n";
|
---|
[6] | 52 |
|
---|
[18] | 53 | # Valid version names (optional)
|
---|
[7] | 54 | $ptr = $config->get("version");
|
---|
[18] | 55 | if (not defined $ptr) {
|
---|
| 56 | %version = ();
|
---|
| 57 | } else {
|
---|
| 58 | %version = %$ptr;
|
---|
| 59 | }
|
---|
[19] | 60 | print "version: ".Dumper(\%version)."\n";
|
---|
[6] | 61 |
|
---|
[18] | 62 | # List of files to filter (optional)
|
---|
[15] | 63 | $ptr = $config->get("filteredfiles");
|
---|
[18] | 64 | if (not defined $ptr) {
|
---|
| 65 | %filteredfiles = ();
|
---|
| 66 | } else {
|
---|
| 67 | %filteredfiles = %$ptr;
|
---|
| 68 | }
|
---|
[19] | 69 | print "filteredfiles: ".Dumper(\%filteredfiles)."\n";
|
---|
[15] | 70 |
|
---|
[6] | 71 | }
|
---|
| 72 | 1;
|
---|