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
RevLine 
[6]1#!/usr/bin/perl -w
2#
[18]3# Project Builder configuration file handler
[6]4# For project pb ;-)
5#
6# $Id$
7#
8use strict;
[17]9use AppConfig qw(ARGCOUNT_HASH);
[19]10use Data::Dumper;
[6]11
12sub pb_init {
13
14my $conffile = shift;
[7]15my $ptr;
[6]16
17my $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]36print "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]41print "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]45print "extpkgdir1: ".Dumper($ptr)."\n";
[18]46if (not defined $ptr) {
47 %extpkgdir = ();
48} else {
49 %extpkgdir = %$ptr;
50}
[19]51print "extpkgdir: ".Dumper(\%extpkgdir)."\n";
[6]52
[18]53# Valid version names (optional)
[7]54$ptr = $config->get("version");
[18]55if (not defined $ptr) {
56 %version = ();
57} else {
58 %version = %$ptr;
59}
[19]60print "version: ".Dumper(\%version)."\n";
[6]61
[18]62# List of files to filter (optional)
[15]63$ptr = $config->get("filteredfiles");
[18]64if (not defined $ptr) {
65 %filteredfiles = ();
66} else {
67 %filteredfiles = %$ptr;
68}
[19]69print "filteredfiles: ".Dumper(\%filteredfiles)."\n";
[15]70
[6]71}
721;
Note: See TracBrowser for help on using the repository browser.