source: ProjectBuilder/devel/pb/lib/pb.pm@ 19

Last change on this file since 19 was 19, checked in by Bruno Cornec, 17 years ago

Lots of debug traces. Looking for a bug in AppConfig where for hash a key of 1 is added without defined value.
Except that, weems to work just fine (content to be checked)

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