Changeset 395 in ProjectBuilder for devel/pb/lib/ProjectBuilder/Distribution.pm


Ignore:
Timestamp:
Apr 18, 2008, 7:32:09 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Move all reusable functions into Base
  • Move all pb only functions into pb
  • pod doc for Base begining
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/lib/ProjectBuilder/Distribution.pm

    r391 r395  
    99
    1010use strict;
     11use ProjectBuilder::Base;
    1112
    1213# Inherit from the "Exporter" module which handles exporting functions.
     
    5556=over 4
    5657
     58
    5759=item B<pb_get_distro>
    5860
     
    6163On my home machine it would currently report ("mandriva","2008.0").
    6264
    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 
    9265=cut
    93 
    9466
    9567sub pb_distro_init {
     
    176148}
    177149
     150=item B<pb_distro_init>
     151
     152This 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.
     153
     154As an example, Ubuntu and Debian are in the same "du" family. As well as RedHat, RHEL, CentOS, fedora are on the same "rh" family.
     155Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu ad Debian have the same "deb" type of build system.
     156And "fc" is the extension generated for all Fedora packages (Version will be added by pb).
     157
     158When 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.
     159
     160Cf: http://linuxmafia.com/faq/Admin/release-files.html
     161Ideas taken from http://search.cpan.org/~kerberus/Linux-Distribution-0.14/lib/Linux/Distribution.pm
     162
     163=cut
     164
    178165sub pb_get_distro {
    179 
    180 # Cf: http://linuxmafia.com/faq/Admin/release-files.html
    181 # Ideas taken from
    182 # http://search.cpan.org/~kerberus/Linux-Distribution-0.14/lib/Linux/Distribution.pm
    183166
    184167my $base="/etc";
     
    325308}
    326309
    327 # get content of a file in a variable
    328 sub pb_get_content {
    329 
    330 my $file=shift;
    331 
    332 my $bkp = $/;
    333 undef $/;
    334 open(R,$file) || die "Unable to open $file: $!";
    335 my $content=<R>;
    336 close(R);
    337 chomp($content);
    338 $/ = $bkp;
    339 return($content);
    340 }
     310=back
     311
     312=head1 WEB SITES
     313
     314The 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/>.
     315
     316=head1 USER MAILING LIST
     317
     318None exists for the moment.
     319
     320=head1 AUTHORS
     321
     322The Project-Builder.org team L<http://trac.project-builder.org/> lead by Bruno Cornec L<mailto:bruno@project-builder.org>.
     323
     324=head1 COPYRIGHT
     325
     326Project-Builder.org is distributed under the GPL v2.0 license
     327described in the file C<COPYING> included with the distribution.
     328
     329=cut
     330
     331
    3413321;
Note: See TracChangeset for help on using the changeset viewer.