Changeset 69 in ProjectBuilder for devel/pb/lib
- Timestamp:
- Aug 31, 2007, 3:20:15 PM (17 years ago)
- Location:
- devel/pb/lib/ProjectBuilder
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/common.pm
r68 r69 32 32 $proj = $ENV{'PBPROJ'}; 33 33 } 34 35 # 36 # We get the pbrc file for that project 37 # and use its content 38 # 39 $pbrc = pb_init("$ENV{'PBETC'}","pbrc"); 40 41 my %pbrc = %$pbrc; 42 if (not defined $proj) { 43 # Take the first as the default project 44 $proj = (keys %pbrc)[0]; 45 print $LOG "Using $proj as default project as none has been specified\n" if (($debug >= 0) and (defined $proj)); 46 } 47 die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj)); 48 49 # 50 # Set delivery directory 51 # 52 my $topdir=basename($pbrc{$proj}); 53 chdir $topdir || die "Unable to change directory to $topdir"; 54 $ENV{'PBDESTDIR'}=$topdir."/delivery"; 55 34 56 # 35 57 # Use project configuration file if needed 36 58 # 37 59 if (not defined $ENV{'PBROOT'}) { 38 pb_init("$ENV{'PBETC'}"); 39 40 if (not defined $proj) { 41 # Take the first as the default project 42 $proj = (keys %pbroot)[0]; 43 print $LOG "Using $proj as default project as none has been specified\n" if (($debug >= 0) and (defined $proj)); 60 if (-f $pbrc{$proj}) { 61 $pbroot = pb_init($pbrc{$proj},"pbroot"); 62 # There is normaly only one line in it 63 $ENV{'PBROOT'} = (values %$pbroot)[0] if (defined $pbroot); 64 print $LOG "Using $ENV{'PBROOT'} as default pbroot from $pbrc{$proj}\n" if (($debug >= 0) and (defined $ENV{'PBROOT'})); 44 65 } 45 die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj)); 46 47 $ENV{'PBROOT'} = $pbroot{$proj}; 48 } else { 49 die "No project defined - use env var PBPROJ or -p proj" if (not (defined $proj)); 66 die "No pbroot defined - use env var PBROOT or -r pbroot " if (not defined $ENV{'PBROOT'}); 50 67 } 51 68 … … 101 118 102 119 # 103 # Adapt to your needs 104 # Set delivery directory 105 # Removes all directory existing below as they are temp dir only 120 # Removes all directory existing below the delivery dir 121 # as they are temp dir only 106 122 # Files stay and have to be cleaned up manually 107 123 # 108 chdir "$ENV{'PBROOT'}/..";109 my $path = `pwd`;110 chomp($path);111 $ENV{'PBDESTDIR'}=$path."/delivery";112 124 if (-d $ENV{'PBDESTDIR'}) { 113 125 opendir(DIR,$ENV{'PBDESTDIR'}) || die "Unable to open directory $ENV{'PBDESTDIR'}: $!"; -
devel/pb/lib/ProjectBuilder/pb.pm
r50 r69 9 9 use AppConfig qw(ARGCOUNT_HASH ARGCOUNT_ONE); 10 10 use Data::Dumper; 11 use vars qw (%pbroot);12 11 13 12 sub pb_init { 14 13 15 14 my $conffile = shift; 15 my $param = shift; 16 16 my $trace; 17 17 … … 33 33 }); 34 34 $config->file($conffile); 35 my $ptr = $config->get( "pbroot") || die "Unable to find pbrootin $conffile";35 my $ptr = $config->get($param) || die "Unable to find $param in $conffile"; 36 36 print "DEBUG: pbroot: ".Dumper($ptr)."\n" if ($debug >= 1); 37 %pbroot = %$ptr;37 return($ptr); 38 38 } 39 39
Note:
See TracChangeset
for help on using the changeset viewer.