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