Changeset 49


Ignore:
Timestamp:
Aug 26, 2007, 11:58:03 AM (11 years ago)
Author:
bruno
Message:

conf file is now in the home directory to allow for multi user usage of pb
cms2build and build2pkg are working roughly for pb
Next test with mondo

Location:
devel/pb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb.pl

    r46 r49  
    2020use POSIX qw(strftime);
    2121
    22 use vars qw (%defpkgdir %extpkgdir %version %confparam %filteredfiles $debug $LOG);
     22use vars qw (%defpkgdir %extpkgdir %version %confparam %filteredfiles %pbroot $debug $LOG);
    2323$debug = 0;                 # Debug level
    2424$LOG = *STDOUT;             # Where to log
  • devel/pb/lib/common.pm

    r38 r49  
    1414use Data::Dumper;
    1515
    16 $ENV{'PBETC'} = "/etc/pb";
     16$ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc";
    1717
    1818sub env_init {
     
    2424#
    2525# Check project name
     26# Could be with env var PBPROJ
     27# or option -p
     28# if not define take the first in conf file
    2629#
    2730if ((defined $ENV{'PBPROJ'}) &&
     
    2932    $proj = $ENV{'PBPROJ'};
    3033}
    31 die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj));
    32 
    3334#
    3435# Use project configuration file
    3536#
    36 my $pbroot=pb_init("$ENV{'PBETC'}/$proj");
     37pb_init("$ENV{'PBETC'}");
    3738
    38 if (not defined $pbroot) {
    39     die "pbroot doesn't exist in $ENV{'PBETC'}/$proj";
     39if (not defined $proj) {
     40    # Take the first as the default project
     41    $proj = (keys %pbroot)[0];
     42    print $LOG "Using $proj as default project as none has been specified\n" if (($debug >= 0) and (defined $proj));
     43}
     44die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj));
     45
     46$ENV{'PBROOT'} = $pbroot{$proj};
     47
     48#
     49# Check pb conf compliance
     50#
     51$ENV{'PBCONF'} = "$ENV{'PBROOT'}/pbconf";
     52die "Project $proj not Project-Builder compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}");
     53
     54if (-f "$ENV{'PBCONF'}/$proj.pb") {
     55    pb_conf_init("$ENV{'PBCONF'}/$proj.pb");
    4056} else {
    41     $ENV{'PBROOT'} = $pbroot;
     57    die "Unable to open $ENV{'PBCONF'}/$proj.pb";
    4258}
    43 
    44 pb_conf_init("$ENV{'PBROOT'}/pbconf/$proj.pb");
    4559
    4660#
     
    6074}
    6175$ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 );
    62 
    63 #
    64 # Check pb conf compliance
    65 #
    66 $ENV{'PBCONF'} = "$ENV{'PBROOT'}/pbconf";
    67 die "Project $ENV{'PBPROJ'} not ProjectBuild compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}");
    6876
    6977#
  • devel/pb/lib/pb.pm

    r39 r49  
    99use AppConfig qw(ARGCOUNT_HASH ARGCOUNT_ONE);
    1010use Data::Dumper;
     11use vars qw (%pbroot);
    1112
    1213sub pb_init {
     
    2829                            GLOBAL => {
    2930                                # Each conf item is a hash
    30                                 ARGCOUNT => ARGCOUNT_ONE,
     31                                ARGCOUNT => ARGCOUNT_HASH,
    3132                            },
    3233                        });
    3334$config->file($conffile);
    3435my $ptr = $config->get("pbroot") || die "Unable to find pbroot in $conffile";
    35 return($ptr);
     36print "DEBUG: pbroot: ".Dumper($ptr)."\n" if ($debug >= 1);
     37%pbroot = %$ptr;
    3638}
    3739
Note: See TracChangeset for help on using the changeset viewer.