[1690] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Project Builder Distribution Parameter extractor
|
---|
| 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 | # Copyright B. Cornec 2007-2013
|
---|
| 8 | # Provided under the GPL v2
|
---|
| 9 |
|
---|
| 10 | use strict 'vars';
|
---|
| 11 | use Getopt::Long qw(:config auto_abbrev no_ignore_case);
|
---|
| 12 | use Data::Dumper;
|
---|
| 13 | use lib qw (lib);
|
---|
| 14 | #use lib '/usr/share/perl5'; # mandatory for opensuse
|
---|
| 15 | use ProjectBuilder::Base;
|
---|
| 16 | use ProjectBuilder::Env;
|
---|
| 17 | use ProjectBuilder::Distribution;
|
---|
| 18 | use ProjectBuilder::Conf;
|
---|
| 19 |
|
---|
| 20 | =pod
|
---|
| 21 |
|
---|
| 22 | =head1 NAME
|
---|
| 23 |
|
---|
| 24 | pb, aka project-builder.org - builds packages for your projects
|
---|
| 25 |
|
---|
| 26 | =head1 DESCRIPTION
|
---|
| 27 |
|
---|
| 28 | pb helps you build various packages directly from your project sources.
|
---|
| 29 | pbdistrogetparam is a command from the pb project providing the value of the parameter for the running distribution based on the most precise tuple
|
---|
| 30 | It is a CLI version of the pb_distro_get_param function
|
---|
| 31 |
|
---|
| 32 | =head1 SYNOPSIS
|
---|
| 33 |
|
---|
| 34 | pbdistrogetparam [-h][-v][-p project][-d distro-ver-arch] param
|
---|
| 35 |
|
---|
| 36 | =head1 OPTIONS
|
---|
| 37 |
|
---|
| 38 | =over 4
|
---|
| 39 |
|
---|
| 40 | =item B<-h|--help>
|
---|
| 41 |
|
---|
| 42 | Prints this help
|
---|
| 43 |
|
---|
| 44 | =item B<-v|--verbose>
|
---|
| 45 |
|
---|
| 46 | Print a brief help message and exits.
|
---|
| 47 |
|
---|
| 48 | =item B<-d|--distribution>
|
---|
| 49 |
|
---|
| 50 | The tuple for which to print the parameter value considered (by default current distribution)
|
---|
| 51 |
|
---|
| 52 | =item B<-p|--project project_name>
|
---|
| 53 |
|
---|
| 54 | Name of the project you're working on (or use the env variable PBPROJ)
|
---|
| 55 |
|
---|
| 56 | =back
|
---|
| 57 |
|
---|
| 58 | =head1 ARGUMENTS
|
---|
| 59 |
|
---|
| 60 | Arguments is mandatory and corresponds to the parameter whose value is requested for the related distribution tuple.
|
---|
| 61 |
|
---|
| 62 | =head1 WEB SITES
|
---|
| 63 |
|
---|
| 64 | The main Web site of the project is available at L<http://www.project-builder.org/>. Bug reports should be filled using the trac instance of the project at L<http://trac.project-builder.org/>.
|
---|
| 65 |
|
---|
| 66 | =head1 USER MAILING LIST
|
---|
| 67 |
|
---|
| 68 | Cf: L<http://www.mondorescue.org/sympa/info/pb-announce> for announces and L<http://www.mondorescue.org/sympa/info/pb-devel> for the development of the pb project.
|
---|
| 69 |
|
---|
| 70 | =head1 CONFIGURATION FILES
|
---|
| 71 |
|
---|
| 72 | Uses the main /etc/pb/pb.conf (or /usr/local/etc/pb/pb.conf if installed from files) configuration file to give its answers.
|
---|
| 73 |
|
---|
| 74 | =head1 AUTHORS
|
---|
| 75 |
|
---|
| 76 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
|
---|
| 77 |
|
---|
| 78 | =head1 COPYRIGHT
|
---|
| 79 |
|
---|
| 80 | Project-Builder.org is distributed under the GPL v2.0 license
|
---|
| 81 | described in the file C<COPYING> included with the distribution.
|
---|
| 82 |
|
---|
| 83 | =cut
|
---|
| 84 |
|
---|
| 85 | my %opts; # CLI Options
|
---|
| 86 |
|
---|
| 87 | GetOptions(
|
---|
| 88 | "verbose|v+" => \$opts{'v'},
|
---|
| 89 | "help|h" => \$opts{'h'},
|
---|
| 90 | "project|p=s" => \$opts{'p'},
|
---|
| 91 | "distribution|d" => \$opts{'d'},
|
---|
| 92 | );
|
---|
| 93 | if (defined $opts{'v'}) {
|
---|
| 94 | $pbdebug = $opts{'v'};
|
---|
| 95 | }
|
---|
| 96 | pb_log_init($pbdebug, \*STDOUT);
|
---|
| 97 |
|
---|
| 98 | my $dist = $opts{'d'};
|
---|
| 99 | pb_env_init($opts{'p'},0,"none",0);
|
---|
| 100 | my $pbos = pb_distro_get_context($dist);
|
---|
| 101 | foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@ARGV))) {
|
---|
| 102 | print "$r\n";
|
---|
| 103 | }
|
---|