NAME

CPANPLUS::Dist::Debora - Create Debian or RPM packages from Perl modules

VERSION

version 0.015

SYNOPSIS

### from the cpanp interactive shell
$ cpanp
CPAN Terminal> i Some-Module --format=CPANPLUS::Dist::Debora

### using the command-line tool
$ cpan2dist --format CPANPLUS::Dist::Debora Some-Module

$ cd ~/rpmbuild/RPMS/noarch
$ sudo rpm -i perl-Some-Module-1.0-1.noarch.rpm

$ cd ~/.cpanplus/5.36.1/build/XXXX
$ sudo dpkg -i libsome-module-perl_1.0-1cpanplus_all.deb

DESCRIPTION

This CPANPLUS plugin creates Debian or RPM packages from Perl distributions. The created packages can be installed with CPANPLUS, dpkg or rpm.

Usage

Install Perl distributions from an interactive shell. The sudo command must be installed and configured.

$ cpanp
CPAN Terminal> i Some-Module --format=CPANPLUS::Dist::Debora

Or create packages from the command-line.

$ cpan2dist --format CPANPLUS::Dist::Debora Some-Module

Configuration

Start an interactive shell to edit the CPANPLUS settings.

$ cpanp

Signature checks might be enabled by default, but many Perl distributions do not provide signatures.

CPAN Terminal> s conf signature 0

Some Perl distributions fail to show interactive prompts if the verbose option is not set.

CPAN Terminal> s conf verbose 1

CPANPLUS uses less memory if the SQLite backend is enabled.

CPAN Terminal> s conf source_engine CPANPLUS::Internals::Source::SQLite

Make CPANPLUS::Dist::Debora your default format by setting the dist_type key.

CPAN Terminal> s conf dist_type CPANPLUS::Dist::Debora

Make your changes permanent.

CPAN Terminal> s save

Other settings such as your CPAN mirror can be set interactively.

CPAN Terminal> s reconfigure

The settings are stored in ~/.cpanplus/lib/CPANPLUS/Config/User.pm.

FREQUENTLY ASKED QUESTIONS

How can I install a specific version of a Perl distribution?

Append the version to the distribution name.

cpanp i Some-Module-0.9

How can I install a Perl distribution from the local filesystem?

Use a file URI.

cpanp i file:///tmp/Some-Module-1.0.tar.gz
rm ~/.cpanplus/authors/id/UNKNOWN-ORIGIN/Some-Module-1.0.tar.gz

How can I list packages installed with CPANPLUS?

dpkg-query -W -f '${Package} ${Version}\n' | \
perl -anE 'say $F[0] if $F[1] =~ /cpanplus/' | sort

rpm -qa --qf '%{NAME} %{VENDOR}\n' | \
perl -anE 'say $F[0] if $F[1] =~ /CPANPLUS/' | sort

How can I force a manual update of the CPAN indices?

cpanp x --update_source

SUBROUTINES/METHODS

format_available

my $is_available = CPANPLUS::Dist::Debora->format_available;

Returns a boolean indicating whether or not the required package management tools are available.

init

my $ok = $dist->init;

Sets up the CPANPLUS::Dist::Debora object for use. Called automatically whenever a new object is created.

prepare

my $ok = $dist->prepare(verbose => 0|1);

Runs perl Makefile.PL or perl Build.PL and determines what prerequisites this distribution declared.

create

my $ok = $dist->create(skiptest => 0|1, verbose => 0|1);

Builds the prepared distribution, runs the test suite and creates the package. Also attempts to satisfy any prerequisites the module may have.

install

my $ok = $dist->install(verbose => 0|1);

Installs the created package with sudo and dpkg or rpm. If the package is already installed on the system, the existing package will be replaced by the new package.

DIAGNOSTICS

open3: exec failed: Argument list too long

CPANPLUS can hit this limit if hundreds of Perl distributions are built in one run. Rerun CPANPLUS or build your packages in chunks.

Could not run 'COMMAND'

A system command such as dpkg or rpm could not be run.

Could not render TEMPLATE

A template could not be filled in.

Could not create 'FILE'

A file could not be created.

Could not stat 'FILE'

File permissions could not be read.

Could not chmod 'FILE'

File permissions could not be set.

Could not remove 'FILE'

A file could not be removed.

Could not traverse 'DIR'

A directory could not be traversed.

File not found 'FILE'

A file does not exist or was removed while CPANPLUS was running.

Unknown installer type

CPANPLUS::Dist::Debora supports CPANPLUS::Dist::Build and CPANPLUS::Dist::MM.

CONFIGURATION AND ENVIRONMENT

All files and environment variables have to be encoded in ASCII or UTF-8.

Files

~/.rpmmacros

The macros %packager, %distribution and %vendor are used. RPM packages are stored in %{_topdir}/RPMS.

/etc/os-release, /usr/lib/os-release

The os-release files are read unless the macro %distribution is set.

/var/lib/dpkg/available

The Debian package epochs are read from /var/lib/dpkg/available.

Environment variables

BUILD

The build number that is added to packages as a Debian revision or RPM release. Defaults to 1.

As packages may be built recursively, setting this variable is mainly useful when all packages are rebuilt after Perl has been upgraded.

EPOCH

On RPM-based systems, you might have to set the package epoch manually as there is no standardized database that can be queried for epochs. On Debian-based systems, it is generally not necessary to set epochs manually. Defaults to no package epoch.

DEBFULLNAME, NAME, GITLAB_USER_NAME

The packager's name.

DEBEMAIL, EMAIL, GITLAB_USER_EMAIL

The packager's email address.

If the packager's name is unavailable and if the email address has got the format "name <address>", the name is taken from the email address.

If the packager's name cannot be extracted from the environment, the name is taken from the gecos field in the password database.

INSTALLDIRS

The installation location. Can be "vendor" or "site". Defaults to "vendor".

SOURCE_DATE_EPOCH

Clamps timestamps to the specified Unix time. If not set, the last modification time of the source is used.

DEPENDENCIES

Requires Perl 5.16 and the modules CPANPLUS, CPANPLUS::Dist::Build, Module::Pluggable, Software::License and Text::Template from CPAN. IPC::Run and Term::ReadLine::Gnu are recommended.

On Debian-based systems, install the packages "perl", "build-essential", "debhelper", "fakeroot" and "sudo". The minimum supported debhelper version is 12.

On RPM-based systems, install the packages "perl", "rpm-build", "gcc", "make", "sudo" and, if available, "perl-devel" and "perl-generators".

INCOMPATIBILITIES

None.

BUGS AND LIMITATIONS

You have to install the appropriate development packages yourself if you would like to build Perl distributions that require C libraries. For example, install the package "libssl-dev" or "openssl-devel" if the distribution uses the OpenSSL libraries.

Enable verbose mode (see above) if you would like to get feedback while CPANPLUS downloads the list of Perl distributions from the Comprehensive Perl Archive Network (CPAN). Use CPAN::Mini or a repository manager to mirror the CPAN locally.

Some Perl distributions fail to show interactive prompts if the verbose option is not set.

Software::LicenseUtils recognizes a lot of common licenses but isn't perfect.

SEE ALSO

cpanp(1), cpan2dist(1), sudo(8)

AUTHOR

Andreas Vögele <voegelas@cpan.org>

LICENSE AND COPYRIGHT

Copyright (C) 2024 Andreas Vögele

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.