Changeset 2139 in ProjectBuilder


Ignore:
Timestamp:
Sep 11, 2016, 1:16:52 AM (4 years ago)
Author:
Bruno Cornec
Message:

Adding function pb_filter_var_print to enhance pb as per #148

Location:
devel/pb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r2134 r2139  
    441441Print the full configuration parameters as found in the various configuration files. Help to debug conf issues.
    442442Also accepts a parameter to display only this value, and a VM/VE/RM
     443
     444=item B<getvar>
     445
     446Print the full variables expanded based on the distrubution tuple. Help to debug conf issues.
     447Also accepts a parameter to display only the values for this package, and a VM/VE/RM
    443448
    444449=item B<clean>
     
    983988    pb_log(1,"Arguments to print:".Dumper(@ARGV)."\n");
    984989    pb_distro_conf_print($pbos,@ARGV);
     990} elsif ($action =~ /^getvar$/) {
     991    my $pbos = pb_distro_get_context($ENV{'PBV'});
     992    my $pkg;
     993    my @pkg;
     994    if ($#ARGV == -1) {
     995        $pkg = pb_cms_get_pkg($defpkgdir,$extpkgdir);
     996        @pkgs = @$pkg;
     997    } else {
     998        @pkgs = @ARGV;
     999    }
     1000    pb_log(1,"Packages to print:".Dumper(@pkgs)."\n");
     1001    pb_filter_var_print($pbos,@pkgs);
    9851002} elsif ($action =~ /^clean$/) {
    9861003    pb_clean();
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r2032 r2139  
    3434 
    3535our @ISA = qw(Exporter);
    36 our @EXPORT = qw(pb_get_filters pb_filter_file_pb pb_filter_file_inplace pb_filter_file);
     36our @EXPORT = qw(pb_get_filters pb_filter_file_pb pb_filter_file_inplace pb_filter_file pb_filter_var_print);
    3737($VERSION,$REVISION) = pb_version_init();
    3838
     
    263263
    264264
     265=item B<pb_filter_var_print>
     266
     267This function prints every variable expanded in order to help debug stacking issues with conf files. If a VM/VE/RM is given restrict display to this distribution. If parameters are passed, restrict again the display to that package only.
     268
     269=cut
     270
     271sub pb_filter_var_print {
     272
     273my $pbos = shift;
     274my @keys = @_;
     275my $ptr = undef;
     276
     277if ($#keys == -1) {
     278    pb_log(0,"Full pb variables for project $ENV{'PBPROJ'}\n");
     279    pb_log(0,"============================================\n");
     280}
     281if (defined $ENV{'PBV'}) {
     282    pb_log(0,"Distribution $ENV{'PBV'}\n");
     283    pb_log(0,"========================\n");
     284} else {
     285    pb_log(0,"Local Distribution\n");
     286    pb_log(0,"==================\n");
     287}
     288
     289foreach my $k (@keys) {
     290    $ptr = pb_get_filters($k,$pbos);
     291    pb_log(0,"Package $k\n");
     292    pb_log(0,"==================\n");
     293    foreach my $f (sort keys %$ptr) {
     294        pb_log(0,"Filter $f => $ptr->{$f}\n");
     295    }
     296    pb_log(0,"==================\n");
     297}
     298}
     299
     300
    265301=back
    266302
Note: See TracChangeset for help on using the changeset viewer.