#!/usr/bin/perl -w # # Project Builder Distribution Parameter extractor # # $Id$ # # Copyright B. Cornec 2007-2016 # Provided under the GPL v2 use strict 'vars'; use Getopt::Long qw(:config auto_abbrev no_ignore_case); use Data::Dumper; use lib qw (lib); #use lib '/usr/share/perl5'; # mandatory for opensuse use ProjectBuilder::Version; use ProjectBuilder::Base; use ProjectBuilder::Env; use ProjectBuilder::Distribution; use ProjectBuilder::Conf; =pod =head1 NAME pb, aka project-builder.org - builds packages for your projects =head1 DESCRIPTION pb helps you build various packages directly from your project sources. pbgetparam is a command from the pb project providing the value of the parameter for the running distribution based on the most precise tuple It is a CLI version of the pb_distro_get_param function =head1 SYNOPSIS pbgetparam [-h][-v][-p project][-d distro-ver-arch] [param|-a] =head1 OPTIONS =over 4 =item B<-h|--help> Prints this help =item B<-v|--verbose> Print a brief help message and exits. =item B<-d|--distribution> The tuple for which to print the parameter value considered (by default current distribution) =item B<-p|--project project_name> Name of the project you're working on (or use the env variable PBPROJ) =item B<-a|--all> Process all configuration parameters =back =head1 ARGUMENTS Arguments is mandatory and corresponds to the parameter whose value is requested for the related distribution tuple. =head1 WEB SITES The main Web site of the project is available at L. Bug reports should be filled using the trac instance of the project at L. =head1 USER MAILING LIST Cf: L for announces and L for the development of the pb project. =head1 CONFIGURATION FILES Uses the main /etc/pb/pb.yml (or /usr/local/etc/pb/pb.yml if installed from files) configuration file to give its answers. =head1 AUTHORS The Project-Builder.org team L lead by Bruno Cornec L. =head1 COPYRIGHT Project-Builder.org is distributed under the GPL v2.0 license described in the file C included with the distribution. =cut my %opts; # CLI Options my ($projectver,$projectrev) = pb_version_init(); my $appname = "pbgetparam"; # Initialize the syntax string pb_syntax_init("$appname Version $projectver-$projectrev\n"); GetOptions( "verbose|v+" => \$opts{'v'}, "version" => \$opts{'version'}, "man" => \$opts{'man'}, "help|h" => \$opts{'h'}, "all|a" => \$opts{'a'}, "project|p=s" => \$opts{'p'}, "distribution|d=s" => \$opts{'d'}, ); if (defined $opts{'h'}) { pb_syntax(0,1); } if (defined $opts{'version'}) { pb_syntax(0,0); } if (defined $opts{'man'}) { pb_syntax(0,2); } if (defined $opts{'v'}) { $pbdebug = $opts{'v'}; } pb_log_init($pbdebug, \*STDOUT); my $dist = $opts{'d'}; my $pbos = pb_distro_get_context($dist); pb_env_init($opts{'p'},0,"getconf",0); my @tab = @ARGV; @tab = pb_conf_get_all() if (defined $opts{'a'}); pb_distro_conf_print($pbos,@tab);