Changeset 49 in ProjectBuilder for devel/pb/lib/common.pm


Ignore:
Timestamp:
Aug 26, 2007, 11:58:03 AM (17 years ago)
Author:
Bruno Cornec
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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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#
Note: See TracChangeset for help on using the changeset viewer.