Ignore:
Timestamp:
Sep 5, 2007, 1:21:18 AM (12 years ago)
Author:
bruno
Message:

Lots of various fixes for CVS support with LinuxCOE

File:
1 edited

Legend:

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

    r105 r106  
    9898    %filteredfiles = ();
    9999    %filteredfiles = %$filteredfiles if (defined $filteredfiles);
     100    #
     101    # Get global Version/Tag
     102    #
     103
     104    if (not defined $ENV{'PBVER'}) {
     105        if ((defined $pkgv) && (defined $pkgv->{$proj})) {
     106            $ENV{'PBVER'}=$pkgv->{$proj};
     107        } else {
     108            die "No projver found in $ENV{'PBCONF'}/$proj.pb";
     109        }
     110    }
     111    die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}}));
     112   
     113    if (not defined $ENV{'PBTAG'}) {
     114        if ((defined $pkgt) && (defined $pkgt->{$proj})) {
     115            $ENV{'PBTAG'}=$pkgt->{$proj};
     116        } else {
     117            die "No projtag found in $ENV{'PBCONF'}/$proj.pb";
     118        }
     119    }
     120    die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$proj.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
    100121} else {
    101122    die "Unable to open $ENV{'PBCONF'}/$proj.pb";
    102123}
    103 
    104 #
    105 # Get global Version/Tag
    106 #
    107 
    108 if (not defined $ENV{'PBVER'}) {
    109     if ((defined $pkgv) && (defined $pkgv->{$proj})) {
    110         $ENV{'PBVER'}=$pkgv->{$proj};
    111     } else {
    112         die "No projver found in $ENV{'PBCONF'}/$proj.pb";
    113     }
    114 }
    115 die "Invalid version name $ENV{'PBVER'} in $ENV{'PBCONF'}/$proj.pb" if (($ENV{'PBVER'} !~ /[0-9.]+/) && (not exists $version{$ENV{'PBVER'}}));
    116 
    117 if (not defined $ENV{'PBTAG'}) {
    118     if ((defined $pkgt) && (defined $pkgt->{$proj})) {
    119         $ENV{'PBTAG'}=$pkgt->{$proj};
    120     } else {
    121         die "No projtag found in $ENV{'PBCONF'}/$proj.pb";
    122     }
    123 }
    124 die "Invalid tag name $ENV{'PBTAG'} in $ENV{'PBCONF'}/$proj.pb" if ($ENV{'PBTAG'} !~ /[0-9.]+/);
    125124
    126125#
     
    183182
    184183print $LOG "$cmt... ";
    185 system("$cmd");
     184system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log");
    186185if ($? == -1) {
    187     print $LOG "failed to execute: $!\n" if ($debug >= 0);
     186    print $LOG "failed to execute ($cmd) : $!\n" if ($debug >= 0);
     187    pb_display_file("$ENV{'PBTMP'}/system.log");
    188188} elsif ($? & 127) {
    189     printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
    190 } else {
     189    printf $LOG "child ($cmd) died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
     190    pb_display_file("$ENV{'PBTMP'}/system.log");
     191} elsif ($? == 0) {
    191192    print $LOG "OK\n" if ($debug >= 0);
    192 }
     193} else {
     194    printf "child ($cmd) exited with value %d\n", $? >> 8;
     195    pb_display_file("$ENV{'PBTMP'}/system.log");
     196}
     197}
     198
     199sub pb_display_file {
     200
     201my $file=shift;
     202
     203open(FILE,"$file") || die "Unable to open $file";
     204while (<FILE>) {
     205    print $LOG;
     206}
     207close(FILE);
    193208}
    194209
     
    260275    $ENV{'PBCMSLOG'}="svn log";
    261276    $ENV{'PBCMSLOGFILE'}="svn.log";
    262     $ENV{'PBCMSEXP'}="svn export";
    263277} elsif ($cms->{$proj} eq "cvs") {
    264     $ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate  -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
    265     chomp($ENV{'PBREVISION'});
     278    # Way too slow
     279    #$ENV{'PBREVISION'}=`(cd "$ENV{'PBROOT'}" ; cvs rannotate  -f . 2>&1 | awk '{print \$1}' | grep -E '^[0-9]' | cut -d. -f2 |sort -nu | tail -1)`;
     280    #chomp($ENV{'PBREVISION'});
     281    $ENV{'PBREVISION'}="CVS";
    266282    $ENV{'PBCMSLOG'}="cvs log";
    267283    $ENV{'PBCMSLOGFILE'}="cvs.log";
    268     $ENV{'PBCMSEXP'}="cvs export";
    269284    #
    270285    # Export content if needed
     
    274289    die "cms $cms->{$proj} unknown";
    275290}
    276 }
     291return($cms);
     292}
     293
     294sub pb_cms_export {
     295my $cms = shift;
     296my $pbdate = shift || undef;
     297my $pkgdir = shift;
     298my $destdir = shift;
     299
     300if ($cms->{$ENV{'PBPROJ'}} eq "svn") {
     301    pb_system("svn export $pkgdir $destdir","Exporting $pkgdir from SVN");
     302} elsif ($cms->{$ENV{'PBPROJ'}} eq "cvs") {
     303    my $dir=dirname($destdir);
     304    my $base=basename($destdir);
     305    my $tmp=basename($pkgdir);
     306    # CVS needs a relative path !
     307    pb_system("cd $dir ; cvs export -D $pbdate -d $base $tmp","Exporting $pkgdir from CVS");
     308} else {
     309    die "cms $cms->{$ENV{'PBPROJ'}} unknown";
     310}
     311}
     312
     313sub pb_cms_log {
     314my $cms = shift;
     315my $pkgdir = shift;
     316my $destfile = shift;
     317
     318if ($cms->{$ENV{'PBPROJ'}} eq "svn") {
     319    pb_system("svn log $pkgdir > $destfile","Extracting log info from SVN");
     320} elsif ($cms->{$ENV{'PBPROJ'}} eq "cvs") {
     321    my $tmp=basename($pkgdir);
     322    # CVS needs a relative path !
     323    pb_system("cvs log $tmp > $destfile","Extracting log info from CVS");
     324} else {
     325    die "cms $cms->{$ENV{'PBPROJ'}} unknown";
     326}
     327}
     328   
     329
    277330
    278331# Get all filters to apply
Note: See TracChangeset for help on using the changeset viewer.