Ignore:
Timestamp:
10/22/07 19:46:27 (6 years ago)
Author:
bruno
Message:

Attempt to fix #2. Needs now to merge most of the .pbrc content into project build file configuration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Base.pm

    r236 r242  
    219219} 
    220220 
    221 # Function which returns a pointer on a hash 
    222 # corresponding to a declaration (arg2) in the main conf file 
     221# Function which returns a pointer on a table 
     222# corresponding to a set of values queried in the conf file 
    223223# and test the returned vaue as they need to exist in that case 
    224224sub pb_conf_get { 
     
    226226my @param = @_; 
    227227 
    228 my @ptr = pb_conf_read("$ENV{'PBETC'}", @param); 
     228# Everything is returned via ptr1 
     229my @ptr1 = pb_conf_read("$ENV{'PBETC'}", @param); 
     230my @ptr2 = pb_conf_read("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb", @param); 
     231 
     232my $p1; 
     233my $p2; 
    229234 
    230235foreach 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'}}); 
    235268} 
    236269#print "DEBUG: param: ".Dumper(@ptr)."\n" if ($debug >= 1); 
    237 return(@ptr); 
     270return(@ptr1); 
     271} 
     272 
     273sub pb_no_err { 
    238274} 
    239275 
     
    260296                            CREATE => 1, 
    261297                            DEBUG => $trace, 
     298                            ERROR => \&pb_no_err, 
    262299                            GLOBAL => { 
    263300                                # Each conf item is a hash 
     
    280317 
    281318my ($cms) = pb_conf_get("cms"); 
    282 # This one is optional 
    283 my ($cvsroot,$cvsrsh) = pb_conf_read($ENV{'PBETC'},"cvsroot","cvsrsh"); 
    284319 
    285320if ($cms->{$proj} eq "svn") { 
     
    302337    # Export content if needed 
    303338    # 
     339    my ($cvsroot,$cvsrsh) = pb_conf_get("cvsroot","cvsrsh"); 
    304340    $ENV{'CVSROOT'} = $cvsroot->{$proj} if (defined $cvsroot->{$proj}); 
    305341    $ENV{'CVSRSH'} = $cvsrsh->{$proj} if (defined $cvsrsh->{$proj}); 
Note: See TracChangeset for help on using the changeset viewer.