Changeset 49 in ProjectBuilder
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb.pl
r46 r49 20 20 use POSIX qw(strftime); 21 21 22 use vars qw (%defpkgdir %extpkgdir %version %confparam %filteredfiles $debug $LOG);22 use vars qw (%defpkgdir %extpkgdir %version %confparam %filteredfiles %pbroot $debug $LOG); 23 23 $debug = 0; # Debug level 24 24 $LOG = *STDOUT; # Where to log -
devel/pb/lib/common.pm
r38 r49 14 14 use Data::Dumper; 15 15 16 $ENV{'PBETC'} = " /etc/pb";16 $ENV{'PBETC'} = "$ENV{'HOME'}/.pbrc"; 17 17 18 18 sub env_init { … … 24 24 # 25 25 # Check project name 26 # Could be with env var PBPROJ 27 # or option -p 28 # if not define take the first in conf file 26 29 # 27 30 if ((defined $ENV{'PBPROJ'}) && … … 29 32 $proj = $ENV{'PBPROJ'}; 30 33 } 31 die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj));32 33 34 # 34 35 # Use project configuration file 35 36 # 36 my $pbroot=pb_init("$ENV{'PBETC'}/$proj");37 pb_init("$ENV{'PBETC'}"); 37 38 38 if (not defined $pbroot) { 39 die "pbroot doesn't exist in $ENV{'PBETC'}/$proj"; 39 if (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 } 44 die "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"; 52 die "Project $proj not Project-Builder compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}"); 53 54 if (-f "$ENV{'PBCONF'}/$proj.pb") { 55 pb_conf_init("$ENV{'PBCONF'}/$proj.pb"); 40 56 } else { 41 $ENV{'PBROOT'} = $pbroot;57 die "Unable to open $ENV{'PBCONF'}/$proj.pb"; 42 58 } 43 44 pb_conf_init("$ENV{'PBROOT'}/pbconf/$proj.pb");45 59 46 60 # … … 60 74 } 61 75 $ENV{'PBTMP'} = tempdir( "pb.XXXXXXXXXX", DIR => $ENV{'TMPDIR'}, CLEANUP => 1 ); 62 63 #64 # Check pb conf compliance65 #66 $ENV{'PBCONF'} = "$ENV{'PBROOT'}/pbconf";67 die "Project $ENV{'PBPROJ'} not ProjectBuild compliant. Please populate $ENV{'PBCONF'}" if ( not -d "$ENV{'PBCONF'}");68 76 69 77 # -
devel/pb/lib/pb.pm
r39 r49 9 9 use AppConfig qw(ARGCOUNT_HASH ARGCOUNT_ONE); 10 10 use Data::Dumper; 11 use vars qw (%pbroot); 11 12 12 13 sub pb_init { … … 28 29 GLOBAL => { 29 30 # Each conf item is a hash 30 ARGCOUNT => ARGCOUNT_ ONE,31 ARGCOUNT => ARGCOUNT_HASH, 31 32 }, 32 33 }); 33 34 $config->file($conffile); 34 35 my $ptr = $config->get("pbroot") || die "Unable to find pbroot in $conffile"; 35 return($ptr); 36 print "DEBUG: pbroot: ".Dumper($ptr)."\n" if ($debug >= 1); 37 %pbroot = %$ptr; 36 38 } 37 39
Note:
See TracChangeset
for help on using the changeset viewer.