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