source: devel/pb/lib/pb.pm @ 8

Last change on this file since 8 was 8, checked in by Bruno Cornec, 13 years ago

Basic function works (conf file read and interpret)

File size: 1.4 KB
Line 
1#!/usr/bin/perl -w
2#
3# Project Builder configuration file
4# For project pb ;-)
5#
6# $Id$
7#
8use strict;
9use Exporter();
10use vars qw(@ISA @EXPORT_OK);
11@ISA = qw(Exporter);
12# global vars are here
13@EXPORT_OK = qw(%defpkgdir %extpkgdir %version &pb_init);
14use vars @EXPORT_OK;
15use AppConfig qw(ARGCOUNT_ONE ARGCOUNT_HASH ARGCOUNT_LIST EXPAND_ALL);
16
17sub pb_init {
18
19my $conffile = shift;
20my $ptr;
21
22my $config = AppConfig->new({
23                            # Auto Create variables mentioned in Conf file
24                            CREATE => 1,
25                            DEBUG => 0,
26                        });
27$config->define("pbroot" => { ARGCOUNT => ARGCOUNT_ONE, EXPAND => EXPAND_ALL });
28$config->define("cvsroot" => { ARGCOUNT => ARGCOUNT_ONE });
29$config->define("defpkgdir" => { ARGCOUNT => ARGCOUNT_HASH });
30$config->define("extpkgdir" => { ARGCOUNT => ARGCOUNT_HASH });
31$config->define("version" => { ARGCOUNT => ARGCOUNT_HASH });
32
33$config->file($conffile);
34
35# Root of the project to build
36# needs at least 2 levels of dir as in the upper
37# other dirs will be created and used
38$ENV{'PBROOT'} = $config->get("pbroot") || die "Unable to find pbroot in $conffile";
39
40# If CVS, gives the way to login
41$ENV{'CVSROOT'} = $config->get("cvsroot");
42
43# List of pkg to build by default
44$ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
45%defpkgdir = %$ptr;
46
47# List of additional pkg to build when all is called
48$ptr = $config->get("extpkgdir");
49%extpkgdir = %$ptr;
50
51# Valid version names
52$ptr = $config->get("version");
53%version = %$ptr;
54
55}
561;
Note: See TracBrowser for help on using the repository browser.