Ignore:
Timestamp:
Sep 1, 2019, 3:18:34 AM (5 years ago)
Author:
Bruno Cornec
Message:

Start adding install and test target for pb - local install works already

File:
1 edited

Legend:

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

    r2410 r2426  
    6969=over 4
    7070
    71 =item B<pb_distro_conffile>
    72 
    73 This function returns the mandatory configuration file used for distribution/OS detection
     71=item B<pb_distro_api>
     72
     73This function returns the mandatory configuration file used for api
    7474
    7575=cut
     
    605605
    606606pb_log(3, "INFO: Adding osrepo from config file\n");
    607 return(pb_distro_setuprepo_gen_conf($pbos,pb_distro_conffile(),"osrepo"));
     607my %h;
     608my $h = \%h;
     609# Adds conf file for availability of conf elements either from the local build env or from a VE/VM/RM in which the conf file has been passed
     610$h = pb_conf_cache(pb_distro_conffile(),$h);
     611my ($osrepo) = pb_conf_get_in_hash_if($h,"osrepo");
     612return(pb_distro_setuprepo_gen($pbos,$osrepo->{$ENV{'PBPROJ'}}));
    608613}
    609614
    610615=item B<pb_distro_setuprepo>
    611616
    612 This function sets up potential additional repository to the build environment
     617This function sets up potential additional repository to the build/install/test environment
    613618
    614619=cut
     
    617622
    618623my $pbos = shift;
    619 
    620 pb_log(3, "INFO: Adding addrepo from config file\n");
    621 return(pb_distro_setuprepo_gen_conf($pbos,"$ENV{'PBDESTDIR'}/pbrc.yml","addrepo"));
    622 }
    623 =item B<pb_distro_setuprepo_gen_conf>
    624 
    625 This function sets up in a generic way potential additional repository using conf files
    626 
    627 =cut
    628 
    629 sub pb_distro_setuprepo_gen_conf {
    630 
    631 my $pbos = shift;
    632 my $pbconf = shift;
    633 my $pbkey = shift;
    634 
    635 return undef if (not defined $pbconf);
    636 return undef if (not defined $pbkey);
    637 my ($addrepo) = pb_conf_read($pbconf,$pbkey);
    638 return undef if (not defined $addrepo);
    639 
    640 my $param = pb_distro_get_param($pbos,$addrepo);
    641 return undef if ($param eq "");
    642 
    643 pb_log(1, "INFO: Adding repos $param\n");
    644 return(pb_distro_setuprepo_gen($pbos,$param));
    645 }
    646 
     624my $repotype = shift;
     625
     626my %h;
     627my $h = \%h;
     628# Adds conf file for availability of conf elements either from the local build env or from a VE/VM/RM in which the conf file has been passed
     629$h = pb_conf_cache("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml",$h) if ((defined $ENV{'PBROOTDIR'}) && (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.yml"));
     630$h = pb_conf_cache("$ENV{'PBDESTDIR'}/pbrc.yml",$h) if ((defined $ENV{'PBDESTDIR'}) && (-f "$ENV{'PBDESTDIR'}/pbrc.yml"));
     631
     632pb_log(3, "INFO: Adding addrepo from config file for $repotype\n");
     633if ($repotype =~ /install/) {
     634    # Give a probable default if nothing is provided to avoid overloading conf files
     635    #
     636    my ($addrepo) = pb_conf_get_in_hash_if($h,"addinstallrepo");
     637    if ((not defined $addrepo) || (not defined $addrepo->{$ENV{'PBPROJ'}})) {
     638        my ($pbrepo) = pb_conf_get_in_hash_if($h,"pbrepo");
     639        return undef if (not defined $pbrepo);
     640        my $url = "$pbrepo->{$ENV{'PBPROJ'}}";
     641        my ($testver,$delivery) = pb_conf_get_in_hash_if($h,"testver","delivery");
     642        $delivery->{$ENV{'PBPROJ'}} = "" if (not defined $delivery->{$ENV{'PBPROJ'}});
     643        $url .= "/$delivery->{$ENV{'PBPROJ'}}/";
     644        my $repotag = "";
     645        $repotag = "-$delivery->{$ENV{'PBPROJ'}}" if ($delivery->{$ENV{'PBPROJ'}} ne "");
     646        $url .= "/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/$ENV{PBPROJ}$repotag.";
     647        my $ext = "";
     648        if ($pbos->{'type'} eq "rpm") {
     649            $ext = "repo";
     650            if ($pbos->{'family'} eq "md") {
     651                $ext = "addmedia";
     652            }
     653        } elsif ($pbos->{'type'} eq "deb") {
     654            $ext = ".sources.list";
     655        }
     656        $url .= $ext;
     657        return(pb_distro_setuprepo_gen($pbos,$url));
     658    } else {
     659        my ($addrepo) = pb_conf_get_in_hash_if($h,"addinstallrepo");
     660        return(pb_distro_setuprepo_gen($pbos,$addrepo->{$ENV{'PBPROJ'}}));
     661    }
     662} else {
     663    my ($addrepo) = pb_conf_get_in_hash_if($h,"add".$repotype."repo");
     664    return(pb_distro_setuprepo_gen($pbos,$addrepo->{$ENV{'PBPROJ'}}));
     665}
     666}
    647667
    648668=item B<pb_distro_setuprepo_gen>
Note: See TracChangeset for help on using the changeset viewer.