| [176] | 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 |
|
|---|
| 10 | use strict 'vars';
|
|---|
| [423] | 11 | use Getopt::Long qw(:config auto_abbrev no_ignore_case);
|
|---|
| [176] | 12 | use Data::Dumper;
|
|---|
| 13 | use lib qw (lib);
|
|---|
| [423] | 14 | use ProjectBuilder::Distribution;
|
|---|
| 15 | use ProjectBuilder::Base;
|
|---|
| [176] | 16 |
|
|---|
| [969] | 17 | =pod
|
|---|
| 18 |
|
|---|
| 19 | =head1 NAME
|
|---|
| 20 |
|
|---|
| 21 | pb, aka project-builder.org - builds packages for your projects
|
|---|
| 22 |
|
|---|
| 23 | =head1 DESCRIPTION
|
|---|
| 24 |
|
|---|
| 25 | pb helps you build various packages directly from your project sources.
|
|---|
| 26 | pbdistrocheck is a command from the pb project providing the same type of services as lsb_release, but extended.
|
|---|
| 27 |
|
|---|
| 28 | =head1 SYNOPSIS
|
|---|
| 29 |
|
|---|
| 30 | pbdistrocheck [-d][-v] [distro-ver-arch]
|
|---|
| 31 |
|
|---|
| 32 | =head1 OPTIONS
|
|---|
| 33 |
|
|---|
| 34 | =over 4
|
|---|
| 35 |
|
|---|
| 36 | =item B<-v|--verbose>
|
|---|
| 37 |
|
|---|
| 38 | Print a brief help message and exits.
|
|---|
| 39 |
|
|---|
| 40 | =item B<-d|--description>
|
|---|
| 41 |
|
|---|
| 42 | generate a short format user friendly
|
|---|
| 43 | (by default, generate a longer format, comma separated allowing parsing)
|
|---|
| 44 |
|
|---|
| 45 | =back
|
|---|
| 46 |
|
|---|
| 47 | =head1 ARGUMENTS
|
|---|
| 48 |
|
|---|
| 49 | arguments are optional. If none given, analyzes the underlying operating system
|
|---|
| 50 | If 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 |
|
|---|
| 54 | 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/>.
|
|---|
| 55 |
|
|---|
| 56 | =head1 USER MAILING LIST
|
|---|
| 57 |
|
|---|
| 58 | 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.
|
|---|
| 59 |
|
|---|
| 60 | =head1 CONFIGURATION FILES
|
|---|
| 61 |
|
|---|
| 62 | Uses 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 |
|
|---|
| 66 | The 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 |
|
|---|
| 70 | Project-Builder.org is distributed under the GPL v2.0 license
|
|---|
| 71 | described in the file C<COPYING> included with the distribution.
|
|---|
| 72 |
|
|---|
| 73 | =cut
|
|---|
| 74 |
|
|---|
| [423] | 75 | my %opts; # CLI Options
|
|---|
| 76 |
|
|---|
| [839] | 77 | GetOptions(
|
|---|
| 78 | "verbose|v+" => \$opts{'v'},
|
|---|
| 79 | "description|d" => \$opts{'d'}
|
|---|
| 80 | );
|
|---|
| [423] | 81 | if (defined $opts{'v'}) {
|
|---|
| [495] | 82 | $pbdebug = $opts{'v'};
|
|---|
| [423] | 83 | }
|
|---|
| 84 | if (defined $opts{'l'}) {
|
|---|
| [495] | 85 | open(pbLOG,"> $opts{'l'}") || die "Unable to log to $opts{'l'}: $!";
|
|---|
| 86 | $pbLOG = \*pbLOG;
|
|---|
| 87 | $pbdebug = 0 if ($pbdebug == -1);
|
|---|
| [423] | 88 | }
|
|---|
| [495] | 89 | pb_log_init($pbdebug, $pbLOG);
|
|---|
| [423] | 90 |
|
|---|
| [969] | 91 | my $dist = shift @ARGV || undef ;
|
|---|
| 92 | my @param = undef;
|
|---|
| 93 | @param = split(/-/,$dist) if (defined $dist);
|
|---|
| 94 |
|
|---|
| [1064] | 95 | my ($ddir, $dver, $dfam, $dtype, $dos, $pbsuf, $pbupd, $arch) = pb_distro_init(@param);
|
|---|
| [839] | 96 | if (defined $opts{'d'}) {
|
|---|
| [969] | 97 | print "\u$ddir $dver $arch\n";
|
|---|
| [839] | 98 | } else {
|
|---|
| 99 | print "distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf, $pbupd, $arch))."\n";
|
|---|
| 100 | }
|
|---|