Changeset 108 in ProjectBuilder for devel/pb/lib/ProjectBuilder


Ignore:
Timestamp:
Sep 6, 2007, 2:18:18 AM (17 years ago)
Author:
Bruno Cornec
Message:

Lots of changes to prepare the dev of the VMs support.
No more global variables
Support $ENV{'HOME'} in pbrc for pbrc keyword (allows portability across accounts and share of .pbrc)
Fixes on pb_cms_export for SVN in order to be called externally
pn_env_init retunrs now a lot of params in a list
pb_get_pkg needs params and is simplified by consequence
pbinit is called with a simple system. pb_system has isues with cascading stdout/stderr redirections
pb_send2ssh now supports sending to VM + launch of a pbscript if it exists and it should bring back packages from VM in the future and it now supports more parameters.

Location:
devel/pb/lib/ProjectBuilder
Files:
3 edited

Legend:

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

    r107 r108  
    4444print "DEBUG pbrc: ".Dumper($pbrc)."\n" if ($debug >= 1);
    4545
    46 %pbrc = %$pbrc;
     46my %pbrc = %$pbrc;
    4747if (not defined $proj) {
    4848    # Take the first as the default project
     
    5656#
    5757my $topdir=dirname($pbrc{$proj});
     58# Expand potential env variable in it
     59eval { $topdir =~ s/(\$ENV.+\})/$1/eeg };
    5860chdir $topdir || die "Unable to change directory to $topdir";
     61$pbrc{$proj} = $topdir."/pbrc";
    5962$ENV{'PBDESTDIR'}=$topdir."/delivery";
    6063
     
    8083
    8184my %version = ();
     85my %defpkgdir = ();
     86my %extpkgdir = ();
     87my %filteredfiles = ();
    8288
    8389if (-f "$ENV{'PBCONF'}/$proj.pb") {
     
    95101    %defpkgdir = %$defpkgdir;
    96102    # Global
    97     %extpkgdir = ();
    98103    %extpkgdir = %$defpkgdir if (defined $defpkgdir);
    99     %version = ();
    100104    %version = %$version if (defined $version);
    101105    # Global
    102     %filteredfiles = ();
    103106    %filteredfiles = %$filteredfiles if (defined $filteredfiles);
    104107    #
     
    185188my $cmt=shift || $cmd;
    186189
    187 print $LOG "$cmt... ";
     190print "$cmt... ";
    188191system("$cmd 2>&1 > $ENV{'PBTMP'}/system.log");
    189192if ($? == -1) {
    190     print $LOG "failed to execute ($cmd) : $!\n" if ($debug >= 0);
     193    print "failed to execute ($cmd) : $!\n";
    191194    pb_display_file("$ENV{'PBTMP'}/system.log");
    192195} elsif ($? & 127) {
    193     printf $LOG "child ($cmd) died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
     196    printf "child ($cmd) died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without';
    194197    pb_display_file("$ENV{'PBTMP'}/system.log");
    195198} elsif ($? == 0) {
    196     print $LOG "OK\n" if ($debug >= 0);
     199    print "OK\n";
    197200} else {
    198201    printf "child ($cmd) exited with value %d\n", $? >> 8;
     
    207210open(FILE,"$file") || die "Unable to open $file";
    208211while (<FILE>) {
    209     print $LOG;
     212    print $_;
    210213}
    211214close(FILE);
     
    227230    die "No $param[$i] defined for $ENV{'PBPROJ'}" if (not defined $p->{$ENV{'PBPROJ'}});
    228231}
    229 print "DEBUG: param: ".Dumper(@ptr)."\n" if ($debug >= 1);
     232#print "DEBUG: param: ".Dumper(@ptr)."\n" if ($debug >= 1);
    230233return(@ptr);
    231234}
     
    239242my $trace;
    240243my @ptr;
     244
     245my $debug = 0;
    241246
    242247if ($debug > 0) {
     
    299304my $cms = shift;
    300305my $pbdate = shift || undef;
    301 my $pkgdir = shift;
     306my $source = shift;
    302307my $destdir = shift;
     308my $tmp;
    303309
    304310if ($cms->{$ENV{'PBPROJ'}} eq "svn") {
    305     pb_system("svn export $pkgdir $destdir","Exporting $pkgdir from SVN");
     311    if (-d $source) {
     312        $tmp = $destdir;
     313    } else {
     314        $tmp = $destdir."/".basename($source);
     315    }
     316    pb_system("svn export $source $tmp","Exporting $source from SVN");
    306317} elsif ($cms->{$ENV{'PBPROJ'}} eq "cvs") {
    307318    my $dir=dirname($destdir);
    308319    my $base=basename($destdir);
    309     my $tmp=basename($pkgdir);
     320    # Doesn't work if called from outside with a full path name to a file/dir to export
     321    $tmp=basename($source);
    310322    # CVS needs a relative path !
    311     pb_system("cd $dir ; cvs export -D $pbdate -d $base $tmp","Exporting $pkgdir from CVS");
     323    pb_system("cd $dir ; cvs export -D $pbdate -d $base $tmp","Exporting $source from CVS");
    312324} else {
    313325    die "cms $cms->{$ENV{'PBPROJ'}} unknown";
     
    338350
    339351sub pb_get_filters {
     352
     353# For the moment not dynamic
     354my $debug = 0;                  # Debug level
     355my $LOG = *STDOUT;              # Where to log
    340356
    341357my @ffiles;
     
    397413my $pbrev=shift;
    398414my $pbdate=shift;
     415my $defpkgdir = shift;
     416my $extpkgdir = shift;
     417
     418# For the moment not dynamic
     419my $debug = 0;                  # Debug level
     420my $LOG = *STDOUT;              # Where to log
    399421
    400422print $LOG "DEBUG: From $f to $destfile\n" if ($debug >= 1);
     
    416438        } elsif (($tmp =~ /^yes$/) && ($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) {
    417439            $tmp = "";
    418             my $p = $defpkgdir{$pbpkg};
    419             $p = $extpkgdir{$pbpkg} if (not defined $p);
     440            my $p = $defpkgdir->{$pbpkg};
     441            $p = $extpkgdir->{$pbpkg} if (not defined $p);
    420442            pb_changelog($dtype, $pbpkg, $pbtag, $pbsuf, $p, \*DEST);
    421443        }
     
    441463my $pbrev=shift;
    442464my $pbdate=shift;
     465
     466# For the moment not dynamic
     467my $debug = 0;                  # Debug level
     468my $LOG = *STDOUT;              # Where to log
    443469
    444470print $LOG "DEBUG: From $f to $destfile\n" if ($debug >= 1);
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r89 r108  
    3535my $chglog = "$ENV{'PBROOT'}/$path/ChangeLog";
    3636if (! -f $chglog) {
    37     print "Unable to find the ChangeLog file ($chglog) for $pkg\n" if ($debug >= 0);
     37    print "No ChangeLog file ($chglog) for $pkg\n";
    3838    return("\n");
    3939}
  • devel/pb/lib/ProjectBuilder/Distribution.pm

    r74 r108  
    194194        my $found = 0;
    195195        my $ptr = $distro_similar{$d};
    196         print $LOG "amb: ".Dumper($ptr)."\n" if ($debug >= 1);
     196        #print $LOG "amb: ".Dumper($ptr)."\n" if ($debug >= 1);
    197197        $release = "unknown";
    198198        foreach my $dd (@$ptr) {
    199             print $LOG "check $dd\n" if ($debug >= 1);
     199            #print $LOG "check $dd\n" if ($debug >= 1);
    200200            # Try to check pattern
    201201            if (defined $distro_match{$dd}) {
    202                 print $LOG "cmp: $distro_match{$dd} - vs - $tmp\n" if ($debug >= 1);
     202                #print $LOG "cmp: $distro_match{$dd} - vs - $tmp\n" if ($debug >= 1);
    203203                ($release) = $tmp =~ m/$distro_match{$dd}/m;
    204204                if ((defined $release) && ($release ne "unknown")) {
Note: See TracChangeset for help on using the changeset viewer.