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

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

/etc/pb/proj now contains the strict minimum
rest is under pbconf/proj.pb

File size: 2.2 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;
[38]15my $trace;
16
17if ($debug > 0) {
18 $trace = 1;
19} else {
20 $trace = 0;
21}
22
23
24my $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_ONE,
32 }
33 });
34$config->file($conffile);
35my $ptr = $config->get("pbroot") || die "Unable to find pbroot in $conffile";
36return($ptr);
37}
38
39sub pb_conf_init {
40
41my $conffile = shift;
[7]42my $ptr;
[21]43my $trace;
[6]44
[22]45if ($debug > 0) {
[21]46 $trace = 1;
47} else {
48 $trace = 0;
49}
50
[6]51my $config = AppConfig->new({
52 # Auto Create variables mentioned in Conf file
53 CREATE => 1,
[21]54 DEBUG => $trace,
[17]55 GLOBAL => {
56 # Each conf item is a hash
[19]57 DEFAULT => { },
58 ARGCOUNT => AppConfig::ARGCOUNT_HASH,
[17]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]70print "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]75print "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]79if (not defined $ptr) {
80 %extpkgdir = ();
81} else {
82 %extpkgdir = %$ptr;
83}
[21]84print "DEBUG: extpkgdir: ".Dumper(\%extpkgdir)."\n" if ($debug >= 1);
[6]85
[18]86# Valid version names (optional)
[7]87$ptr = $config->get("version");
[18]88if (not defined $ptr) {
89 %version = ();
90} else {
91 %version = %$ptr;
92}
[21]93print "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]97if (not defined $ptr) {
98 %filteredfiles = ();
99} else {
100 %filteredfiles = %$ptr;
101}
[21]102print "DEBUG: filteredfiles: ".Dumper(\%filteredfiles)."\n" if ($debug >= 1);
[15]103
[6]104}
1051;
Note: See TracBrowser for help on using the repository browser.