source: ProjectBuilder/devel/pb-modules/bin/pbdistrocheck@ 969

Last change on this file since 969 was 969, checked in by Bruno Cornec, 14 years ago
  • Fix a bug for suffix computation, following the change of interface for pb_distro_get_param
  • pbdistrocheck now has a man page. Build files adapted accordingly
File size: 2.6 KB
Line 
1#!/usr/bin/perl -w
2#
3# Project Builder Distribution Checker
4#
5# $Id$
6#
7# Copyright B. Cornec 2007
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);
14use ProjectBuilder::Distribution;
15use ProjectBuilder::Base;
16
17=pod
18
19=head1 NAME
20
21pb, aka project-builder.org - builds packages for your projects
22
23=head1 DESCRIPTION
24
25pb helps you build various packages directly from your project sources.
26pbdistrocheck is a command from the pb project providing the same type of services as lsb_release, but extended.
27
28=head1 SYNOPSIS
29
30pbdistrocheck [-d][-v] [distro-ver-arch]
31
32=head1 OPTIONS
33
34=over 4
35
36=item B<-v|--verbose>
37
38Print a brief help message and exits.
39
40=item B<-d|--description>
41
42generate a short format user friendly
43(by default, generate a longer format, comma separated allowing parsing)
44
45=back
46
47=head1 ARGUMENTS
48
49arguments are optional. If none given, analyzes the underlying operating system
50If one is given, it should have the format osname-version-architecture, and in that case pbdistrocheck will provide all the information related to that OS needed by pb.
51
52=head1 WEB SITES
53
54The 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/>.
55
56=head1 USER MAILING LIST
57
58Cf: 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.
59
60=head1 CONFIGURATION FILES
61
62Uses the main /etc/pb/pb.conf (or /usr/local/etc/pb/pb.conf if installed from files) configuration file to give its answers.
63
64=head1 AUTHORS
65
66The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
67
68=head1 COPYRIGHT
69
70Project-Builder.org is distributed under the GPL v2.0 license
71described in the file C<COPYING> included with the distribution.
72
73=cut
74
75my %opts; # CLI Options
76
77GetOptions(
78 "verbose|v+" => \$opts{'v'},
79 "description|d" => \$opts{'d'}
80);
81if (defined $opts{'v'}) {
82 $pbdebug = $opts{'v'};
83}
84if (defined $opts{'l'}) {
85 open(pbLOG,"> $opts{'l'}") || die "Unable to log to $opts{'l'}: $!";
86 $pbLOG = \*pbLOG;
87 $pbdebug = 0 if ($pbdebug == -1);
88 }
89pb_log_init($pbdebug, $pbLOG);
90
91my $dist = shift @ARGV || undef ;
92my @param = undef;
93@param = split(/-/,$dist) if (defined $dist);
94
95my ($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch) = pb_distro_init(@param);
96if (defined $opts{'d'}) {
97 print "\u$ddir $dver $arch\n";
98} else {
99 print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch))."\n";
100}
Note: See TracBrowser for help on using the repository browser.