NAME
CPANPLUS::Dist::Debora::Package - Base class for package formats
VERSION
version 0.007
SYNOPSIS
use parent qw(CPANPLUS::Dist::Debora::Package);
my $name = $package->name;
my $version = $package->version;
my $summary = $package->summary;
my $description = $package->description;
my @licenses = @{$package->licenses};
my @dependencies = @{$package->dependencies};
my @files = @{$package->files};
DESCRIPTION
This module collects information on a yet to be created Debian or RPM package. The information is obtained from a CPANPLUS::Module object, the file system and the environment. Among other things, the module gets the package name, a short summary, a description, the license and the dependencies.
SUBROUTINES/METHODS
Any methods marked Abstract must be implemented by subclasses.
new
my $package = CPANPLUS::Dist::Debora::Package->new(
module => $module,
installdirs => 'vendor',
build_number => 1,
);
Creates a new object. The CPANPLUS::Module object parameter is mandatory. All other attributes are optional.
format_priority Abstract
my $priority = CPANPLUS::Dist::Debora::Package->format_priority;
Checks whether the package format is available. Returns 0 if the required package tools are not available, 1 if the tools are available and 2 or higher if the format is the operating system's native format.
create Abstract
my $ok = $package->create(verbose => 0|1);
Creates a package.
install Abstract
my $ok = $package->install(verbose => 0|1);
Installs the package.
outputname Abstract
my $outputname = $package->outputname;
Returns the package filename, e.g. ~/rpmbuild/RPMS/noarch/perl-Some-Module-1.0-1.noarch.rpm.
module
my $module = $package->module;
Returns the CPANPLUS::Module object that was passed to the constructor.
installdirs
my $installdirs = $package->installdirs;
Returns the installation location, which can be "vendor" or "site". Defaults to "vendor".
sourcefile
my $sourcefile = $package->sourcefile;
Returns the path to the Perl distribution's source archive, e.g. ~/.cpanplus/authors/id/S/SO/SOMEBODY/Some-Module-1.0.tar.gz.
sourcedir
my $sourcedir = $package->sourcedir;
Returns the path to the Perl distribution's source directory, e.g. ~/.cpanplus/authors/id/S/SO/SOMEBODY.
last_modification
my $timestamp = $package->last_modification;
Returns the last modification time of the source.
builddir
my $builddir = $package->builddir;
Returns the directory the source archive was extracted to, e.g. ~/.cpanplus/5.34.0/build/XXXX/Some-Module-1.0.
outputdir
my $outputdir = $package->outputdir;
Returns the build directory's parent directory, e.g. ~/.cpanplus/5.34.0/build/XXXX.
stagingdir
my $stagingdir = $package->stagingdir;
Returns the staging directory where CPANPLUS installs the Perl distribution, e.g. ~/.cpanplus/5.34.0/build/XXXX/stagingYYYY.
is_noarch
my $is_no_arch = $package->is_noarch;
Returns true if the package is independent of the hardware architecture.
This method must only be called after the distribution has been built.
module_name
my $module_name = $package->module_name;
Returns the name of the package's main module, e.g. "Some::Module".
dist_name
my $dist_name = $package->dist_name;
Returns the Perl distribution's name, e.g. "Some-Module".
name
my $name = $package->name;
Returns the package name, e.g. "perl-Some-Module" or "libsome-module-perl".
dist_version
my $dist_name = $package->dist_name;
Returns the Perl distribution's version.
version
my $version = $package->version;
Returns the package version.
build_number
my $build_number = $package->build_number;
Returns the build number. Defaults to 1.
The Debian revision and RPM release starts with the build number.
author
my $author = $package->author;
Returns the name of the Perl distribution's author.
packager
my $packager = $package->packager;
Returns the packager's name and email address. Taken from the RPM macro %packager, the environment variables DEBFULLNAME
, DEBEMAIL
, NAME
, EMAIL
or the password database. All environment variables and files have to be encoded in ASCII or UTF-8.
vendor
my $vendor = $package->vendor;
Returns "CPANPLUS" or the value of the RPM macro %vendor
.
url
my $url = $package->url;
Returns a web address that links to the Perl distribution's documentation, e.g. "https://metacpan.org/dist/Some-Module".
summary
my $summary = $package->summary;
Returns the Perl distribution's one-line description.
description
my $description = $package->description;
Returns the Perl distribution's description.
dependencies
for my $dependency (@{$package->dependencies}) {
my $module_name = $dependency->{module_name};
my $dist_name = $dependency->{dist_name};
my $package_name = $dependency->{package_name};
my $version = $dependency->{version};
my $is_core = $dependency->{is_core};
my $is_module = $dependency->{is_module};
}
Builds a list of Perl modules that the package depends on.
copyrights
for my $copyright (@{$package->copyrights}) {
my $year = $copyright->{year};
my $holder = $copyright->{holder};
}
Returns the copyright years and holders.
licenses
for my $license (@{$package->licenses}) {
my $full_text = $license->license;
}
Returns Software::License objects.
license
my $license = $package->license;
Returns a license identifier, e.g. "Artistic-1.0-Perl OR GPL-1.0-or-later". Returns "Unknown" if no license information was found.
files
for my $file (@{$package->files}) {
my $name = $file->{name};
my $type = $file->{type};
}
Builds a list of files that CPANPLUS installed in the staging directory. Searches the build directory for README, LICENSE and other documentation files.
Possible types are "changelog", "config", "dir", "doc", "file", "license", "link" and "man".
files_by_type
for my $file (@{$package->files_by_type($type)}) {
my $name = $file->{name};
}
Returns all files of the given type.
mb_opt
local $ENV{PERL_MB_OPT} = $package->mb_opt;
Returns the options that are passed to perl Build.PL
.
mm_opt
local $ENV{PERL_MM_OPT} = $package->mm_opt;
Returns the options that are passed to perl Makefile.PL
.
sanitize_stagingdir
my $ok = $package->sanitize_stagingdir;
Fixes permissions. Removes empty directories and files like perllocal.pod and .packlist.
remove_stagingdir
my $ok = $package->remove_stagingdir;
Removes the staging directory.
rpm_cmd
my $rpm_cmd = $self->rpm_cmd;
Returns the path to the rpm command.
rpm_eval
my $expr = '%{?packager}';
my $string = $package->rpm_eval($expr);
Evaluates an expression with rpm and returns the result or the empty string.
sudo_cmd
my $sudo_cmd = $self->sudo_cmd;
Returns the path to the sudo command.
DIAGNOSTICS
See CPANPLUS::Dist::Debora for diagnostics.
CONFIGURATION AND ENVIRONMENT
See CPANPLUS::Dist::Debora for supported files and environment variables.
DEPENDENCIES
Requires the module Software::License from CPAN.
INCOMPATIBILITIES
None.
SEE ALSO
CPANPLUS::Dist::Debora::Package::Debian, CPANPLUS::Dist::Debora::Package::RPM, CPANPLUS::Dist::Debora::Package::Tar, CPANPLUS::Dist::Debora::License, CPANPLUS::Dist::Debora::Pod, CPANPLUS::Dist::Debora::Util
AUTHOR
Andreas Vögele <voegelas@cpan.org>
BUGS AND LIMITATIONS
Some operating systems numify Perl distribution versions but not consistently. This module sticks closely to the version string, which seems to be the most common approach.
This module cannot be used in taint mode.
LICENSE AND COPYRIGHT
Copyright 2022 Andreas Vögele
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.