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