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