- Timestamp:
- Sep 1, 2019, 6:16:11 PM (6 years ago)
- Location:
- devel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/lib/ProjectBuilder/Distribution.pm
r2426 r2427 33 33 34 34 our @ISA = qw(Exporter); 35 our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_sysconffile pb_distro_api pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_ getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_setuprepo_gen pb_distro_get_param pb_distro_get_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy);35 our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_sysconffile pb_distro_api pb_distro_get pb_distro_getlsb pb_distro_installdeps pb_distro_installpkgs pb_distro_getdeps pb_distro_only_deps_needed pb_distro_setuprepo pb_distro_setuposrepo pb_distro_setuprepo_gen pb_distro_get_param pb_distro_get_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy); 36 36 ($VERSION,$REVISION,$PBCONFVER) = pb_version_init(); 37 37 … … 370 370 } 371 371 372 =item B<pb_distro_installpkgs> 373 374 This function install the packages passed as parameters on a distribution. 375 376 =cut 377 378 sub pb_distro_installpkgs { 379 380 my $pbos = shift; 381 my $pkgs = shift; # list of pkgs to install 382 my $local = shift; # optional should we install local packages or remote (for deb command is different) 383 384 # Protection 385 confess "Missing install command for $pbos->{name}-$pbos->{version}-$pbos->{arch}" unless (defined $pbos->{install} && $pbos->{install} =~ /\w/); 386 pb_apply_conf_proxy($pbos); 387 pb_log(1, "ftp_proxy=$ENV{'ftp_proxy'}\n") if (defined $ENV{'ftp_proxy'}); 388 pb_log(1, "http_proxy=$ENV{'http_proxy'}\n") if (defined $ENV{'http_proxy'}); 389 pb_log(1, "https_proxy=$ENV{'https_proxy'}\n") if (defined $ENV{'https_proxy'}); 390 391 # This may not be // proof. We should test for availability of repo and sleep if not 392 my $cmd = "$pbos->{'install'} $pkgs"; 393 $cmd = "$pbos->{'localinstall'} $pkgs" if ((defined $local) && (defined $pbos->{'localinstall'}) && ($pbos->{'localinstall'} !~ /[ ]*/)); 394 my $ret = pb_system($cmd, "Installing packages ($cmd)","mayfail"); 395 # Try to accomodate deficient proxies 396 if ($ret != 0) { 397 $ret = pb_system($cmd, "Re-trying installing packages ($cmd)"); 398 } 399 confess "Some packages did not install" if (($ret != 0) && ($Global::pb_stop_on_error)); 400 } 401 402 372 403 =item B<pb_distro_installdeps> 373 404 … … 388 419 my $local = shift; # optional should we install local packages or remote (for deb command is different) 389 420 390 # Protection391 confess "Missing install command for $pbos->{name}-$pbos->{version}-$pbos->{arch}" unless (defined $pbos->{install} && $pbos->{install} =~ /\w/);392 pb_apply_conf_proxy($pbos);393 pb_log(1, "ftp_proxy=$ENV{'ftp_proxy'}\n") if (defined $ENV{'ftp_proxy'});394 pb_log(1, "http_proxy=$ENV{'http_proxy'}\n") if (defined $ENV{'http_proxy'});395 pb_log(1, "https_proxy=$ENV{'https_proxy'}\n") if (defined $ENV{'https_proxy'});396 397 421 # Get dependencies in the build file if not forced 398 422 $deps = pb_distro_getdeps($f,$pbos, $forcerepo) if ((not defined $deps) || (defined $forcerepo)); … … 400 424 return if ((not defined $deps) || ($deps =~ /^\s*$/)); 401 425 402 # This may not be // proof. We should test for availability of repo and sleep if not 403 my $cmd = "$pbos->{'install'} $deps"; 404 $cmd = "$pbos->{'localinstall'} $deps" if ((defined $local) && (defined $pbos->{'localinstall'}) && ($pbos->{'localinstall'} !~ /[ ]*/)); 405 my $ret = pb_system($cmd, "Installing dependencies ($cmd)","mayfail"); 406 # Try to accomodate deficient proxies 407 if ($ret != 0) { 408 pb_system($cmd, "Re-trying installing dependencies ($cmd)"); 409 } 426 pb_distro_installpkgs($pbos,$deps,$local); 410 427 # Check that all deps have been installed correctly 411 428 # This time we don't forcerepo to avoid getting a list as a return as we have … … 637 654 if ((not defined $addrepo) || (not defined $addrepo->{$ENV{'PBPROJ'}})) { 638 655 my ($pbrepo) = pb_conf_get_in_hash_if($h,"pbrepo"); 639 return undefif (not defined $pbrepo);656 return(undef) if (not defined $pbrepo); 640 657 my $url = "$pbrepo->{$ENV{'PBPROJ'}}"; 641 658 my ($testver,$delivery) = pb_conf_get_in_hash_if($h,"testver","delivery"); … … 677 694 my $param = shift; 678 695 679 return if (not defined $param);696 return(undef) if (not defined $param); 680 697 681 698 pb_apply_conf_proxy($pbos); … … 721 738 } 722 739 my $dest = "$dirdest/$bn"; 723 return undefif (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1);740 return(undef) if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1); 724 741 if (! -d $dirdest) { 725 742 cluck "Missing directory $dirdest ($reponame)"; 726 return undef;743 return(undef); 727 744 } 728 745 pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding $reponame repository") if (not -f "$dest"); … … 748 765 } elsif ($bn =~ /\.addmedia/) { 749 766 # URPMI repo 750 # We should test that it's not already a urpmi repo 751 pb_system("chmod 755 $ENV{'PBTMP'}/$bn ; sudo $ENV{'PBTMP'}/$bn 2>&1 > /dev/null","Adding urpmi repository"); 767 # We should test that it's not an already setup urpmi repo 768 open(URPMI,"/etc/urpmi/urpmi.cfg") || cluck "Unable to open /etc/urpmi/urpmi.cfg" && next; 769 my $found = 0; 770 my $entry = $bn; 771 $entry =~ s/.addmedia$//; 772 while (<URPMI>) { 773 $found = 1 if ($_ =~ /^$entry /); 774 } 775 pb_system("chmod 755 $ENV{'PBTMP'}/$bn ; sudo $ENV{'PBTMP'}/$bn 2>&1 > /dev/null","Adding urpmi repository") if ($found == 0); 776 pb_log(0,"INFO urpmi $bn already set up\n") if ($found == 1); 752 777 } else { 753 778 pb_log(0,"ERROR: Unable to deal with repository file $i on rpm distro ! Please report to dev team\n"); … … 756 781 if ($bn =~ /\.sources.list$/) { 757 782 my $dest = "/etc/apt/sources.list.d/$bn"; 758 return if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1);783 return(undef) if (pb_distro_compare_repo("$ENV{'PBTMP'}/$bn",$dest) == 1); 759 784 pb_system("sudo mv $ENV{'PBTMP'}/$bn $dest","Adding apt repository $dest"); 760 785 # Check whether GPG keys for this repo are already known and if … … 771 796 } 772 797 close(REPO); 773 return if (not defined $debrepo);798 return(undef) if (not defined $debrepo); 774 799 775 800 pb_system("wget -O $ENV{'PBTMP'}/Release $debrepo/Release","Downloading $debrepo/Release"); … … 792 817 } 793 818 close(SIGN); 794 return if (not defined $signature);819 return(undef) if (not defined $signature); 795 820 796 821 pb_log(3, "GnuPG repo verify returned: $signature\n"); -
devel/pb/bin/pb
r2426 r2427 1678 1678 1679 1679 # Additional potential repo 1680 my $forcerepo =pb_distro_setuprepo($pbos,"install");1680 pb_distro_setuprepo($pbos,"install"); 1681 1681 foreach my $pbpkg (@pkgs) { 1682 1682 # We need to install the package to test, and deps brought with it 1683 pb_distro_install deps(undef,$pbos,$forcerepo,$pbpkg,"local");1683 pb_distro_installpkgs($pbos,$pbpkg,"local"); 1684 1684 } 1685 1685 } … … 1697 1697 my $forcerepo = pb_distro_setuprepo($pbos,"test"); 1698 1698 foreach my $pbpkg (@pkgs) { 1699 # We need to install the package to test, and deps brought with it 1700 pb_distro_installdeps(undef,$pbos,$forcerepo,$pbpkg); 1701 pb_system("$ENV{'PBDESTDIR'}/pbtest","Launching test for $pbpkg","verbose"); 1702 } 1699 } 1700 pb_system("$ENV{'PBDESTDIR'}/pbtest","Launching test","verbose"); 1703 1701 } 1704 1702 … … 2720 2718 $tag{2} = "$tag{1}-pb"; 2721 2719 $tag{3} = "$tag{2}-$ENV{'PBPROJ'}"; 2722 $tag{4} = "$tag{ 3}-install";2723 $tag{5} = "$tag{ 3}-test";2720 $tag{4} = "$tag{2}-install"; 2721 $tag{5} = "$tag{2}-test"; 2724 2722 } else { 2725 2723 # If we were given an image name, just use it
Note:
See TracChangeset
for help on using the changeset viewer.