- Timestamp:
- Apr 16, 2008, 3:24:40 PM (17 years ago)
- Location:
- devel/pb
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/Makefile.PL
r338 r391 18 18 EXE_FILES => [ qw( bin/pb bin/pbg bin/pbvi bin/pbdistrocheck ) ], 19 19 MAN1PODS => { 'bin/pb' => '$(INST_MAN1DIR)/pb.$(MAN1EXT)', }, 20 MAN3PODS => { 'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)', }, 20 21 ); -
devel/pb/lib/ProjectBuilder/Distribution.pm
r329 r391 19 19 our @ISA = qw(Exporter); 20 20 our @EXPORT = qw(pb_distro_init pb_get_distro); 21 22 =pod 23 24 =head1 NAME 25 26 ProjectBuilder::Distribution, part of the project-builder.org - module dealing with distribution detection 27 28 =head1 DESCRIPTION 29 30 This modules provides functions to allow detection of Linux distributions, and giving back some attributes concerning them. 31 32 =head1 SYNOPSIS 33 34 use ProjectBuilder::Distribution; 35 36 # 37 # Return information on the running distro 38 # 39 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init(); 40 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf)."\n"; 41 # 42 # Return information on the requested distro 43 # 44 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init("ubuntu","7.10"); 45 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf)."\n"; 46 # 47 # Return information on the running distro 48 # 49 my ($ddir,$dver) = pb_get_distro(); 50 my ($ddir, $dver, $dfam, $dtype, $pbsuf) = pb_distro_init($ddir,$dver); 51 print "distro tuple: ".Dumper($ddir, $dver, $dfam, $dtype, $pbsuf)."\n"; 52 53 =head1 USAGE 54 55 =over 4 56 57 =item B<pb_get_distro> 58 59 This function returns a list of 2 parameters indicating the distribution name and version of the underlying Linux distribution. The value of those 2 fields may be "unknown" in case the function was unable to recognize on which distribution it is running. 60 61 On my home machine it would currently report ("mandriva","2008.0"). 62 63 =item B<pb_distro_init> 64 65 This function returns a list of 5 parameters indicating the distribution name, version, family, type of build system and suffix of packages of the underlying Linux distribution. The value of the 5 fields may be "unknown" in case the function was unable to recognize on which distribution it is running. 66 67 As an example, Ubuntu and Debian are in the same "du" family. As well as RedHat, RHEL, CentOS, fedora are on the same "rh" family. 68 Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu ad Debian have the same "deb" type of build system. 69 And "fc" is the extension generated for all Fedora packages (Version will be added by pb). 70 71 When passing the distribution name and version as parameters, the B<pb_distro_init> function returns the parameter of that distribution instead of the underlying one. 72 73 =back 74 75 =head1 WEB SITES 76 77 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/>. 78 79 =head1 USER MAILING LIST 80 81 None exists for the moment. 82 83 =head1 AUTHORS 84 85 The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>. 86 87 =head1 COPYRIGHT 88 89 Project-Builder.org is distributed under the GPL v2.0 license 90 described in the file C<COPYING> included with the distribution. 91 92 =cut 93 21 94 22 95 sub pb_distro_init { … … 115 188 # Tested 116 189 'gentoo' => 'gentoo-release', # >= 1.6 117 'debian' => 'debian_version', # >= 3.1118 190 'slackware' => 'slackware-version', # >= 10.2 119 191 'mandriva' => 'mandriva-release', # >=2006.0 … … 153 225 my %ambiguous_rel_files = ( 154 226 'mandrake' => 'mandrake-release', # <= 10.1 227 'debian' => 'debian_version', # >= 3.1 155 228 'suse' => 'SuSE-release', # >= 10.0 156 229 'redhat' => 'redhat-release', # >= 7.3 … … 162 235 my %distro_similar = ( 163 236 'mandrake' => ['mandrake', 'mandrakelinux'], 237 'debian' => ['debian', 'ubuntu'], 164 238 'suse' => ['suse', 'sles', 'opensuse'], 165 239 'redhat' => ['redhat', 'rhel', 'centos', 'mandrake', 'vmware'], … … 183 257 'suse' => 'SUSE LINUX (\d.+) \(', 184 258 'opensuse' => 'openSUSE (\d.+) \(', 185 'debian' => '(.+)',186 259 'lsb' => '.*[^Ubunt].*\nDISTRIB_RELEASE=(.+)', 187 260 # Ubuntu 6.06 includes a /etc/debian_version file that needs to be … … 190 263 # Same is true for Ubuntu 7.10 :-( 191 264 'ubuntu' => '.*Ubuntu.*\nDISTRIB_RELEASE=(.+)', 265 'debian' => '(.+)', 192 266 # Not tested 193 267 'arch' => '.* ([0-9.]+) .*', … … 198 272 my $distro; 199 273 200 # Begin to test presence of non-am iguous files274 # Begin to test presence of non-ambiguous files 201 275 # that way we reduce the choice 202 276 my ($d,$r);
Note:
See TracChangeset
for help on using the changeset viewer.