ProjectBuilder::Distribution, part of the project-builder.org - module dealing with distribution detection
This modules provides functions to allow detection of Linux distributions, and giving back some attributes concerning them.
use ProjectBuilder::Distribution; # # Return information on the running distro # my $pbos = pb_distro_get_context(); print "distro tuple: ".Dumper($pbos->name, $pbos->ver, $pbos->fam, $pbos->type, $pbos->pbsuf, $pbos->pbupd, $pbos->pbins, $pbos->arch)."\n"; # # Return information on the requested distro # my $pbos = pb_distro_get_context("ubuntu-7.10-x86_64"); print "distro tuple: ".Dumper($pbos->name, $pbos->ver, $pbos->fam, $pbos->type, $pbos->pbsuf, $pbos->pbupd, $pbos->pbins, $pbos->arch)."\n"; # # Return information on the running distro # my ($ddir,$dver) = pb_distro_get();
This function returns the mandatory configuration file used for distribution/OS detection
This function returns a hash of parameters indicating the distribution name, version, family, type of build system, suffix of packages, update command line, installation command line and architecture of the underlying Linux distribution. The value of the fields may be "unknown" in case the function was unable to recognize on which distribution it is running.
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. Mandriva, Open SuSE and Fedora have all the same "rpm" type of build system. Ubuntu and Debian have the same "deb" type of build system. And "fc" is the extension generated for all Fedora packages (Version will be added by pb). All this information is stored in an external configuration file typically at /etc/pb/pb.conf
When passing the distribution name and version as parameters, the pb_distro_init function returns the parameter of that distribution instead of the underlying one.
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.
On my home machine it would currently report ("mandriva","2010.2").
This function returns the 5 lsb values LSB version, distribution ID, Description, release and codename. As entry it takes an optional parameter to specify whether the output is short or not.
This function install the dependencies required to build the package on a distro. Dependencies can be passed as a parameter in which case they are not computed
This function computes the dependencies indicated in the build file and return them as a string of packages to install
This function returns only the dependencies not yet installed
This function sets up potential additional repository for the setup phase
This function sets up potential additional repository to the build environment
This function sets up in a generic way potential additional repository
Given a pbos object (first param) and the generic key (second param), get the list of possible keys for looking up variable for filter names. The list will be sorted most-specific to least specific.
This function gets the parameter in the conf file from the most precise tuple up to default
This function gets the OS context passed as parameter and return the corresponding distribution hash If passed undef or "" then auto-detects
None exists for the moment.
Project-Builder.org is distributed under the GPL v2.0 license described in the file
COPYING included with the distribution.