Changeset 2491 in ProjectBuilder


Ignore:
Timestamp:
Mar 31, 2020, 11:26:06 AM (4 years ago)
Author:
Bruno Cornec
Message:

Various perf improvements

  • Avoid managing full changelog files when in testver
  • Avoid loading a conf file in cache already handled
  • set_waitpid_blocking_sleep(0)
  • Use YAML::XS if available
Location:
devel
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2488 r2491  
    210210} else {
    211211    eval {
    212         require YAML;
    213         YAML->import();
     212        require YAML::XS;
     213        YAML::XS->import();
    214214    };
    215215    if ($@) {
    216216        eval {
    217             # No YAML found using a more std but less complete one. Old perl only
    218             require Module::Build::YAML;
    219             Module::Build::YAML->import();
     217            require YAML;
     218            YAML->import();
    220219        };
    221220        if ($@) {
    222221            eval {
    223222                # No YAML found using a more std but less complete one. Old perl only
    224                 require YAML::Tiny;
    225                 YAML::Tiny->import();
     223                require Module::Build::YAML;
     224                Module::Build::YAML->import();
    226225            };
    227226            if ($@) {
    228227                eval {
    229                     # No YAML found using an embedded pne
    230                     require ProjectBuilder::YAML;
    231                     ProjectBuilder::YAML->import();
     228                    # No YAML found using a more std but less complete one. Old perl only
     229                    require YAML::Tiny;
     230                    YAML::Tiny->import();
    232231                };
    233232                if ($@) {
    234                     # Here we should be in the setup phase, with an embedded YAML code
    235                     $ldfunc = \&LoadFile;
    236                     #die "Unable to handle YAML configuration files without a YAML.pm module\n";
     233                    eval {
     234                        # No YAML found using an embedded pne
     235                        require ProjectBuilder::YAML;
     236                        ProjectBuilder::YAML->import();
     237                    };
     238                    if ($@) {
     239                        # Here we should be in the setup phase, with an embedded YAML code
     240                        $ldfunc = \&LoadFile;
     241                        #die "Unable to handle YAML configuration files without a YAML.pm module\n";
     242                    } else {
     243                        $ldfunc = \&ProjectBuilder::YAML::LoadFile;
     244                    }
    237245                } else {
    238                     $ldfunc = \&ProjectBuilder::YAML::LoadFile;
     246                    $ldfunc = \&YAML::Tiny::LoadFile;
    239247                }
    240248            } else {
    241                 $ldfunc = \&YAML::Tiny::LoadFile;
     249                $ldfunc = \&Module::Build::YAML::LoadFile;
    242250            }
    243251        } else {
    244             $ldfunc = \&Module::Build::YAML::LoadFile;
    245         }
     252            $ldfunc = \&YAML::LoadFile;
    246253    } else {
    247         $ldfunc = \&YAML::LoadFile;
    248     }
     254        $ldfunc = \&YAML::XS::LoadFile;
     255    }
     256
     257    # Have we already handled that conf file ?
     258    next if ($lh->{'__cf'}->{$cf} eq 1);
    249259
    250260    pb_log(1,"Loading YAML conf file $cf\n");
     
    265275        }
    266276    }
     277    # Remember we've seen that conf file
     278    $lh->{'__cf'}->{$cf} = 1;
    267279}
    268280return($lh);
     
    277289sub pb_conf_add {
    278290
    279 pb_log(2,"DEBUG: pb_conf_add with ".Dumper(@_)."\n");
    280291my $lh;
    281292
     
    288299    return($lh) if (defined $pbconffiles{$cf});
    289300   
     301    pb_log(2,"DEBUG: pb_conf_add with $cf\n");
    290302    # The new conf file overload values already managed
    291303    my $num = keys %pbconffiles;
  • devel/pb/bin/pb

    r2488 r2491  
    13181318            # Try to use // processing here
    13191319            my $all_ok = 1;
    1320             my $pm = new Parallel::ForkManager($pbparallel) if (defined $pbparallel);
    1321             $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
    1322                                     $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0)); }) if (defined $pbparallel);
     1320            my $pm;
     1321            if (defined $pbparallel) {
     1322                $pm = new Parallel::ForkManager($pbparallel);
     1323                $pm->set_waitpid_blocking_sleep(0);
     1324                $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
     1325                                    $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0)); });
     1326            }
    13231327
    13241328            pb_log(0,"Preparing delivery ...\n");
     
    17361740    if (defined $pbparallel) {
    17371741        $pm = new Parallel::ForkManager($pbparallel);
     1742        $pm->set_waitpid_blocking_sleep(0);
    17381743        $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
    17391744                                $all_ok = 0 unless (($code == 0) && ($signal == 0) && ($dump == 0)); });
     
    31173122if (defined $pbparallel) {
    31183123    $pm = new Parallel::ForkManager($pbparallel);
     3124    $pm->set_waitpid_blocking_sleep(0);
    31193125
    31203126    # Set which port the VM/RM will use to communicate
     
    34753481if (defined $pbparallel) {
    34763482    $pm = new Parallel::ForkManager($pbparallel);
     3483    $pm->set_waitpid_blocking_sleep(0);
    34773484
    34783485    # Set which port the VM/RM will use to communicate
     
    38123819if (defined $pbparallel) {
    38133820    $pm = new Parallel::ForkManager($pbparallel);
     3821    $pm->set_waitpid_blocking_sleep(0);
    38143822
    38153823    # Set which port the VM/RM will use to communicate
     
    44034411if (defined $pbparallel) {
    44044412    $pm = new Parallel::ForkManager($pbparallel);
     4413    $pm->set_waitpid_blocking_sleep(0);
    44054414
    44064415    $pm->run_on_finish(sub { my ($pid, $code, $id, $signal, $dump) = @_;
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r2488 r2491  
    104104my @date = pb_get_date();
    105105# If we don't need to do it, or don't have it fake something
    106 if (((not defined $chglog) || (! -f $chglog)) && ($doit ne "yes")) {
     106if (((not defined $chglog) || (! -f $chglog)) || ($doit ne "yes")) {
    107107    pb_log(2,"No ChangeLog file for $pbrealpkg - faking one\n");
    108108    $date = strftime("%Y-%m-%d", @date);
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r2488 r2491  
    118118            local $_ = $ptr->{$in_key} || '';
    119119            eval $expr;
    120             die "Error evaluating tranform for $out_key ($expr): $@" if $@;
     120            die "Error evaluating transform for $out_key ($expr): $@" if $@;
    121121            $ptr->{$out_key} = $_;
    122122            pb_log(2, "Transform $in_key to $out_key\n$ptr->{$in_key}\n$ptr->{$out_key}\n");
     
    186186            # special case for ChangeLog only for pb
    187187            pb_log(3,"DEBUG filtering PBLOG\n");
     188            my ($testver) = pb_conf_get_if("testver");
     189            $tmp = "no" if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i));
    188190            pb_changelog($pb, \*DEST, $tmp);
    189191            $tmp = "";
Note: See TracChangeset for help on using the changeset viewer.