Changeset 1694


Ignore:
Timestamp:
Feb 26, 2013, 6:37:21 AM (5 years ago)
Author:
bruno
Message:
  • pbdistrogetparam now works, is built & delivered, and has a new -a (all) option
  • New function pb_conf_get_all to return the list of all parameters, also now used by pb_conf_print
Location:
devel/pb-modules
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/Makefile.PL

    r1528 r1694  
    2020    #ABSTRACT_FROM => 'bin/pb',   # retrieve abstract from module
    2121    AUTHOR        => 'Bruno Cornec <bruno#project-builder.org>',
    22     EXE_FILES     => [ qw( bin/pbdistrocheck ) ],
    23     MAN1PODS      => { 'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)', },
     22    EXE_FILES     => [ qw(bin/pbdistrocheck bin/pbdistrogetparam) ],
     23    MAN1PODS      => {
     24                        'bin/pbdistrocheck' => '$(INST_MAN1DIR)/pbdistrocheck.$(MAN1EXT)',
     25                        'bin/pbdistrogetparam' => '$(INST_MAN1DIR)/pbdistrogetparam.$(MAN1EXT)',
     26                    },
    2427#   MAN3PODS      => {  'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)',
    2528                        #'lib/ProjectBuilder/Conf.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Conf.$(MAN3EXT)',
  • devel/pb-modules/bin/pbdistrogetparam

    r1690 r1694  
    3232=head1 SYNOPSIS
    3333
    34 pbdistrogetparam [-h][-v][-p project][-d distro-ver-arch] param
     34pbdistrogetparam [-h][-v][-p project][-d distro-ver-arch] [param|-a]
    3535
    3636=head1 OPTIONS
     
    5353
    5454Name of the project you're working on (or use the env variable PBPROJ)
     55
     56=item B<-a|--all>
     57
     58Process all configuration parameters
    5559
    5660=back
     
    8892        "verbose|v+" => \$opts{'v'},
    8993        "help|h" => \$opts{'h'},
     94        "all|a" => \$opts{'a'},
    9095        "project|p=s" => \$opts{'p'},
    91         "distribution|d" => \$opts{'d'},
     96        "distribution|d=s" => \$opts{'d'},
    9297);
     98if (defined $opts{'h'}) {
     99    pb_syntax(0,$opts{'h'}-1);
     100}
     101if (defined $opts{'man'}) {
     102    pb_syntax(0,2);
     103}
    93104if (defined $opts{'v'}) {
    94105    $pbdebug = $opts{'v'};
     
    99110pb_env_init($opts{'p'},0,"none",0);
    100111my $pbos = pb_distro_get_context($dist);
    101 foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@ARGV))) {
     112
     113my @tab = @ARGV;
     114@tab = pb_conf_get_all() if (defined $opts{'a'});
     115
     116my $i = 0;
     117foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@tab))) {
     118    print "$tab[$i] => " if ((defined $opts{'v'}) || (defined $opts{'a'}));
     119    $i++;
    102120    print "$r\n";
    103121}
  • devel/pb-modules/lib/ProjectBuilder/Conf.pm

    r1644 r1694  
    2929 
    3030our @ISA = qw(Exporter);
    31 our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_conf_print);
     31our @EXPORT = qw(pb_conf_init pb_conf_add pb_conf_read pb_conf_read_if pb_conf_get pb_conf_get_if pb_conf_print pb_conf_get_all);
    3232($VERSION,$REVISION) = pb_version_init();
    3333
     
    388388
    389389
     390=item B<pb_conf_get_all>
     391
     392This function returns an array wirh all configuration parameters
     393
     394=cut
     395
     396sub pb_conf_get_all {
     397
     398return(sort keys %$h);
     399}
     400
     401
    390402=item B<pb_conf_print>
    391403
     
    398410pb_log(0,"Full pb configuration for project $ENV{'PBPROJ'}\n");
    399411pb_log(0,"====================================\n");
    400 foreach my $k (sort keys %$h) {
     412foreach my $k (pb_conf_get_all()) {
    401413    pb_log(0,"$k => ".Dumper($h->{$k})."\n");
    402414}
    403415}
    404 
    405416=back
    406417
Note: See TracChangeset for help on using the changeset viewer.