| Revision 8,
1.4 KB
checked in by bruno, 6 years ago
(diff) |
|
Basic function works (conf file read and interpret)
|
| Line | |
|---|
| 1 | #!/usr/bin/perl -w |
|---|
| 2 | # |
|---|
| 3 | # Project Builder configuration file |
|---|
| 4 | # For project pb ;-) |
|---|
| 5 | # |
|---|
| 6 | # $Id$ |
|---|
| 7 | # |
|---|
| 8 | use strict; |
|---|
| 9 | use Exporter(); |
|---|
| 10 | use vars qw(@ISA @EXPORT_OK); |
|---|
| 11 | @ISA = qw(Exporter); |
|---|
| 12 | # global vars are here |
|---|
| 13 | @EXPORT_OK = qw(%defpkgdir %extpkgdir %version &pb_init); |
|---|
| 14 | use vars @EXPORT_OK; |
|---|
| 15 | use AppConfig qw(ARGCOUNT_ONE ARGCOUNT_HASH ARGCOUNT_LIST EXPAND_ALL); |
|---|
| 16 | |
|---|
| 17 | sub pb_init { |
|---|
| 18 | |
|---|
| 19 | my $conffile = shift; |
|---|
| 20 | my $ptr; |
|---|
| 21 | |
|---|
| 22 | my $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 | } |
|---|
| 56 | 1; |
|---|
Note: See
TracBrowser
for help on using the repository browser.