Changeset 391 in ProjectBuilder for devel


Ignore:
Timestamp:
Apr 16, 2008, 3:24:40 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • pb: pod content for Distribution.pm and man page delivery
  • dploy: improved pb setup in progress
Location:
devel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/Makefile.PL

    r338 r391  
    1818    EXE_FILES     => [ qw( bin/pb bin/pbg bin/pbvi bin/pbdistrocheck ) ],
    1919    MAN1PODS      => { 'bin/pb' => '$(INST_MAN1DIR)/pb.$(MAN1EXT)', },
     20    MAN3PODS      => { 'lib/ProjectBuilder/Distribution.pm' => '$(INST_MAN3DIR)/ProjectBuilder::Distribution.$(MAN3EXT)', },
    2021);
  • devel/pb/lib/ProjectBuilder/Distribution.pm

    r329 r391  
    1919our @ISA = qw(Exporter);
    2020our @EXPORT = qw(pb_distro_init pb_get_distro);
     21
     22=pod
     23
     24=head1 NAME
     25
     26ProjectBuilder::Distribution, part of the project-builder.org - module dealing with distribution detection
     27
     28=head1 DESCRIPTION
     29
     30This 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
     59This 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
     61On my home machine it would currently report ("mandriva","2008.0").
     62
     63=item B<pb_distro_init>
     64
     65This 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
     67As an example, Ubuntu and Debian are in the same "du" family. As well as RedHat, RHEL, CentOS, fedora are on the same "rh" family.
     68Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu ad Debian have the same "deb" type of build system.
     69And "fc" is the extension generated for all Fedora packages (Version will be added by pb).
     70
     71When 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
     77The 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
     81None exists for the moment.
     82
     83=head1 AUTHORS
     84
     85The 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
     89Project-Builder.org is distributed under the GPL v2.0 license
     90described in the file C<COPYING> included with the distribution.
     91
     92=cut
     93
    2194
    2295sub pb_distro_init {
     
    115188# Tested
    116189    'gentoo'            =>  'gentoo-release',       # >= 1.6
    117     'debian'            =>  'debian_version',       # >= 3.1
    118190    'slackware'         =>  'slackware-version',    # >= 10.2
    119191    'mandriva'          =>  'mandriva-release',     # >=2006.0
     
    153225my %ambiguous_rel_files = (
    154226    'mandrake'          =>  'mandrake-release',     # <= 10.1
     227    'debian'            =>  'debian_version',       # >= 3.1
    155228    'suse'              =>  'SuSE-release',         # >= 10.0
    156229    'redhat'            =>  'redhat-release',       # >= 7.3
     
    162235my %distro_similar = (
    163236    'mandrake'          => ['mandrake', 'mandrakelinux'],
     237    'debian'            => ['debian', 'ubuntu'],
    164238    'suse'              => ['suse', 'sles', 'opensuse'],
    165239    'redhat'            => ['redhat', 'rhel', 'centos', 'mandrake', 'vmware'],
     
    183257    'suse'                  => 'SUSE LINUX (\d.+) \(',
    184258    'opensuse'              => 'openSUSE (\d.+) \(',
    185     'debian'                => '(.+)',
    186259    'lsb'                   => '.*[^Ubunt].*\nDISTRIB_RELEASE=(.+)',
    187260# Ubuntu 6.06 includes a /etc/debian_version file that needs to be
     
    190263# Same is true for Ubuntu 7.10 :-(
    191264    'ubuntu'                => '.*Ubuntu.*\nDISTRIB_RELEASE=(.+)',
     265    'debian'                => '(.+)',
    192266# Not tested
    193267    'arch'                  => '.* ([0-9.]+) .*',
     
    198272my $distro;
    199273
    200 # Begin to test presence of non-amiguous files
     274# Begin to test presence of non-ambiguous files
    201275# that way we reduce the choice
    202276my ($d,$r);
Note: See TracChangeset for help on using the changeset viewer.