Changeset 106


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

Lots of various fixes for CVS support with LinuxCOE

Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r105 r106  
    2929use ProjectBuilder::Changelog qw (pb_changelog);
    3030use ProjectBuilder::Version qw (pb_version_init);
    31 use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb);
     31use ProjectBuilder::Base qw (pb_conf_read pb_conf_get pb_cms_init pb_mkdir_p pb_system pb_rm_rf pb_get_filters pb_filter_file pb_filter_file_pb pb_cms_export pb_cms_log);
    3232
    3333my %opts;                   # CLI Options
     
    117117    pb_build2ssh();
    118118    pb_pkg2ssh();
     119} elsif ($action =~ /^clean$/) {
    119120} else {
    120121    print $LOG "'$action' is not available\n";
     
    126127    my $ptr = pb_get_pkg();
    127128    @pkgs = @$ptr;
    128     pb_cms_init($ENV{'PBPROJ'});
     129    my $cms=pb_cms_init($ENV{'PBPROJ'},$pbdate);
    129130
    130131    my ($pkgv, $pkgt) = pb_conf_read("$ENV{'PBCONF'}/$ENV{'PBPROJ'}.pb","pkgver","pkgtag");
     
    156157        my $dir = $defpkgdir{$pbpkg};
    157158        $dir = $extpkgdir{$pbpkg} if (not defined $dir);
    158         pb_system("$ENV{'PBCMSEXP'} $option $ENV{'PBROOT'}/$dir $dest 1>/dev/null", "Exporting $ENV{'PBROOT'}/$dir");
    159 
    160         # Creates a REVISION file
    161         open(R,"> $dest/REVISION") || die "Unable to create $dest/REVISION";
    162         print R "$pbrev\n";
    163         close(R);
     159        pb_cms_export($cms,$pbdate,"$ENV{'PBROOT'}/$dir",$dest);
    164160
    165161        # Extract cms log history and store it
    166         pb_system("$ENV{'PBCMSLOG'} $option $ENV{'PBROOT'}/$dir > $dest/$ENV{'PBCMSLOGFILE'}", "Extracting log info");
     162        pb_cms_log($cms,"$ENV{'PBROOT'}/$dir","$dest/$ENV{'PBCMSLOGFILE'}");
    167163
    168164        my %build;
     
    402398    }
    403399    $src = join(' ',@src);
    404     pb_system("ssh -q $mac \"mkdir -p $dir ; cd $dir ; rm -f $src\" 2>/dev/null","Preparing $dir on $mac");
     400    pb_system("ssh -q $mac \"mkdir -p $dir ; cd $dir ; rm -f $src\"","Preparing $dir on $mac");
    405401    pb_system("scp -p $src $mac:$dir","$cmt delivery in $dir on $mac");
    406402}
     
    408404sub pb_build2vm {
    409405    my ($vm,$all) = pb_get_vm();
     406
     407    # Send tar files when we do a global generation
     408    pb_build2ssh() if ($all == 1);
    410409}
    411410
     
    460459my @files;
    461460
    462 pb_system("tar xfpz $src $dir >/dev/null","Extracting build files");
     461pb_system("tar xfpz $src $dir","Extracting build files");
    463462opendir(DIR,"$dir") || die "Unable to open directory $dir";
    464463foreach my $f (readdir(DIR)) {
  • 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.