Changeset 29 in ProjectBuilder for devel


Ignore:
Timestamp:
Aug 2, 2007, 12:36:11 AM (17 years ago)
Author:
Bruno Cornec
Message:

Use pbsystem everywhere

Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb.pl

    r28 r29  
    115115        # And generate some additional files
    116116        $OUTPUT_AUTOFLUSH=1;
    117         print $LOG "$ENV{'PBCMSEXP'} of $pbpkg..." if ($debug >= 0);
     117
    118118        # computes in which dir we have to work
    119119        my $dir = $defpkgdir{$pbpkg};
    120120        $dir = $extpkgdir{$pbpkg} if (not defined $dir);
    121         system("$ENV{'PBCMSEXP'} $option $ENV{'PBROOT'}/$dir $dest 1>/dev/null");
    122         if ($? == -1) {
    123             print $LOG "failed to execute: $!\n" if ($debug >= 0);
    124         } elsif ($? & 127) {
    125             printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
    126         } else {
    127             print $LOG " OK\n" if ($debug >= 0);
    128         }
     121        pbsystem("$ENV{'PBCMSEXP'} $option $ENV{'PBROOT'}/$dir $dest 1>/dev/null", "Exporting $ENV{'PBROOT'}/$dir... ");
    129122
    130123        # Creates a REVISION file
     
    134127
    135128        # Extract cms log history and store it
    136         system("$ENV{'PBCMSLOG'} $option $ENV{'PBROOT'}/$dir > $dest/$ENV{'PBCMSLOGFILE'}");
    137         print $LOG "$ENV{'PBCMSLOG'} of $pbpkg..." if ($debug >= 0);
    138         if ($? == -1) {
    139             print $LOG "failed to execute: $!\n" if ($debug >= 0);
    140         } elsif ($? & 127) {
    141             printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
    142         } else {
    143             print $LOG " OK\n" if ($debug >= 0);
    144         }
     129        pbsystem("$ENV{'PBCMSLOG'} $option $ENV{'PBROOT'}/$dir > $dest/$ENV{'PBCMSLOGFILE'}", "Extracting log info... ");
     130
    145131        my %build;
    146132        open(D,"$ENV{'PBCONF'}/DISTROS") || die "Unable to find $ENV{'PBCONF'}/DISTROS\n";
     
    257243        # Prepare the dest directory for archive
    258244        if (-x "$ENV{'PBCONF'}/$pbpkg/pbpkginit") {
    259             print $LOG " Executing $ENV{'PBCONF'}/$pbpkg/pbinit...\n" if ($debug >= 0);
    260             system("cd $dest ; $ENV{'PBCONF'}/$pbpkg/pbinit");
    261             if ($? == -1) {
    262                 print $LOG "failed to execute: $!\n" if ($debug >= 0);
    263             } elsif ($? & 127) {
    264                 printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
    265             } else {
    266                 print $LOG " OK\n" if ($debug >= 0);
    267             }
    268         }
     245            pbsystem("cd $dest ; $ENV{'PBCONF'}/$pbpkg/pbinit","Executing init script $ENV{'PBCONF'}/$pbpkg/pbinit");
     246        }
     247
    269248        # Archive dest dir
    270249        chdir "$ENV{'PBDESTDIR'}";
    271         print $LOG "Creating $pbpkg tar files (gzip... " if ($debug >= 0);
    272250        # Possibility to look at PBSRC to guess more the filename
    273         system("tar cfphz $pbpkg-$pbver.tar.gz $pbpkg-$pbver");
     251        pbsystem("tar cfphz $pbpkg-$pbver.tar.gz $pbpkg-$pbver","Creating $pbpkg tar files (gzip... ");
    274252        if ($? == -1) {
    275253            print $LOG "failed to execute: $!\n" if ($debug >= 0);
     
    332310            foreach my $f (@specfile) {
    333311                if ($f =~ /\.spec$/) {
    334                     print $LOG "rpmbuild -ba $f ...\n";
    335                     system("rpmbuild -ba $f");
     312                    pbsystem("rpmbuild -ba $f","Building package with $f... ");
    336313                    last;
    337314                }
     
    418395my @files;
    419396
    420 print $LOG "Extracting build files... " if ($debug >= 0);
    421 system("tar xfz $src $dir >/dev/null");
    422 if ($? == -1) {
    423     print $LOG "failed to execute: $!\n" if ($debug >= 0);
    424 } elsif ($? & 127) {
    425     printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
    426 } else {
    427     print $LOG " OK\n" if ($debug >= 0);
    428 }
     397pbsystem("tar xfz $src $dir >/dev/null","Extracting build files... ");
    429398opendir(DIR,"$dir") || die "Unable to open directory $dir";
    430399foreach my $f (readdir(DIR)) {
  • devel/pb/lib/common.pm

    r25 r29  
    118118
    119119sub pbmkdir_p {
    120     my @dir = @_;
    121     my $ret = mkpath(@dir, 0, 0755);
    122     return($ret);
     120my @dir = @_;
     121my $ret = mkpath(@dir, 0, 0755);
     122return($ret);
    123123}
    124124
    125125sub pbrm_rf {
    126     my @dir = @_;
    127     my $ret = rmtree(@dir, 0, 0);
    128     return($ret);
     126my @dir = @_;
     127my $ret = rmtree(@dir, 0, 0);
     128return($ret);
    129129}
    130130
     131sub pbsystem {
     132
     133my $cmd=shift;
     134my $cmt=shift || $cmt=$cmd;
     135
     136print $LOG "$cmt ...";
     137system("$cmd");
     138if ($? == -1) {
     139    print $LOG "failed to execute: $!\n" if ($debug >= 0);
     140} elsif ($? & 127) {
     141    printf $LOG "child died with signal %d, %s coredump\n", ($? & 127),  ($? & 128) ? 'with' : 'without' if ($debug >= 0);
     142} else {
     143    print $LOG " OK\n" if ($debug >= 0);
     144}
    1311451;
Note: See TracChangeset for help on using the changeset viewer.