Changeset 2153 in ProjectBuilder


Ignore:
Timestamp:
Dec 23, 2016, 2:45:39 AM (4 years ago)
Author:
Bruno Cornec
Message:
  • Use function pb_distro_conf_print in pbgetparam to avoid code duplication
  • Improve pb_distro_conf_print with former code from pbgetparam
Location:
devel/pb-modules
Files:
2 edited

Legend:

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

    r2151 r2153  
    108108
    109109my $dist = $opts{'d'};
     110my $pbos = pb_distro_get_context($dist);
    110111pb_env_init($opts{'p'},0,"getconf",0);
    111 my $pbos = pb_distro_get_context($dist);
    112112
    113113my @tab = @ARGV;
    114114@tab = pb_conf_get_all() if (defined $opts{'a'});
    115115
    116 my %rep;
    117 my $i = 0;
    118 # Index on prj
    119 foreach my $r (pb_conf_get(@tab)) {
    120     $rep{$tab[$i]} = $r->{'default'} if (defined  $r->{'default'});
    121     $rep{$tab[$i]} = $r->{$ENV{'PBPROJ'}} if (defined  $r->{$ENV{'PBPROJ'}});
    122     $i++;
    123 }
    124 # Index on distro
    125 $i = 0;
    126 foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@tab))) {
    127     $rep{$tab[$i]} = $r if (defined $tab[$i]);
    128     $i++;
    129 }
    130 foreach my $r (keys %rep) {
    131     print "$r => " if ((defined $opts{'v'}) || (defined $opts{'a'}));
    132     print "$rep{$r}\n";
    133 }
     116pb_distro_conf_print($pbos,@tab);
  • devel/pb-modules/lib/ProjectBuilder/Distribution.pm

    r2152 r2153  
    748748my $pbos = shift;
    749749my @keys = @_;
     750my $ldebug = $pbdebug;
    750751
    751752if ($#keys == -1) {
    752753    pb_log(0,"Full pb configuration for project $ENV{'PBPROJ'}\n");
    753754    pb_log(0,"================================================\n");
     755    @keys = pb_conf_get_all();
     756    $ldebug = 1;
    754757}
    755758if (defined $ENV{'PBV'}) {
     
    761764}
    762765
    763 if ($#keys == -1) {
    764     foreach my $k (pb_conf_get_all()) {
    765         pb_log(0,"$k => ".Dumper(pb_conf_get($k))."\n");
    766     }
    767 } else {
    768     foreach my $k (@keys) {
    769         pb_log(0,"$k=".pb_distro_get_param($pbos,pb_conf_get($k))."\n");
    770     }
     766my %rep;
     767my $i = 0;
     768# Index on prj
     769foreach my $r (pb_conf_get(@keys)) {
     770    $rep{$keys[$i]} = $r->{'default'} if (defined  $r->{'default'});
     771    $rep{$keys[$i]} = $r->{$ENV{'PBPROJ'}} if (defined  $r->{$ENV{'PBPROJ'}});
     772    $i++;
     773}
     774# Index on distro
     775$i = 0;
     776foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@keys))) {
     777    $rep{$keys[$i]} = $r if (defined $keys[$i]);
     778    $i++;
     779}
     780foreach my $r (keys %rep) {
     781    print "$r => " if (defined $ldebug);
     782    print "$rep{$r}\n";
    771783}
    772784}
Note: See TracChangeset for help on using the changeset viewer.