source: ProjectBuilder/devel/pb-modules/bin/pbdistrogetparam@ 1690

Last change on this file since 1690 was 1690, checked in by Bruno Cornec, 11 years ago

r5138@localhost: bruno | 2013-02-10 15:53:09 +0100

  • Update pb pres for LCA 2013
  • add a pbdistrogetparam command to easy shell interface
File size: 2.6 KB
Line 
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
10use strict 'vars';
11use Getopt::Long qw(:config auto_abbrev no_ignore_case);
12use Data::Dumper;
13use lib qw (lib);
14#use lib '/usr/share/perl5'; # mandatory for opensuse
15use ProjectBuilder::Base;
16use ProjectBuilder::Env;
17use ProjectBuilder::Distribution;
18use ProjectBuilder::Conf;
19
20=pod
21
22=head1 NAME
23
24pb, aka project-builder.org - builds packages for your projects
25
26=head1 DESCRIPTION
27
28pb helps you build various packages directly from your project sources.
29pbdistrogetparam is a command from the pb project providing the value of the parameter for the running distribution based on the most precise tuple
30It is a CLI version of the pb_distro_get_param function
31
32=head1 SYNOPSIS
33
34pbdistrogetparam [-h][-v][-p project][-d distro-ver-arch] param
35
36=head1 OPTIONS
37
38=over 4
39
40=item B<-h|--help>
41
42Prints this help
43
44=item B<-v|--verbose>
45
46Print a brief help message and exits.
47
48=item B<-d|--distribution>
49
50The tuple for which to print the parameter value considered (by default current distribution)
51
52=item B<-p|--project project_name>
53
54Name of the project you're working on (or use the env variable PBPROJ)
55
56=back
57
58=head1 ARGUMENTS
59
60Arguments is mandatory and corresponds to the parameter whose value is requested for the related distribution tuple.
61
62=head1 WEB SITES
63
64The 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
68Cf: 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
72Uses 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
76The 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
80Project-Builder.org is distributed under the GPL v2.0 license
81described in the file C<COPYING> included with the distribution.
82
83=cut
84
85my %opts; # CLI Options
86
87GetOptions(
88 "verbose|v+" => \$opts{'v'},
89 "help|h" => \$opts{'h'},
90 "project|p=s" => \$opts{'p'},
91 "distribution|d" => \$opts{'d'},
92);
93if (defined $opts{'v'}) {
94 $pbdebug = $opts{'v'};
95}
96pb_log_init($pbdebug, \*STDOUT);
97
98my $dist = $opts{'d'};
99pb_env_init($opts{'p'},0,"none",0);
100my $pbos = pb_distro_get_context($dist);
101foreach my $r (pb_distro_get_param($pbos,pb_conf_get(@ARGV))) {
102 print "$r\n";
103}
Note: See TracBrowser for help on using the repository browser.