Changeset 2426 in ProjectBuilder for devel/pb-modules/lib/ProjectBuilder/Distribution.pm
- Timestamp:
- Sep 1, 2019, 3:18:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r2410 r2426 69 69 =over 4 70 70 71 =item B<pb_distro_ conffile>72 73 This function returns the mandatory configuration file used for distribution/OS detection71 =item B<pb_distro_api> 72 73 This function returns the mandatory configuration file used for api 74 74 75 75 =cut … … 605 605 606 606 pb_log(3, "INFO: Adding osrepo from config file\n"); 607 return(pb_distro_setuprepo_gen_conf($pbos,pb_distro_conffile(),"osrepo")); 607 my %h; 608 my $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); 611 my ($osrepo) = pb_conf_get_in_hash_if($h,"osrepo"); 612 return(pb_distro_setuprepo_gen($pbos,$osrepo->{$ENV{'PBPROJ'}})); 608 613 } 609 614 610 615 =item B<pb_distro_setuprepo> 611 616 612 This function sets up potential additional repository to the build environment617 This function sets up potential additional repository to the build/install/test environment 613 618 614 619 =cut … … 617 622 618 623 my $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 624 my $repotype = shift; 625 626 my %h; 627 my $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 632 pb_log(3, "INFO: Adding addrepo from config file for $repotype\n"); 633 if ($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 } 647 667 648 668 =item B<pb_distro_setuprepo_gen>
Note:
See TracChangeset
for help on using the changeset viewer.