- Timestamp:
- Oct 22, 2007, 7:46:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/lib/ProjectBuilder/Base.pm
r236 r242 219 219 } 220 220 221 # Function which returns a pointer on a hash222 # corresponding to a declaration (arg2) in the mainconf file221 # Function which returns a pointer on a table 222 # corresponding to a set of values queried in the conf file 223 223 # and test the returned vaue as they need to exist in that case 224 224 sub pb_conf_get { … … 226 226 my @param = @_; 227 227 228 my @ptr = pb_conf_read("$ENV{'PBETC'}", @param); 228 # Everything is returned via ptr1 229 my @ptr1 = pb_conf_read("$ENV{'PBETC'}", @param); 230 my @ptr2 = pb_conf_read("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb", @param); 231 232 my $p1; 233 my $p2; 229 234 230 235 foreach my $i (0..$#param) { 231 die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $ptr[$i]); 232 my $p = $ptr[$i]; 233 $p->{$ENV{'PBPROJ'}} = $p->{'default'} if (not defined $p->{$ENV{'PBPROJ'}}); 234 die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $p->{$ENV{'PBPROJ'}}); 236 die "No $param[$i] defined for $ENV{'PBPROJ'}" if ((not defined $ptr1[$i]) && (not defined $ptr2[$i])); 237 # Always try to take the param from the home dir conf file in priority 238 # in order to mask what could be defined under the CMS to allow for overloading 239 $p1 = $ptr1[$i]; 240 $p2 = $ptr2[$i]; 241 if (not defined $p2) { 242 # No ref in CMS project conf file so use the home dir one. 243 $p1->{$ENV{'PBPROJ'}} = $p1->{'default'} if (not defined $p1->{$ENV{'PBPROJ'}}); 244 } else { 245 # Ref found in CMS project conf file 246 if (not defined $p1) { 247 # No ref in home dir project conf file so use the CMS one. 248 $p2->{$ENV{'PBPROJ'}} = $p2->{'default'} if (not defined $p2->{$ENV{'PBPROJ'}}); 249 $p1->{$ENV{'PBPROJ'}} = $p2->{$ENV{'PBPROJ'}}; 250 } else { 251 # Both are defined - handling the overloading 252 if (not defined $p1->{'default'}) { 253 if (defined $p2->{'default'}) { 254 $p1->{'default'} = $p2->{'default'}; 255 } 256 } 257 258 if (not defined $p1->{$ENV{'PBPROJ'}}) { 259 if (defined $p2->{$ENV{'PBPROJ'}}) { 260 $p1->{$ENV{'PBPROJ'}} = $p2->{$ENV{'PBPROJ'}}; 261 } else { 262 $p1->{$ENV{'PBPROJ'}} = $p1->{'default'}; 263 } 264 } 265 } 266 } 267 die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $p1->{$ENV{'PBPROJ'}}); 235 268 } 236 269 #print "DEBUG: param: ".Dumper(@ptr)."\n" if ($debug >= 1); 237 return(@ptr); 270 return(@ptr1); 271 } 272 273 sub pb_no_err { 238 274 } 239 275 … … 260 296 CREATE => 1, 261 297 DEBUG => $trace, 298 ERROR => \&pb_no_err, 262 299 GLOBAL => { 263 300 # Each conf item is a hash … … 280 317 281 318 my ($cms) = pb_conf_get("cms"); 282 # This one is optional283 my ($cvsroot,$cvsrsh) = pb_conf_read($ENV{'PBETC'},"cvsroot","cvsrsh");284 319 285 320 if ($cms->{$proj} eq "svn") { … … 302 337 # Export content if needed 303 338 # 339 my ($cvsroot,$cvsrsh) = pb_conf_get("cvsroot","cvsrsh"); 304 340 $ENV{'CVSROOT'} = $cvsroot->{$proj} if (defined $cvsroot->{$proj}); 305 341 $ENV{'CVSRSH'} = $cvsrsh->{$proj} if (defined $cvsrsh->{$proj});
Note:
See TracChangeset
for help on using the changeset viewer.