CPANPLUS::Dist::Debora::Package - Base class for package formats
version 0.012
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};
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.
Any methods marked Abstract must be implemented by subclasses.
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.
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.
my $ok = $package->create(verbose => 0|1);
Creates a package.
my $ok = $package->install(verbose => 0|1);
Installs the package.
my $outputname = $package->outputname;
Returns the package filename, e.g. ~/rpmbuild/RPMS/noarch/perl-Some-Module-1.0-1.noarch.rpm.
my $module = $package->module;
Returns the CPANPLUS::Module object that was passed to the constructor.
my $installdirs = $package->installdirs;
Returns the installation location, which can be "vendor" or "site". Defaults to "vendor".
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.
my $sourcedir = $package->sourcedir;
Returns the path to the Perl distribution's source directory, e.g. ~/.cpanplus/authors/id/S/SO/SOMEBODY.
my $timestamp = $package->last_modification;
Returns the last modification time of the source.
my $builddir = $package->builddir;
Returns the directory the source archive was extracted to, e.g. ~/.cpanplus/5.36.1/build/XXXX/Some-Module-1.0.
my $outputdir = $package->outputdir;
Returns the build directory's parent directory, e.g. ~/.cpanplus/5.36.1/build/XXXX.
my $stagingdir = $package->stagingdir;
Returns the staging directory where CPANPLUS installs the Perl distribution, e.g. ~/.cpanplus/5.36.1/build/XXXX/stagingYYYY.
for my $shared_object (@{$package->shared_objects}) { say $shared_object; }
Returns a list of shared object files in the staging directory.
This method must only be called after the distribution has been built.
my $is_no_arch = $package->is_noarch;
Returns true if the package is independent of the hardware architecture.
my $module_name = $package->module_name;
Returns the name of the package's main module, e.g. "Some::Module".
my $dist_name = $package->dist_name;
Returns the Perl distribution's name, e.g. "Some-Module".
my $name = $package->name;
Returns the package name, e.g. "perl-Some-Module" or "libsome-module-perl".
Returns the Perl distribution's version.
my $version = $package->version;
Returns the package version.
my $build_number = $package->build_number;
Returns the build number. Defaults to 1.
The Debian revision and RPM release starts with the build number.
my $author = $package->author;
Returns the name of the Perl distribution's author.
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.
DEBFULLNAME
DEBEMAIL
NAME
EMAIL
my $vendor = $package->vendor;
Returns "CPANPLUS" or the value of the RPM macro %vendor.
%vendor
my $url = $package->url;
Returns a web address that links to the Perl distribution's documentation, e.g. "https://metacpan.org/dist/Some-Module".
my $summary = $package->summary;
Returns the Perl distribution's one-line description.
my $description = $package->description;
Returns the Perl distribution's description.
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.
for my $copyright (@{$package->copyrights}) { my $year = $copyright->{year}; my $holder = $copyright->{holder}; }
Returns the copyright years and holders.
for my $license (@{$package->licenses}) { my $full_text = $license->license; }
Returns Software::License objects.
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.
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".
for my $file (@{$package->files_by_type($type)}) { my $name = $file->{name}; }
Returns all files of the given type.
local $ENV{PERL_MB_OPT} = $package->mb_opt;
Returns the options that are passed to perl Build.PL.
perl Build.PL
local $ENV{PERL_MM_OPT} = $package->mm_opt;
Returns the options that are passed to perl Makefile.PL.
perl Makefile.PL
my $ok = $package->sanitize_stagingdir;
Fixes permissions. Removes empty directories and files like perllocal.pod and .packlist.
my $ok = $package->remove_stagingdir;
Removes the staging directory.
my $rpm_cmd = $self->rpm_cmd;
Returns the path to the rpm command.
my $expr = '%{?packager}'; my $string = $package->rpm_eval($expr);
Evaluates an expression with rpm and returns the result or the empty string.
my $sudo_cmd = $self->sudo_cmd;
Returns the path to the sudo command.
See CPANPLUS::Dist::Debora for diagnostics.
See CPANPLUS::Dist::Debora for supported files and environment variables.
Requires the module Software::License from CPAN.
None.
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.
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
Andreas Vögele <voegelas@cpan.org>
Copyright (C) 2023 Andreas Vögele
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install CPANPLUS::Dist::Debora, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CPANPLUS::Dist::Debora
CPAN shell
perl -MCPAN -e shell install CPANPLUS::Dist::Debora
For more information on module installation, please visit the detailed CPAN module installation guide.