Ignore:
Timestamp:
Sep 3, 2007, 4:36:22 PM (12 years ago)
Author:
bruno
Message:

Prepare for new actions on delivery on SSH

File:
1 edited

Legend:

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

    r87 r88  
    193193
    194194# Function which returns a pointer on a hash
     195# corresponding to a declaration (arg2) in the main conf file
     196# and test the returned vaue as they need to exist in that case
     197sub pb_conf_get {
     198
     199my @param = @_;
     200
     201my $ptr = pb_conf_read("$ENV{'PBETC'}", @param);
     202my @ptr;
     203if ($#param == 0) {
     204    push @ptr, $ptr;
     205} else {
     206    @ptr = @$ptr;
     207}
     208foreach my $i (0..$#param) {
     209    die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $ptr[$i]);
     210    my $p = $ptr[$i];
     211    $p->{$ENV{'PBPROJ'}} = $p->{'default'} if (not defined $p->{$ENV{'PBPROJ'}});
     212    die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $p->{$ENV{'PBPROJ'}});
     213}
     214if ($#param == 0) {
     215    print "DEBUG: param: ".Dumper($ptr[0])."\n" if ($debug >= 1);
     216    return($ptr[0]);
     217} else {
     218    my $ptr = \@ptr;
     219    print "DEBUG: param: ".Dumper($ptr)."\n" if ($debug >= 1);
     220    return($ptr);
     221}
     222}
     223
     224# Function which returns a pointer on a hash
    195225# corresponding to a declaration (arg2) in a conf file (arg1)
    196226sub pb_conf_read {
     
    222252}
    223253if ($#param == 0) {
    224     print "DEBUG: param: ".Dumper($ptr[0])."\n" if ($debug >= 1);
     254    print "DEBUG: param: $param[0] ".Dumper($ptr[0])."\n" if ($debug >= 1);
    225255    return($ptr[0]);
    226256} else {
    227257    my $ptr = \@ptr;
    228     print "DEBUG: params: ".Dumper($ptr)."\n" if ($debug >= 1);
     258    print "DEBUG: params: ".Dumper(@param)." ".Dumper($ptr)."\n" if ($debug >= 1);
    229259    return($ptr);
    230260}
    231 }
    232 
    233 sub pb_conf_init {
    234 
    235 my $conffile = shift;
    236 my $ptr;
    237 my $trace;
    238 
    239 if ($debug > 0) {
    240     $trace = 1;
    241 } else {
    242     $trace = 0;
    243 }
    244 
    245 my $config = AppConfig->new({
    246                             # Auto Create variables mentioned in Conf file
    247                             DEBUG => $trace,
    248                             CREATE => '1',
    249                             GLOBAL => {
    250                                 # Each conf item is a hash
    251                                 ARGCOUNT => ARGCOUNT_HASH,
    252                             },
    253                         });
    254 $config->file($conffile);
    255 
    256 # Root of the project to build
    257 # needs at least 2 levels of dir as in the upper
    258 # other dirs will be created and used
    259 
    260261}
    261262
     
    266267my $ret;
    267268
    268 my ($cms,$cvsroot) = pb_conf_read("$ENV{'PBETC'}","cms","cvsroot");
    269 die "No CMS defined for $proj" if (not defined $cms);
    270 my %cms = %$cms;
    271 die "No CMS defined for $proj" if (not defined $cms{$proj});
    272 
    273 if ($cms{$proj} eq "svn") {
     269my $cms = pb_conf_get("cms");
     270# This one is optional
     271my $cvsroot = pb_conf_read($ENV{'PBETC'},"cvsroot");
     272
     273if ($cms->{$proj} eq "svn") {
    274274    $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; svnversion .)`;
    275275    chomp($ENV{'PBREVISION'});
     
    277277    $ENV{'PBCMSLOGFILE'}="svn.log";
    278278    $ENV{'PBCMSEXP'}="svn export";
    279 } elsif ($cms{$proj} eq "cvs") {
     279} elsif ($cms->{$proj} eq "cvs") {
    280280    $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate  -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
    281281    chomp($ENV{'PBREVISION'});
    282282    $ENV{'PBCMSLOG'}="cvs log";
    283283    $ENV{'PBCMSLOGFILE'}="cvs.log";
    284     $ENV{'PBCMSEXP'}="cvs export"
     284    $ENV{'PBCMSEXP'}="cvs export";
    285285    #
    286286    # Export content if needed
    287287    #
    288     $ENV{'CVSROOT'} = $cvsroot{$proj} if (defined $cvsroot{$proj});
    289 } else {
    290     die "CMS $cms{$proj} unknown";
     288    $ENV{'CVSROOT'} = $cvsroot->{$proj} if (defined $cvsroot->{$proj});
     289} else {
     290    die "cms $cms->{$proj} unknown";
    291291}
    292292}
Note: See TracChangeset for help on using the changeset viewer.