Changeset 2468


Ignore:
Timestamp:
Jan 20, 2020, 2:12:55 AM (5 weeks ago)
Author:
Bruno Cornec
Message:

Fix #180 by adding the pb_check_v function

Location:
devel
Files:
2 edited

Legend:

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

    r2465 r2468  
    681681    }
    682682}
    683 pb_log(1, "INFO: Adding $repo from config file for $repotype step\n");
     683pb_log(1, "INFO: Adding $repo from config file for $repotype step\n") if (defined $repo);
    684684return(pb_distro_setuprepo_gen($pbos,$repo));
    685685}
  • devel/pb/bin/pb

    r2466 r2468  
    26942694                $origimage = "$tag{$pbstep}";
    26952695            }
    2696             cluck "No image $tag{$pbstep} available in Docker, please create one first\n" if (not defined $found);
     2696            confess "No image $tag{$pbstep} available in Docker, please create one first\n" if ((not defined $found) && ($pbstep <= 3));
    26972697            # Now we use that image to do what is needed
    26982698            # use a dockerfile to ease the creation of next images
     
    34583458pb_log(1,"Entering in pb_build2v ($action in $vtype) \n");
    34593459
    3460 # We prepare scripts for all V of this vtype to allow sharing that part
    3461 my ($v,$all) = pb_get2v($vtype);
     3460my ($v,$all) = ("", 0);
     3461# Determine on which V to work
     3462if (defined $ENV{'PBV'}) {
     3463    @$v = split(/,/,$ENV{'PBV'});
     3464} else {
     3465    ($v,$all) = pb_get2v($vtype);
     3466}
    34623467
    34633468# Send tar files when we do a global generation
     
    34863491my $counter = 0;
    34873492foreach my $v (@$v) {
     3493    # Check that this VE/VM is in the list of systems for which we build
     3494    if (($action eq "build") || ($action eq "prep")) {
     3495        pb_check_v($v,$vtype);
     3496    }
    34883497    $counter++;
    34893498    $pbscript{$v} = "$ENV{'PBDESTDIR'}/pb$action-$v";
     
    37463755}
    37473756
     3757# Return the list of all VMs/VEs/RMs we are working on through the content of v(e|m)list
     3758# in conf file
     3759
     3760sub pb_get_allv {
     3761
     3762my $vtype = shift;
     3763my $vlist = $vtype."list";
     3764
     3765my ($ptr) = pb_conf_get($vlist);
     3766my @v = split(/,/,$ptr->{$ENV{'PBPROJ'}});
     3767return(\@v);
     3768}
     3769
    37483770#
    37493771# Return the list of VMs/VEs/RMs we are working on
    37503772# $all is a flag to know if we return all of them
    3751 # or only some (if all we publish also tar files in addition to pkgs
     3773# or only some (if all we publish also tar files in addition to pkgs)
    37523774#
    37533775sub pb_get2v {
     
    37693791return(\@v,$all);
    37703792}
    3771 
    37723793# This function creates a giant script to configure a particular VM/VE/RM, it then copies the
    37733794# script to the target.
     
    38033824my $counter = 0;
    38043825foreach my $v (@$vm) {
     3826    # Verify that this V is in our list
     3827    pb_check_v($v,$vtype);
     3828   
    38053829    # Script generated - should be before the fork - after the %pbscript hash isn't updated correctly
    38063830    $pbscript{$v} = "$ENV{'PBDESTDIR'}/setupv-$v";
     
    43954419    $pm->start($counter) and next if (defined $pbparallel);
    43964420
    4397     my $done = 0;
    43984421    my $lmsg = "";
    43994422    my $lctn = "";
     
    44084431        # pb -p pb -m distro-ver-arch newve -i distro:ver
    44094432        ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found";
    4410         pb_log(0,"Docker image $lctn $lmsg, creating it\n");
     4433        pb_log(0,"INFO: Docker image $lctn $lmsg, creating it\n");
    44114434        pb_launchv(undef,"ve",$v,$action,0,$pbforce,undef,undef,$pbimage);
    44124435    }
     
    44174440    if (($pbforce == 1) || (not defined $found)) {
    44184441        ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found";
    4419         pb_log(0,"Docker image $lctn $lmsg, creating it\n");
     4442        pb_log(0,"INFO: Docker image $lctn $lmsg, creating it\n");
    44204443        # pb -p pb -m distro-ver-arch setupve
     4444        pb_log(2,"Using savproj: $savproj\n");
    44214445        if ($savproj eq "pb") {
    4422             pb_cms2build("SandBox") if ($action !~ /sbx2/);
    4423             $done = 1;
     4446            pb_cms2build("SandBox") if ($action =~ /sbx2/);
    44244447            pb_setup2v("ve","SandBox");
    44254448        } else {
     
    44344457    if (($pbforce == 1) || (not defined $found)) {
    44354458        ($pbforce == 1) ? $lmsg = "Forced" : $lmsg = "not found";
    4436         pb_log(0,"Docker image $lctn $lmsg, creating it\n");
    4437         # pb -p pb -m distro-ver-arch prepve
    4438         if ($savproj eq "pb") {
    4439             pb_cms2build("SandBox") if ($action !~ /sbx2/);
    4440             $done = 1;
    4441         }
     4459        pb_log(0,"INFO: Docker image $lctn $lmsg, creating it\n");
     4460        # pb -p proj -m distro-ver-arch prepve
    44424461        pb_build2v("ve","prep");
    44434462    }
    4444     pb_log(0,"Instantiating a Docker container from $lctn\n");
    4445     if (($savproj ne "pb") || ($done == 0)) {
    4446         pb_cms2build("SandBox") if ($action !~ /sbx2/);
    4447     }
     4463    pb_log(0,"INFO: Instantiating a Docker container from $lctn\n");
    44484464    pb_build2v("ve","build");
    44494465    $pm->finish if (defined $pbparallel);
     
    55095525}
    55105526
     5527sub pb_check_v {
     5528
     5529my $v = shift;
     5530my $vtype = shift;
     5531
     5532my ($v2,$all2) = pb_get_allv($vtype);
     5533pb_log(1,"INFO: velist is:\n");
     5534pb_log(1,Dumper(@$v2));
     5535my $foundv = 0;
     5536foreach my $v3 (@$v2) {
     5537    pb_log(1,"INFO: looking at **$v3** in $vtype"."list\n");
     5538    if ($v3 eq $v) {
     5539        $foundv = 1;
     5540        last;
     5541    }
     5542}
     5543confess("Building for $v, however it's not part of the $vtype"."list parameter. Aborting") if ($foundv == 0);
     5544pb_log(1,"INFO: $v is in $vtype"."list\n");
     5545return;
     5546}
     5547
     5548
    551155491;
Note: See TracChangeset for help on using the changeset viewer.