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

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

Begin to work on pkg2build
Cope the module Linux::Distribution in the project as it's not packages for my distro
Will make delivery much easier.

File size: 1.8 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;
16my $trace;
17
18if ($debug > 0) {
19 $trace = 1;
20} else {
21 $trace = 0;
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_HASH,
32 }
33 });
34$config->file($conffile);
35
36# Root of the project to build
37# needs at least 2 levels of dir as in the upper
38# other dirs will be created and used
39
40# main parameter hash (mandatory)
41$ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
42%confparam = %$ptr;
43print "DEBUG: confparam: ".Dumper($ptr)."\n" if ($debug >= 1);
44
45# List of pkg to build by default (mandatory)
46$ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
47%defpkgdir = %$ptr;
48print "DEBUG: defpkgdir: ".Dumper($ptr)."\n" if ($debug >= 1);
49
50# List of additional pkg to build when all is called (optional)
51$ptr = $config->get("extpkgdir");
52print "DEBUG: extpkgdir1: ".Dumper($ptr)."\n" if ($debug >= 1);
53if (not defined $ptr) {
54 %extpkgdir = ();
55} else {
56 %extpkgdir = %$ptr;
57}
58print "DEBUG: extpkgdir: ".Dumper(\%extpkgdir)."\n" if ($debug >= 1);
59
60# Valid version names (optional)
61$ptr = $config->get("version");
62if (not defined $ptr) {
63 %version = ();
64} else {
65 %version = %$ptr;
66}
67print "DEBUG: version: ".Dumper(\%version)."\n" if ($debug >= 1);
68
69# List of files to filter (optional)
70$ptr = $config->get("filteredfiles");
71if (not defined $ptr) {
72 %filteredfiles = ();
73} else {
74 %filteredfiles = %$ptr;
75}
76print "DEBUG: filteredfiles: ".Dumper(\%filteredfiles)."\n" if ($debug >= 1);
77
78}
791;
Note: See TracBrowser for help on using the repository browser.