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
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;
[21]16my $trace;
[6]17
[22]18if ($debug > 0) {
[21]19 $trace = 1;
20} else {
21 $trace = 0;
22}
23
[6]24my $config = AppConfig->new({
25 # Auto Create variables mentioned in Conf file
26 CREATE => 1,
[21]27 DEBUG => $trace,
[17]28 GLOBAL => {
29 # Each conf item is a hash
[19]30 DEFAULT => { },
31 ARGCOUNT => AppConfig::ARGCOUNT_HASH,
[17]32 }
[6]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
[18]38# other dirs will be created and used
[6]39
[18]40# main parameter hash (mandatory)
41$ptr = $config->get("confparam") || die "Unable to find confparam in $conffile";
42%confparam = %$ptr;
[21]43print "DEBUG: confparam: ".Dumper($ptr)."\n" if ($debug >= 1);
[18]44
45# List of pkg to build by default (mandatory)
[7]46$ptr = $config->get("defpkgdir") || die "Unable to find defpkgdir in $conffile";
47%defpkgdir = %$ptr;
[21]48print "DEBUG: defpkgdir: ".Dumper($ptr)."\n" if ($debug >= 1);
[6]49
[18]50# List of additional pkg to build when all is called (optional)
[7]51$ptr = $config->get("extpkgdir");
[21]52print "DEBUG: extpkgdir1: ".Dumper($ptr)."\n" if ($debug >= 1);
[18]53if (not defined $ptr) {
54 %extpkgdir = ();
55} else {
56 %extpkgdir = %$ptr;
57}
[21]58print "DEBUG: extpkgdir: ".Dumper(\%extpkgdir)."\n" if ($debug >= 1);
[6]59
[18]60# Valid version names (optional)
[7]61$ptr = $config->get("version");
[18]62if (not defined $ptr) {
63 %version = ();
64} else {
65 %version = %$ptr;
66}
[21]67print "DEBUG: version: ".Dumper(\%version)."\n" if ($debug >= 1);
[6]68
[18]69# List of files to filter (optional)
[15]70$ptr = $config->get("filteredfiles");
[18]71if (not defined $ptr) {
72 %filteredfiles = ();
73} else {
74 %filteredfiles = %$ptr;
75}
[21]76print "DEBUG: filteredfiles: ".Dumper(\%filteredfiles)."\n" if ($debug >= 1);
[15]77
[6]78}
791;
Note: See TracBrowser for help on using the repository browser.