Changeset 2488 in ProjectBuilder


Ignore:
Timestamp:
Mar 30, 2020, 8:21:44 PM (4 years ago)
Author:
Bruno Cornec
Message:

Improve debug messages

  • pb_distro_get_param now an internal function printing name of hash members
  • use pb_distro_guess instead of pb_distro_get
  • pb_distro_get and pb_distro_get_if introduced to replace call to pb_conf_get(_if)* + and old pb_distro_get_param
  • add pb_distro_get_in_conf_if for another use case of old pb_distro_get_param
  • fix all calls to these functions
Location:
devel
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/bin/pbgetparam

    r2279 r2488  
    55# $Id$
    66#
    7 # Copyright B. Cornec 2007-2016
     7# Copyright B. Cornec 2007-today
    88# Provided under the GPL v2
    99
     
    2929pb helps you build various packages directly from your project sources.
    3030pbgetparam is a command from the pb project providing the value of the parameter for the running distribution based on the most precise tuple
    31 It is a CLI version of the pb_distro_get_param function
     31It is a CLI version of the pb_distro_get function
    3232
    3333=head1 SYNOPSIS
  • devel/pb-modules/etc/pb.yml

    r2483 r2488  
    537537#    ubuntu: http://archive.ubuntu.com/ubuntu
    538538#
     539addbuildrepo:
     540  centos-8: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/powertools.repo
     541  rhel-8: ftp://ftp.project-builder.org/centos/8/$pbos->{'arch'}/powertools.repo
    539542
    540543#
     
    690693  rhel-7: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-YAML
    691694  centos-7: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir,perl-YAML
    692   rhel-8: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir,perl-Data-Dumper,perl-YAML
    693   centos-8: wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir,perl-Data-Dumper,perl-YAML
     695  rhel-8: wget,make,chrony,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir,perl-Data-Dumper,perl-YAML
     696  centos-8: wget,make,chrony,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build,perl-ExtUtils-MakeMaker,perl-File-MimeInfo,perl-File-BaseDir,perl-Data-Dumper,perl-YAML
    694697  redhat:
    695698  suse: wget,make,ntp,patch,diffutils
     
    816819oscmdntp:
    817820  default: /usr/sbin/ntpdate
     821  centos-8: /bin/true
     822  rhel-8: /bin/true
     823  fedora: /bin/true
    818824#    opensuse-11.0-i386: sntp -P no -r
    819825#    opensuse-11.0-x86_64: sntp -P no -r
     
    848854  mandriva: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/pb.addmedia
    849855  deb: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/pb.sources.list
     856  centos-8: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/pb.repo,ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/powertools.repo
     857  rhel-8: ftp://ftp.project-builder.org/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/pb.repo,ftp://ftp.project-builder.org/centos/8/$pbos->{'arch'}/powertools.repo
    850858
    851859# default remote git repo name
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r2484 r2488  
    55# which can be easily used by wahtever perl project
    66#
    7 # Copyright B. Cornec 2007-2016
     7# Copyright B. Cornec 2007-today
    88# Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
    99# Provided under the GPL v2
     
    409409my @ptr = ();
    410410
    411 pb_log(2,"DEBUG: pb_conf_get_in_hash_if on params ".join(' ',@params)."\n");
     411pb_log(3,"DEBUG: pb_conf_get_in_hash_if on params ".join(' ',@params)."\n");
    412412foreach my $k (@params) {
    413413    push @ptr,$lh->{$k};
    414414}
    415415
    416 pb_log(2,"DEBUG: pb_conf_get_in_hash_if returns\n".Dumper(@ptr));
     416pb_log(3,"DEBUG: pb_conf_get_in_hash_if returns\n".Dumper(@ptr));
    417417return(@ptr);
    418418}
     
    474474my $p2;
    475475
    476 pb_log(2,"DEBUG: pb_conf_add_last_in_hash params: ".Dumper(@params)."\n");
    477 pb_log(2,"DEBUG: pb_conf_add_last_in_hash current hash: ".Dumper(@h)."\n");
    478 pb_log(2,"DEBUG: pb_conf_add_last_in_hash new inputs: ".Dumper(@ptr)."\n");
     476pb_log(3,"DEBUG: pb_conf_add_last_in_hash params: ".Dumper(@params)."\n");
     477pb_log(3,"DEBUG: pb_conf_add_last_in_hash current hash: ".Dumper(@h)."\n");
     478pb_log(3,"DEBUG: pb_conf_add_last_in_hash new inputs: ".Dumper(@ptr)."\n");
    479479
    480480foreach my $i (0..$#params) {
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2468 r2488  
    33# Creates common environment for distributions
    44#
    5 # Copyright B. Cornec 2007-2016
     5# Copyright B. Cornec 2007-today
    66# Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
    77# Provided under the GPL v2
     
    3333 
    3434our @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_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);
     35our @EXPORT = qw(pb_distro_init pb_distro_conffile pb_distro_sysconffile pb_distro_api pb_distro_get pb_distro_get_if 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_context pb_distro_to_keylist pb_distro_conf_print pb_apply_conf_proxy);
    3636($VERSION,$REVISION,$PBCONFVER) = pb_version_init();
    3737
     
    6363  # Return information on the running distro
    6464  #
    65   my ($ddir,$dver) = pb_distro_get();
     65  my ($ddir,$dver) = pb_distro_guess();
    6666
    6767=head1 USAGE
     
    159159
    160160# If we don't know which distribution we're on, then guess it
    161 ($pbos->{'name'},$pbos->{'version'}) = pb_distro_get() if ((not defined $pbos->{'name'}) || (not defined $pbos->{'version'}));
     161($pbos->{'name'},$pbos->{'version'}) = pb_distro_guess() if ((not defined $pbos->{'name'}) || (not defined $pbos->{'version'}));
    162162
    163163# For some rare cases, typically nover ones
     
    174174# Do NOT factorize here, as it won't work as of now for hash creation
    175175# Do NOT change order without caution
    176 $pbos->{'useminor'} = pb_distro_get_param($pbos,pb_conf_get("osuseminorrel"));
    177 $pbos->{'family'} = pb_distro_get_param($pbos,pb_conf_get("osfamily"));
    178 $pbos->{'type'} = pb_distro_get_param($pbos,pb_conf_get("ostype"));
    179 ($pbos->{'os'},$pbos->{'install'},$pbos->{'suffix'},$pbos->{'nover'},$pbos->{'rmdot'},$pbos->{'update'}) = pb_distro_get_param($pbos,pb_conf_get("os","osins","ossuffix","osnover","osremovedotinver","osupd"));
    180 ($pbos->{'localinstall'}) = pb_distro_get_param($pbos,pb_conf_get_if("oslocalins"));
    181 #($pbos->{'family'},$pbos->{'type'},$pbos->{'os'},$pbos->{'install'},$pbos->{'suffix'},$pbos->{'nover'},$pbos->{'rmdot'},$pbos->{'update'}) = pb_distro_get_param($pbos,pb_conf_get("osfamily","ostype","os","osins","ossuffix","osnover","osremovedotinver","osupd"));
     176$pbos->{'useminor'} = pb_distro_get($pbos,"osuseminorrel");
     177$pbos->{'family'} = pb_distro_get($pbos,"osfamily");
     178$pbos->{'type'} = pb_distro_get($pbos,"ostype");
     179($pbos->{'os'},$pbos->{'install'},$pbos->{'suffix'},$pbos->{'update'}) = pb_distro_get($pbos,("os","osins","ossuffix","osupd"));
     180($pbos->{'localinstall'},$pbos->{'nover'},$pbos->{'rmdot'}) = pb_distro_get_if($pbos,"oslocalins","osnover","osremovedotinver");
    182181
    183182# Some OS have no interesting version
     
    204203}
    205204
    206 =item B<pb_distro_get>
     205=item B<pb_distro_guess>
    207206
    208207This function returns a list of 2 parameters indicating the distribution name and version of the underlying Linux distribution. The value of those 2 fields may be "unknown" in case the function was unable to recognize on which distribution it is running.
     
    212211=cut
    213212
    214 sub pb_distro_get {
     213sub pb_distro_guess {
    215214
    216215# 1: List of files that unambiguously indicates what distro we have
     
    360359my ($pbos) = @_;
    361360
    362 my $ftp_proxy = pb_distro_get_param($pbos,pb_conf_get_if("ftp_proxy"));
    363 my $http_proxy = pb_distro_get_param($pbos,pb_conf_get_if("http_proxy"));
    364 my $https_proxy = pb_distro_get_param($pbos,pb_conf_get_if("https_proxy"));
     361my $ftp_proxy = pb_distro_get_if($pbos,"ftp_proxy");
     362my $http_proxy = pb_distro_get_if($pbos,"http_proxy");
     363my $https_proxy = pb_distro_get_if($pbos,"https_proxy");
    365364
    366365# We do not overwrite shell settings
     
    626625# 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
    627626$h = pb_conf_cache(pb_distro_conffile(),$h);
    628 my ($osrepo) = pb_conf_get_in_hash_if($h,"osrepo");
    629 my $repo = pb_distro_get_param($pbos,$osrepo);
     627#my $repo = pb_distro_get_param($pbos,$osrepo);
     628my $repo = pb_distro_get_in_hash_if($pbos,$h,"osrepo");
    630629return(pb_distro_setuprepo_gen($pbos,$repo));
    631630}
     
    649648$h = pb_conf_cache("$ENV{'PBDESTDIR'}/pbrc.yml",$h) if ((defined $ENV{'PBDESTDIR'}) && (-f "$ENV{'PBDESTDIR'}/pbrc.yml"));
    650649
    651 my ($addrepo) = pb_conf_get_in_hash_if($h,"add".$repotype."repo");
    652 my $repo = pb_distro_get_param($pbos,$addrepo);
     650my $repo = pb_distro_get_in_hash_if($pbos,$h,"add".$repotype."repo");
    653651# If no repo then set it up as undef so the return value is correct from pb_distro_setuprepo_gen
    654652$repo = undef if ($repo eq "");
     
    656654    # Give a probable default if nothing is provided to avoid overloading conf files
    657655    #
    658     if ((not defined $addrepo) || (not defined $repo)) {
     656    if (not defined $repo) {
    659657        my ($pbrepo) = pb_conf_get_in_hash_if($h,"pbrepo");
    660658        if (not defined $pbrepo) {
     
    870868=item B<pb_distro_get_param>
    871869
    872 This function gets the parameter in the conf file from the most precise tuple up to default
     870This internal function gets the parameters in the conf file from the most precise tuple up to default
    873871
    874872=cut
     
    876874sub pb_distro_get_param {
    877875
     876my $pbos = shift;
     877my $var = shift;
    878878my @param = ();
    879 my $pbos = shift;
     879my $i = 0;
     880pb_log(3,"var: ".Dumper($var));
    880881
    881882my @keylist = pb_distro_to_keylist($pbos,"default");
    882 pb_log(2,"DEBUG: pb_distro_get_param on $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} for ".Dumper(@_)."\n");
    883 foreach my $opt (@_) {
    884     my $param = "";
     883pb_log(3,"keylist: ".Dumper(@keylist));
     884
     885my $p = $var->{"ptr"};
     886foreach my $opt (@$p) {
     887    pb_log(3,'opt: '.Dumper($opt));
     888    my $param = undef;
     889    my $fkey = undef;
    885890    foreach my $key (@keylist) {
     891        pb_log(3,"key: $key\n");
    886892        if (defined $opt->{$key}) {
    887893            $param = $opt->{$key};
     894            $fkey = $key;
    888895            last;
    889896        }
    890897    }
    891     # Allow replacement of variables inside the parameter such as name, version, arch for rpmbootstrap
    892     # but not shell variable which are backslashed
    893     if ($param =~ /[^\\]\$/) {
    894         pb_log(3,"Expanding variable on $param\n");
    895         eval { $param =~ s/(\$\w+->\{\'\w+\'\})/$1/eeg };
     898    my $field = $var->{"val"};
     899    pb_log(3,"field: ".Dumper($field));
     900    $fkey = "default" if (not defined $fkey);
     901    pb_log(3,"key: $fkey\n");
     902    pb_log(2,"DEBUG: pb_distro_get_if on $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} for $field->[$i]".'{'.$fkey.'}'." returns ");
     903    if (defined $param) {
     904        # Allow replacement of variables inside the parameter such as name, version, arch for rpmbootstrap
     905        # but not shell variable which are backslashed
     906        if ($param =~ /[^\\]\$/) {
     907            pb_log(3,"Expanding variable on $param\n");
     908            eval { $param =~ s/(\$\w+->\{\'\w+\'\})/$1/eeg };
     909        }
     910        pb_log(2,"$param\n");
     911    } else {
     912        pb_log(2,"undefined\n");
    896913    }
    897914    push @param,$param;
    898 }
    899 
    900 pb_log(2,"DEBUG: pb_distro_get_param on $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} returns ==".Dumper(@param)."==\n");
     915    $i++;
     916}
    901917
    902918# Return one param if user only asked for one lookup, an array if not.
    903919my $nb = @param;
     920pb_log(3,"Param".Dumper(@param)." has $nb members\n");
    904921if ($nb eq 1) {
     922    pb_log(3,"Retrun Param $param[0]\n");
    905923    return($param[0]);
    906924} else {
    907925    return(@param);
    908926}
     927}
     928
     929
     930=item B<pb_distro_get_if>
     931
     932This function gets the parameters in the conf file from the most precise tuple up to default
     933
     934=cut
     935
     936sub pb_distro_get_if {
     937
     938my $pbos = shift;
     939my @ptr = pb_conf_get_if(@_);
     940my $var;
     941$var->{"ptr"} = \@ptr;
     942$var->{"val"} = \@_;
     943return(pb_distro_get_param($pbos,$var));
     944}
     945
     946=item B<pb_distro_get>
     947
     948This function gets the parameters in the conf file from the most precise tuple up to default.
     949Aborts of one param doesn't exist whereas it should
     950
     951=cut
     952
     953sub pb_distro_get {
     954
     955my $pbos = shift;
     956my @param = @_;
     957my @return = pb_distro_get_if($pbos,@param);
     958
     959foreach my $i (0..$#param) {
     960    confess "No $param[$i] defined for $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}" if (not defined $return[$i]);
     961}
     962my $nb = @return;
     963if ($nb eq 1) {
     964    return($return[0]);
     965} else {
     966    return(@return);
     967}
     968}
     969
     970=item B<pb_distro_get_in_hash_if>
     971
     972This function gets the parameters in the conf file passed as hash from the most precise tuple up to default
     973
     974=cut
     975
     976sub pb_distro_get_in_hash_if {
     977
     978my $pbos = shift;
     979my $lh = shift || return(());
     980
     981my @ptr = pb_conf_get_in_hash_if($lh,@_);
     982my $var;
     983$var->{"ptr"} = \@ptr;
     984$var->{"val"} = \@_;
     985return(pb_distro_get_param($pbos,$var));
     986}
     987
     988=item B<pb_distro_get_in_conf_if>
     989
     990This function gets the parameters in the conf file passed as name from the most precise tuple up to default
     991
     992=cut
     993
     994sub pb_distro_get_in_conf_if {
     995
     996my $pbos = shift;
     997my $conffile = shift;
     998
     999my @ptr = pb_conf_read($conffile,@_);
     1000my $var;
     1001$var->{"ptr"} = \@ptr;
     1002$var->{"val"} = \@_;
     1003return(pb_distro_get_param($pbos,$var));
    9091004}
    9101005
     
    9621057my $i = 0;
    9631058# Index on distro
    964 foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@keys))) {
     1059foreach my $r (pb_distro_get($pbos,@keys)) {
    9651060    $rep{$keys[$i]} = $r if (defined $keys[$i]);
    9661061    $i++;
  • devel/pb-modules/lib/ProjectBuilder/VE.pm

    r2428 r2488  
    33# Common functions for virtual environment
    44#
    5 # Copyright B. Cornec 2007-2016
     5# Copyright B. Cornec 2007-today
    66# Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
    77# Provided under the GPL v2
     
    119119
    120120    # We can probably only get those params now we have the distro context
    121     my ($rbsb4pi,$rbspi,$vesnap,$oscodename,$osmindep,$verebuild,$rbsmirrorsrv) = pb_conf_get_if("rbsb4pi","rbspi","vesnap","oscodename","osmindep","verebuild","rbsmirrorsrv");
     121    my ($vesnap,$verebuild) = pb_conf_get_if("vesnap","verebuild");
    122122
    123123    if (((((defined $verebuild) && (defined $verebuild->{$ENV{'PBPROJ'}}) && ($verebuild->{$ENV{'PBPROJ'}} =~ /true/i)) || ($pbstep == 0)) && ($vetype ne "docker"))
     
    147147            }
    148148   
    149             my $postinstall = pb_ve_get_postinstall($pbos,$rbspi,$verpmstyle);
     149            my $postinstall = pb_ve_get_postinstall($pbos,$verpmstyle);
    150150            if ($verpmstyle eq "rinse") {
    151151                # Need to reshape the mirrors generated with local before-post-install script
    152152                my $b4post = "--before-post-install ";
    153                 my $postparam = pb_distro_get_param($pbos,$rbsb4pi);
     153                my $postparam = pb_distro_get_if($pbos,"rbsb4pi");
    154154                if ($postparam eq "") {
    155155                    $b4post = "";
     
    161161                my $addpkgs;
    162162                $postparam = "";
    163                 $postparam .= pb_distro_get_param($pbos,$osmindep);
     163                $postparam .= pb_distro_get_if($pbos,"osmindep");
    164164                if ($postparam eq "") {
    165165                    $addpkgs = "";
     
    187187                my $addpkgs = "";
    188188                my $postparam = "";
    189                 $postparam .= pb_distro_get_param($pbos,$osmindep);
     189                $postparam .= pb_distro_get_if($pbos,"osmindep");
    190190                if ($postparam eq "") {
    191191                    $addpkgs = "";
     
    208208            my $vedebstyle = $vedebtype->{$ENV{'PBPROJ'}};
    209209       
    210             my $codename = pb_distro_get_param($pbos,$oscodename);
     210            my $codename = pb_distro_get_if($pbos,"oscodename");
    211211            my $postparam = "";
    212212            my $addpkgs;
    213             $postparam .= pb_distro_get_param($pbos,$osmindep);
     213            $postparam .= pb_distro_get_if($pbos,"osmindep");
    214214            if ($postparam eq "") {
    215215                $addpkgs = "";
     
    218218            }
    219219            my $debmir = "";
    220             $debmir .= pb_distro_get_param($pbos,$rbsmirrorsrv);
     220            $debmir .= pb_distro_get_if($pbos,"rbsmirrorsrv");
    221221   
    222222            # Get potential rbs option
     
    302302            #
    303303            # We can probably only get those params now we have the distro context
    304             my ($osmindep) = pb_conf_get_if("osmindep");
    305             my $pkgs = pb_distro_get_param($pbos,$osmindep);
     304            my $pkgs = pb_distro_get_if($pbos,"osmindep");
    306305            $pkgs =~ s/,/ /g;
    307306            my $tmpd = "$ENV{'PBTMP'}/Dockerfile";
     
    335334
    336335my $pbos = shift;
    337 my $rbspi = shift;
    338336my $vestyle = shift;
    339337my $post = "";
     
    346344}
    347345
    348 my $postparam = pb_distro_get_param($pbos,$rbspi);
     346my $postparam = pb_distro_get_if($pbos,"rbspi");
    349347if ($postparam eq "") {
    350348    $post = "";
  • devel/pb/bin/pb

    r2485 r2488  
    13961396                        my ($patchcmd,$patchopt);
    13971397                        if ($pbos->{'type'} eq "deb") {
    1398                             ($patchcmd,$patchopt) = pb_distro_get_param($pbos,pb_conf_get_if("ospatchcmd","ospatchopt"));
     1398                            ($patchcmd,$patchopt) = pb_distro_get_if($pbos,("ospatchcmd","ospatchopt"));
    13991399                            open(SCRIPT,"> $dest/pbconf/$v/pbpatch/pbapplypatch") || confess "Unable to create $dest/pbconf/$v/pbpatch/pbapplypatch";
    14001400                            print SCRIPT "#!/bin/bash\n";
     
    20942094
    20952095    # Find the appropriate check cmd/opts
    2096     my ($chkcmd,$chkopt) = pb_distro_get_param($pbos,pb_conf_get_if("oschkcmd","oschkopt"));
     2096    my ($chkcmd,$chkopt) = pb_distro_get_if($pbos,("oschkcmd","oschkopt"));
    20972097
    20982098    my $ret = "";
     
    23292329    }
    23302330    if ($cmt =~ /^(V|R)M/) {
    2331         $vtmout = pb_distro_get_param($pbos,pb_conf_get_if($tmout));
     2331        $vtmout = pb_distro_get_if($pbos,$tmout);
    23322332    }
    23332333    my $remhost = $sshhost->{$ENV{'PBPROJ'}};
     
    23352335    if ($cmt =~ /^V[EM]|RM/) {
    23362336        # In that case our real host is in the xxhost with the OS as key, not project as above
    2337         $remhost = pb_distro_get_param($pbos,$sshhost);
     2337        $remhost = pb_distro_get($pbos,$host);
    23382338    }
    23392339    pb_log(2,"ssh: ".Dumper(($remhost,$sshlogin,$remdir,$sshport,$vepath,$rbsconf))."\n");
     
    23932393        open(PBS,"> $pbscript{$v}") || confess "Unable to create $pbscript{$v}";
    23942394        if ($pbos->{'type'} eq "rpm") {
    2395             my $pbsha = pb_distro_get_param($pbos,pb_conf_get("ossha"));
     2395            my $pbsha = pb_distro_get($pbos,"ossha");
    23962396            my ($gpgcheck) = pb_conf_get_if("pbgpgcheck");
    23972397            my $pbgpgcheck;
     
    28582858    if ($cmt =~ /^VE/) {
    28592859        if ($vetype ne "docker") {
    2860             my $sudomode = pb_distro_get_param($pbos,pb_conf_get("ossudoersmode"));
     2860            my $sudomode = pb_distro_get($pbos,"ossudoersmode");
    28612861            my $res = pb_system("$shcmdroot sed -i '/requiretty/d' /etc/sudoers","Removing potential requiretty in sudoers","quiet");
    28622862            pb_system("$shcmdroot sed '/requiretty/d' /etc/sudoers > /tmp/sudoers.new ; mv /tmp/sudoers.new $tpdir/tmp/sudoers.new ; $shcmdroot mv /tmp/sudoers.new /etc/sudoers ; $shcmdroot chown root:root /etc/sudoers ; $shcmdroot chmod $sudomode /etc/sudoers","Removing again potential requiretty in sudoers as sed -i failed") if (($res ne 0) && (-f "$tpdir/etc/sudoers"));
     
    30533053        }
    30543054        my $hoption = "-p";
    3055         my $hpath = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-halt"));
     3055        my $hpath = pb_distro_get($pbos,"ospathcmd-halt");
    30563056        # Solaris doesn't support -p of halt
    30573057        if ($pbos->{'type'} eq "pkg") {
     
    32113211# Launch the VMs/VEs
    32123212if ($vtype eq "vm") {
    3213     my ($ptr,$ptr2,$vmpath,$vmport,$vms) = pb_conf_get("vmtype","vmcmd","vmpath","vmport","vmsize");
    3214     my ($vmopt,$vmmm,$vmtmout,$vmsnap,$vmbuildtm,$vmmonport) = pb_conf_get_if("vmopt","vmmem","vmtmout","vmsnap","vmbuildtm","vmmonport");
    3215     my $vmsize = pb_distro_get_param($pbos,$vms);
     3213    my ($ptr,$ptr2,$vmpath,$vmport) = pb_conf_get("vmtype","vmcmd","vmpath","vmport");
     3214    my ($vmopt,$vmtmout,$vmsnap,$vmbuildtm,$vmmonport) = pb_conf_get_if("vmopt","vmtmout","vmsnap","vmbuildtm","vmmonport");
     3215    my $vmsize = pb_distro_get($pbos,"vmsize");
    32163216
    32173217    my $vmtype = $ptr->{$ENV{'PBPROJ'}};
     
    32363236
    32373237    # How much memory to allocate for VMs
    3238     if (defined $vmmm) {
    3239         my $vmmem = pb_distro_get_param($pbos,$vmmm);
    3240         if (defined $vmmem) {
    3241             $ENV{'PBVMOPT'} .= " -m $vmmem";
    3242         }
     3238    my $vmmem = pb_distro_get_if($pbos,"vmmem");
     3239    if (defined $vmmem) {
     3240        $ENV{'PBVMOPT'} .= " -m $vmmem";
    32433241    }
    32443242
     
    34093407    pb_log(2,"ntp server is $vntp\n");
    34103408    # ntp command depends on pbos
    3411     my $vntpcmd = pb_distro_get_param($pbos,pb_conf_get("oscmdntp"));
     3409    my $vntpcmd = pb_distro_get($pbos,"oscmdntp");
    34123410    $ntpline = "sudo $vntpcmd $vntp";
    34133411}
     
    40774075    # Try to restrict security to what is really needed
    40784076    if ($vtype =~ /^vm/) {
    4079         my $hpath = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-halt"));
     4077        my $hpath = pb_distro_get($pbos,"ospathcmd-halt");
    40804078        my @sudocmds = pb_get_sudocmds($pbos,$ntpline,"sudo $hpath","sudo /bin/date");
    40814079        print SCRIPT << "EOF";
     
    41014099EOF
    41024100    }
    4103     my $sudomode = pb_distro_get_param($pbos,pb_conf_get("ossudoersmode"));
     4101    my $sudomode = pb_distro_get($pbos,"ossudoersmode");
    41044102    print SCRIPT << 'EOF';
    41054103close(PBOUT);
     
    41324130
    41334131EOF
    4134     my $itype = pb_distro_get_param($pbos,pb_conf_get("pbinstalltype"));
     4132    my $itype = pb_distro_get($pbos,"pbinstalltype");
    41354133    # Install from sandbox mean a file base install
    41364134    $itype = "file" if (defined $sbx);
    41374135    $itype = $installtype if (defined $installtype);
    41384136    if ($itype =~ /^file/) {
    4139         my ($addrepo) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc.yml","addbuildrepo");
    4140         my $pbrepo = pb_distro_get_param($pbos,$addrepo);
     4137            #my ($addrepo) = pb_conf_read("$ENV{'PBDESTDIR'}/pbrc.yml","addbuildrepo");
     4138            #my $pbrepo = pb_distro_get_param($pbos,$addrepo);
     4139        my $pbrepo = pb_distro_get_in_conf_if($pbos,"$ENV{'PBDESTDIR'}/pbrc.yml","addbuildrepo");
    41414140        print SCRIPT << 'EOF';
    41424141
    41434142# First install all required packages
    4144 my ($ospkgdep) = pb_conf_get_if("ospkgdep");
    4145 my $pkgdep = pb_distro_get_param($pbos,$ospkgdep);
     4143my $pkgdep = pb_distro_get_if($pbos,"ospkgdep");
    41464144my $forcerepo;
    41474145EOF
     
    41774175        print SCRIPT << 'EOF';
    41784176# Then install manually the missing perl modules
    4179 my ($osperldep,$osperlver) = pb_conf_get_if("osperldep","osperlver");
     4177my ($osperlver) = pb_conf_get("osperlver");
    41804178   
    4181 my $perldep = pb_distro_get_param($pbos,$osperldep);
     4179my $osperldep = pb_distro_get_if($pbos,"osperldep");
    41824180my $bashopt = "";
    41834181$bashopt = "-x" if ($pbdebug ge 1);
    41844182my $verbopt = "mayfail";
    41854183$verbopt = "mayfailverbose" if ($pbdebug ge 1);
    4186 foreach my $m (split(/,/,$perldep)) {
     4184foreach my $m (split(/,/,$osperldep)) {
    41874185    # Skip empty deps
    41884186    next if ($m =~ /^\s*$/);
     
    42024200        # pkg based install. We need to point to the project-builder.org repository
    42034201        print SCRIPT << 'EOF';
    4204 my $pkgforpb = pb_distro_get_param($pbos,pb_conf_get_if("ospkg"));
     4202my $pkgforpb = pb_distro_get_if($pbos,"ospkg");
    42054203my $forcerepo = pb_distro_setuposrepo($pbos);
    42064204pb_distro_installpkgs($pbos,pb_distro_only_deps_needed($pbos,join(' ',split(/,/,$pkgforpb))));
  • devel/pb/lib/ProjectBuilder/Changelog.pm

    r2287 r2488  
    66# $Id$
    77#
    8 # Copyright B. Cornec 2007-2016
     8# Copyright B. Cornec 2007-today
    99# Provided under the GPL v2
    1010
     
    7474my $log = "";
    7575
    76 pb_log(2,"Entering pb_changelog - pb: ".Dumper($pb)."\n");
    77 pb_log(2,"Entering pb_changelog - doit: $doit\n") if (defined $doit);
    78 pb_log(2,"Entering pb_changelog - OUTPUT: $OUTPUT\n") if (defined $OUTPUT);
     76pb_log(3,"Entering pb_changelog - pb: ".Dumper($pb)."\n");
     77pb_log(3,"Entering pb_changelog - doit: $doit\n") if (defined $doit);
    7978# For date handling
    8079$ENV{'LANG'}="C";
     
    214213}
    215214close(INPUT);
    216 pb_log(2,"Exiting pb_changelog\n");
     215pb_log(3,"Exiting pb_changelog\n");
    217216}
    218217
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r2287 r2488  
    77# $Id$
    88#
    9 # Copyright B. Cornec 2007-2016
     9# Copyright B. Cornec 2007-today
    1010# Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
    1111# Provided under the GPL v2
     
    216216            my $i = 0;
    217217            if (defined $pb->{'patches'}->{$tuple}) {
    218                 my ($patchcmd,$patchopt) = pb_distro_get_param($pb->{'pbos'},pb_conf_get_if("ospatchcmd","ospatchopt"));
     218                my ($patchcmd,$patchopt) = pb_distro_get_if($pb->{'pbos'},("ospatchcmd","ospatchopt"));
    219219                foreach my $p (split(/,/,$pb->{'patches'}->{$tuple})) {
    220220                    pb_log(3,"DEBUG($tuple) Adding patch command $i ($patchopt)\n");
  • devel/pbmkbm/bin/pbmkbm

    r2434 r2488  
    55# $Id$
    66#
    7 # Copyright B. Cornec 2011-2016
     7# Copyright B. Cornec 2011-today
    88# Provided under the GPL v2
    99
     
    418418
    419419# Create the directory structure needed on the target dir
    420 my ($tdirs,$bdirs,$bfiles,$bcmds) = pb_distro_get_param($pbos,pb_conf_get("mkbmtargetdirs","mkbmbootdirs","mkbmbootfiles","mkbmbootcmds"));
     420my ($tdirs,$bdirs,$bfiles,$bcmds) = pb_distro_get($pbos,("mkbmtargetdirs","mkbmbootdirs","mkbmbootfiles","mkbmbootcmds"));
    421421# Create empty dirs for these
    422422foreach my $d (split(/,/,$tdirs)) {
     
    456456# and create the links for it in the target VE
    457457
    458 my $busycmd = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-busybox"));
     458my $busycmd = pb_distro_get($pbos,"ospathcmd-busybox");
    459459open(BUSY,"$busycmd |") || (cluck "ERROR: Unable to execute $busycmd" && return);
    460460my $cmdlist = 0;
     
    494494
    495495pb_log(1,"Analyzing your keyboard's configuration\n");
    496 my $keyfile = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keyfile"));
    497 confess "ERROR: Unable to read the keyfile $keyfile" if ((not defined $keyfile) || (! -r $keyfile));
    498 my $keymapdir = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keymapdir"));
    499 confess "ERROR: Unable to read the keymapdir $keymapdir" if ((not defined $keymapdir) || (! -d $keymapdir));
    500 my $keymapre = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-keymapre"));
    501 confess "ERROR: Unable to read the keymapre $keymapre" if (not defined $keymapre);
     496my $keyfile = pb_distro_get($pbos,"ospathcmd-keyfile");
     497confess "ERROR: Unable to read the keyfile $keyfile" if (! -r $keyfile);
     498my $keymapdir = pb_distro_get($pbos,"ospathcmd-keymapdir");
     499confess "ERROR: Unable to read the keymapdir $keymapdir" if (! -d $keymapdir);
     500my $keymapre = pb_distro_get($pbos,"ospathcmd-keymapre");
    502501
    503502# if a direct keymap file is given as keyfile, use only the first existing one and return
     
    534533
    535534pb_log(1,"Analyzing your terminfo's configuration\n");
    536 my $termdir = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-termdir"));
    537 confess "ERROR: Unable to read the keymapdir $termdir" if ((not defined $termdir) || (! -d $termdir));
     535my $termdir = pb_distro_get($pbos,"ospathcmd-termdir");
     536confess "ERROR: Unable to read the keymapdir $termdir" if (! -d $termdir);
    538537$tgtree->{$termdir} = "recurdir";
    539538
     
    556555$kernel->{"release"} = pb_get_osrelease();
    557556
    558 my $kfile = pb_distro_get_param($pbos,pb_conf_get_if("mkbmkernelfile"));
     557my $kfile = pb_distro_get_if($pbos,"mkbmkernelfile");
    559558if ((defined $kfile) && ($kfile ne "")) {
    560559    pb_log(1,"INFO: You specified your kernel as $kfile, so using it\n");
    561560    $kernel->{"file"} = $kfile;
    562561} else {
    563     $kernel->{"dir"} = pb_distro_get_param($pbos,pb_conf_get("mkbmkerneldir"));
     562    $kernel->{"dir"} = pb_distro_get($pbos,"mkbmkerneldir");
    564563    confess "ERROR: The mkbmkerneldir content ($kernel->{'dir'}) doesn't refer to a directory\n" if (! -d $kernel->{"dir"});
    565564    pb_log(1,"INFO: Analyzing directory $kernel->{'dir'} to find your kernel\n");
    566     $kernel->{"namere"} = pb_distro_get_param($pbos,pb_conf_get("mkbmkernelnamere"));
     565    $kernel->{"namere"} = pb_distro_get($pbos,"mkbmkernelnamere");
    567566
    568567    # TODO: Look at a better way to find the name of the kernel we run
     
    612611my $kernel = shift;
    613612
    614 my $lsmod = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-lsmod"));
    615 my $depmod = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-depmod"));
     613my $lsmod = pb_distro_get($pbos,"ospathcmd-lsmod");
     614my $depmod = pb_distro_get($pbos,"ospathcmd-depmod");
    616615open(LSMOD,"$lsmod") || confess "ERROR: Unable to read $lsmod: $!";
    617616while (<LSMOD>) {
     
    655654#
    656655#my ($mkbmcachedir) = pb_conf_get_if("mkbmcachedir");
    657 #my ($pkgs) = pb_distro_get_param($pbos,pb_conf_get("mkbmmindep"));
     656#my ($pkgs) = pb_distro_get($pbos,"mkbmmindep");
    658657
    659658#
  • devel/rpmbootstrap/bin/rpmbootstrap

    r2287 r2488  
    55# $Id$
    66#
    7 # Copyright B. Cornec 2010-2016
     7# Copyright B. Cornec 2010-today
    88# Eric Anderson's changes are (c) Copyright 2012 Hewlett Packard
    99# Provided under the GPL v2
     
    269269#
    270270my ($rbscachedir) = pb_conf_get_if("cachedir");
    271 my ($pkgs,$mirror) = pb_distro_get_param($pbos,pb_conf_get("rbsmindep","rbsmirrorsrv"));
    272 my ($updater) = pb_distro_get_param($pbos,pb_conf_get_if("rbsmirrorupd"));
     271my ($pkgs,$mirror) = pb_distro_get($pbos,("rbsmindep","rbsmirrorsrv"));
     272my ($updater) = pb_distro_get_if($pbos,"rbsmirrorupd");
    273273die "No packages defined for $pbos->{name}-$pbos->{version}-$pbos->{arch}" unless $pkgs =~ /\w/;
    274274
Note: See TracChangeset for help on using the changeset viewer.