[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 |
|
---|
[1071] | 30 | pbdistrocheck [-d][-v][-l [-c][-i][-r][-a]][-s] [distro-ver-arch]
|
---|
[969] | 31 |
|
---|
| 32 | =head1 OPTIONS
|
---|
| 33 |
|
---|
| 34 | =over 4
|
---|
| 35 |
|
---|
| 36 | =item B<-v|--verbose>
|
---|
| 37 |
|
---|
| 38 | Print a brief help message and exits.
|
---|
| 39 |
|
---|
[1071] | 40 | =item B<-a|--all>
|
---|
| 41 |
|
---|
| 42 | print all parameters
|
---|
| 43 |
|
---|
| 44 | =item B<-s|--short>
|
---|
| 45 |
|
---|
| 46 | generate a short format user friendly, comma separated allowing parsing
|
---|
| 47 |
|
---|
| 48 | =item B<-l|--lsb>
|
---|
| 49 |
|
---|
| 50 | generate an LSB compliant output
|
---|
| 51 |
|
---|
[969] | 52 | =item B<-d|--description>
|
---|
| 53 |
|
---|
[1071] | 54 | print only description (LSB only)
|
---|
[969] | 55 |
|
---|
[1071] | 56 | =item B<-r|--release>
|
---|
| 57 |
|
---|
| 58 | print only release (LSB only)
|
---|
| 59 |
|
---|
| 60 | =item B<-c|--codename>
|
---|
| 61 |
|
---|
| 62 | print only codename (LSB only)
|
---|
| 63 |
|
---|
| 64 | =item B<-i|--id>
|
---|
| 65 |
|
---|
| 66 | print only distribution identificator (LSB only)
|
---|
| 67 |
|
---|
| 68 | =item B<-a|--all>
|
---|
| 69 |
|
---|
| 70 | print all LSB fields
|
---|
| 71 |
|
---|
[969] | 72 | =back
|
---|
| 73 |
|
---|
| 74 | =head1 ARGUMENTS
|
---|
| 75 |
|
---|
| 76 | arguments are optional. If none given, analyzes the underlying operating system
|
---|
| 77 | 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.
|
---|
| 78 |
|
---|
| 79 | =head1 WEB SITES
|
---|
| 80 |
|
---|
| 81 | 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/>.
|
---|
| 82 |
|
---|
| 83 | =head1 USER MAILING LIST
|
---|
| 84 |
|
---|
| 85 | 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.
|
---|
| 86 |
|
---|
| 87 | =head1 CONFIGURATION FILES
|
---|
| 88 |
|
---|
| 89 | Uses the main /etc/pb/pb.conf (or /usr/local/etc/pb/pb.conf if installed from files) configuration file to give its answers.
|
---|
| 90 |
|
---|
| 91 | =head1 AUTHORS
|
---|
| 92 |
|
---|
| 93 | The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
|
---|
| 94 |
|
---|
| 95 | =head1 COPYRIGHT
|
---|
| 96 |
|
---|
| 97 | Project-Builder.org is distributed under the GPL v2.0 license
|
---|
| 98 | described in the file C<COPYING> included with the distribution.
|
---|
| 99 |
|
---|
| 100 | =cut
|
---|
| 101 |
|
---|
[423] | 102 | my %opts; # CLI Options
|
---|
| 103 |
|
---|
[839] | 104 | GetOptions(
|
---|
| 105 | "verbose|v+" => \$opts{'v'},
|
---|
[1071] | 106 | "short|s" => \$opts{'s'},
|
---|
| 107 | "description|d" => \$opts{'d'},
|
---|
| 108 | "id|i" => \$opts{'i'},
|
---|
| 109 | "release|r" => \$opts{'r'},
|
---|
| 110 | "codename|c" => \$opts{'c'},
|
---|
| 111 | "all|a" => \$opts{'a'},
|
---|
| 112 | "lsb|l" => \$opts{'l'},
|
---|
[839] | 113 | );
|
---|
[423] | 114 | if (defined $opts{'v'}) {
|
---|
[495] | 115 | $pbdebug = $opts{'v'};
|
---|
[423] | 116 | }
|
---|
[1071] | 117 | pb_log_init($pbdebug, \*STDOUT);
|
---|
[423] | 118 |
|
---|
[969] | 119 | my $dist = shift @ARGV || undef ;
|
---|
[1177] | 120 | my $pbos = pb_distro_get_context($dist);
|
---|
[1071] | 121 | my $sep = "\n";
|
---|
| 122 | if (defined $opts{'l'}) {
|
---|
| 123 | # Simulate lsb_release output
|
---|
| 124 | my ($l,$i,$d,$r,$c) = pb_distro_getlsb($opts{'s'});
|
---|
| 125 | $sep = " " if (defined $opts{'s'});
|
---|
| 126 | print $l.$sep;
|
---|
| 127 | print $i.$sep if (defined $opts{'i'} or defined $opts{'a'});
|
---|
| 128 | print $d.$sep if (defined $opts{'d'} or defined $opts{'a'});
|
---|
| 129 | print $r.$sep if (defined $opts{'r'} or defined $opts{'a'});
|
---|
| 130 | $sep = "" if (defined $opts{'s'});
|
---|
| 131 | print $c.$sep if (defined $opts{'c'} or defined $opts{'a'});
|
---|
| 132 | print "\n" if (defined $opts{'s'});
|
---|
[839] | 133 | } else {
|
---|
[1071] | 134 | $sep = "," if (defined $opts{'s'});
|
---|
| 135 | if (not defined $opts{'s'}) {
|
---|
[1177] | 136 | $pbos->{'os'} = "OS:\t$pbos->{'os'}";
|
---|
| 137 | $pbos->{'name'} = "Name:\t$pbos->{'name'}";
|
---|
| 138 | $pbos->{'version'} = "Ver:\t$pbos->{'version'}";
|
---|
| 139 | $pbos->{'family'} = "Family:\t$pbos->{'family'}";
|
---|
| 140 | $pbos->{'type'} = "Type:\t$pbos->{'type'}";
|
---|
| 141 | $pbos->{'suffix'} = "Suffix:\t$pbos->{'suffix'}";
|
---|
| 142 | $pbos->{'update'} = "Update:\t$pbos->{'update'}";
|
---|
| 143 | $pbos->{'install'} = "Install:\t$pbos->{'install'}";
|
---|
| 144 | $pbos->{'arch'} = "Arch:\t$pbos->{'arch'}";
|
---|
[1071] | 145 | print "Project-Builder tuple:\n";
|
---|
| 146 | }
|
---|
[1177] | 147 | print join($sep,($pbos->{'os'}, $pbos->{'name'}, $pbos->{'version'}, $pbos->{'arch'}, $pbos->{'type'}, $pbos->{'family'}, $pbos->{'suffix'}, $pbos->{'update'}, $pbos->{'install'}))."\n";
|
---|
[839] | 148 | }
|
---|