Changeset 1126 in ProjectBuilder


Ignore:
Timestamp:
Dec 13, 2010, 2:53:10 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Use potentially Sys::CPU if present to determine number of cores (1 by default)
  • Adds a conf param to force number of cores (pbparallel)
  • Adds doc for pbparallel, oscmd, oscmdopt
Location:
devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1123 r1126  
    445445oscmd rpmbootstrap = rpm,rpm2cpio,wget
    446446#oscmdopt rpmbootstrap =
     447
     448# Number of process in // for pb
     449#pbparallel pb = 2
     450
    447451#
    448452# Commands to check packages
  • devel/pb-modules/etc/pb.conf.pod

    r1117 r1126  
    8686 Conffile: pb
    8787 Example: oschkcmd rpm = -i
     88
     89=item B<oscmd>
     90
     91 Nature: Mandatory
     92 Key: tool (pb or rpmbootstrap)
     93 Value: come separated list of commands that are mandatory on the underlying system
     94 Conffile: pb
     95 Example: oscmd pb = tar,ls
     96
     97=item B<oscmdopt>
     98
     99 Nature: Mandatory
     100 Key: tool (pb or rpmbootstrap)
     101 Value: come separated list of commands that are optional on the underlying system
     102 Conffile: pb
     103 Example: oscmd pb = svn2cl,svn,cvs
    88104
    89105=item B<oscodename>
     
    246262 Conffile: project
    247263 Example: pbpackager pb = Bruno Cornec <bruno@project-builder.org>
     264
     265=item B<pbparallel>
     266
     267 Nature: Optional
     268 Key: tool (pb or rpmbootstrap)
     269 Value: number of processes to execute in parallel. By default use the number of cores.
     270 Conffile: pb
     271 Example: pbparallel pb = 12
    248272
    249273=item B<pbpkg>
  • devel/pb/bin/pb

    r1125 r1126  
    498498# Check for command requirements
    499499#
    500 my ($req,$opt) = pb_conf_get_if("oscmd","oscmdopt");
     500my ($req,$opt,$pbpara) = pb_conf_get_if("oscmd","oscmdopt","pbparallel");
    501501my ($req2,$opt2) = (undef,undef);
    502502$req2 = $req->{$appname} if (defined $req);
     
    507507# Check if we can launch some actions in // with Parallel::ForkManager
    508508#
    509 my $pbparallel = 12;
     509my $pbparallel = $pbpara->{$appname} if (defined $pbpara);
     510if (not defined $pbparallel) {
     511    eval
     512    {
     513        require Sys::CPU;
     514        Sys::CPU->import();
     515    };
     516    if ($@) {
     517        # Sys::CPU not found, defaulting to 1
     518        $pbparallel = 1;
     519    } else {
     520        # Using the number of cores
     521        $pbparallel = Sys::CPU::cpu_count();
     522    }
     523}
     524
    510525eval
    511526{
Note: See TracChangeset for help on using the changeset viewer.