Difference between revisions of "Perl Policy"
m |
|||
(11 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Package development | + | [[Category:Package development]] |
− | + | ||
− | + | ||
+ | = Note = | ||
+ | |||
+ | There seems to be some confusion where people think this policy is about packaging perl modules. This page covers the policy for how perl itself is configured and packaged. So the policy does influence module packaging especially where files will be installed. | ||
+ | |||
+ | For perl module packaging guidelines see [[Perl_Package_Guidelines]]. | ||
+ | |||
= Introduction = | = Introduction = | ||
− | |||
− | + | This policy document was proposed, accepted, and implemented in version 5.10.0 of the perl package. It is the standard regarding to the perl package, related perl packages, and creating perl module packages (both in binary form and in the form of PKGBUILDs). Portions are derived from the [http://www.debian.org/doc/packaging-manuals/perl-policy/index.html Debian Perl Policy] document and from various portions of the perl man pages. | |
− | |||
− | + | == 5.10 Caveats == | |
− | + | NOT TRUE: The directories for scripts do not conform to FHS standards. | |
+ | |||
+ | Note: FHS describes what directories must be in /usr/bin and does not prohibit adding other directories. | ||
− | |||
== Reasoning == | == Reasoning == | ||
− | + | ||
+ | Apparent problems with pre-5.10.0 perl packaging conventions included: | ||
# The current Arch Linux default perl installation installs <em>site</em> and <em>vendor</em> packages into the same directory tree, which frequently causes conflicts if the end user installs and upgrades Arch Linux perl (<em>vendor</em>) packages on top of <em>site</em> packages. | # The current Arch Linux default perl installation installs <em>site</em> and <em>vendor</em> packages into the same directory tree, which frequently causes conflicts if the end user installs and upgrades Arch Linux perl (<em>vendor</em>) packages on top of <em>site</em> packages. | ||
− | # The current Arch Linux default perl installation installs updates to <em>core</em> modules into the perl <em>core</em> directories, creating file conflicts. Examples include modules such as | + | # The current Arch Linux default perl installation installs updates to <em>core</em> modules into the perl <em>core</em> directories, creating file conflicts. Examples include modules such as {{Ic|Data::Dumper}} and {{Ic|version}}. |
− | # A symlink-farm is created in | + | # A symlink-farm is created in {{Ic|/usr/lib/perl5/}} and {{Ic|/usr/lib/perl5/site_perl}} which is un-necessary and confusing. |
# A number of standard modules seem to be missing, or were neglected to be added as <em>provides</em> in the perl package itself, causing confusion and redundant entries in AUR and Community as users try and <em>fix</em> the apparent problem of missing modules, which are provided by perl. This is probably a matter of education. | # A number of standard modules seem to be missing, or were neglected to be added as <em>provides</em> in the perl package itself, causing confusion and redundant entries in AUR and Community as users try and <em>fix</em> the apparent problem of missing modules, which are provided by perl. This is probably a matter of education. | ||
# Current perl-module PKGBUILD's could be simplified and standardized quite a bit. | # Current perl-module PKGBUILD's could be simplified and standardized quite a bit. | ||
Line 31: | Line 37: | ||
# An update of every perl module PKGBUILD so that it installs into the correct (<em>vendor</em>) directory tree. It remains somewhat backwards-compatible with the old structure, in that old PKGBUILD's would technically <strong>work</strong>. | # An update of every perl module PKGBUILD so that it installs into the correct (<em>vendor</em>) directory tree. It remains somewhat backwards-compatible with the old structure, in that old PKGBUILD's would technically <strong>work</strong>. | ||
− | # Introduces changes into the | + | # Introduces changes into the {{Ic|perl}} package, which lives in [core], and proposes a new {{Ic|perl-modules}} package, which would live in [extra]. |
− | # Non perl packages which compile static copies of the perl interpreter will not operate correctly until recompiled on an Arch Linux PC which adheres to this document. Examples of such packages include | + | # Non perl packages which compile static copies of the perl interpreter will not operate correctly until recompiled on an Arch Linux PC which adheres to this document. Examples of such packages include {{Ic|vim}}, {{Ic|subversion}}, and {{Ic|irssi}}. Many such examples exist. |
= Perl Versions = | = Perl Versions = | ||
− | At any given time, the package | + | At any given time, the package {{Ic|perl}} should represent the current stable upstream version of Perl revision 5. (see Perl 6). |
− | Only one package may contain the | + | Only one package may contain the {{Ic|/usr/bin/perl}} binary and that package must either be perl or a dependency of that package. In order to provide a minimal installation of Perl for use by applications without requiring the whole of Perl to be installed, the {{Ic|perl}} package contains the binary and a basic set of modules. The perl package should declare provide statements for every module provided by the base perl package. |
= Module Paths = | = Module Paths = | ||
Line 44: | Line 50: | ||
Perl searches three different locations for modules, referred to in this document as <em>core</em> in which modules distributed with Perl are installed, <em>vendor</em> for packaged modules and <em>site</em> for modules installed by the local administrator. | Perl searches three different locations for modules, referred to in this document as <em>core</em> in which modules distributed with Perl are installed, <em>vendor</em> for packaged modules and <em>site</em> for modules installed by the local administrator. | ||
− | The module search path ( | + | The module search path ({{Ic|@INC}}) in the Arch Linux packages has been ordered to include these locations in the following order: |
* <strong><em>site</em></strong> | * <strong><em>site</em></strong> | ||
Modules installed by the local administrator for the current version of Perl. Typically, these modules are installed using the ''cpan'' or ''cpanp'' tool, or are downloaded in source form and installed via make. | Modules installed by the local administrator for the current version of Perl. Typically, these modules are installed using the ''cpan'' or ''cpanp'' tool, or are downloaded in source form and installed via make. | ||
− | : | + | :{{Ic|/usr/lib/perl5/site_perl/<em>version</em>}} |
− | : | + | :{{Ic|/usr/share/perl5/site_perl/<em>version</em>}} |
* <strong><em>vendor</em></strong> | * <strong><em>vendor</em></strong> | ||
Packaged modules, installed via the pacman tool from core/extra or community, or built into proper Arch Linux packages from ABS/AUR PKGBUILDS. | Packaged modules, installed via the pacman tool from core/extra or community, or built into proper Arch Linux packages from ABS/AUR PKGBUILDS. | ||
− | : | + | :{{Ic|/usr/lib/perl5/vendor_perl}} |
− | : | + | :{{Ic|/usr/share/perl5/vendor_perl}} |
* <strong><em>core</em></strong> | * <strong><em>core</em></strong> | ||
Modules included in the core Perl distribution. | Modules included in the core Perl distribution. | ||
− | : | + | :{{Ic|/usr/lib/perl5/core_perl}} |
− | : | + | :{{Ic|/usr/share/perl5/core_perl}} |
* <strong><em>obsolete</em></strong> | * <strong><em>obsolete</em></strong> | ||
− | Obsolete is the pathname to modules installed prior to the establishment of this document. | + | Obsolete is the pathname to modules installed prior to the establishment of this document. These paths have been removed from @INC in perl 5.12.2. |
− | : | + | :{{Ic|/usr/lib/perl5/site_perl/current/arch}} |
− | : | + | :{{Ic|/usr/lib/perl5/site_perl/current}} |
+ | :{{Ic|/usr/lib/perl5/current}} | ||
− | In each of the directory pairs above, the | + | In each of the directory pairs above, the {{Ic|lib}} component is for binary, architecture dependent (XS) modules, and {{Ic|share}} for architecture-independent (pure-perl) modules. Under no circumstances should {{Ic|current}} be used as a replacement for {{Ic|version}}. Core and Vendor modules <em>should</em> be matched to the current installation of perl. |
= Documents = | = Documents = | ||
Line 80: | Line 87: | ||
<strong>Programs</strong> | <strong>Programs</strong> | ||
− | Manual pages for programs and scripts are installed into | + | Manual pages for programs and scripts are installed into {{Ic|/usr/man/man1}} with the extension {{Ic|.1perl}}. |
<strong>Modules</strong> | <strong>Modules</strong> | ||
− | Manual pages for modules are installed into | + | Manual pages for modules are installed into {{Ic|/usr/man/man3}} with the extension {{Ic|.3perl}}. |
= Binaries and Scripts = | = Binaries and Scripts = | ||
− | In order to prevent file collisions, it's important to keep binaries generated by <em>core</em>, <em>vendor</em>, and <em>site</em> installs separate. It's also important that the default | + | In order to prevent file collisions, it's important to keep binaries generated by <em>core</em>, <em>vendor</em>, and <em>site</em> installs separate. It's also important that the default {{Ic|PATH}} environment variable set in each users profile to search for binaries in the same order as perl's {{Ic|@INC}} path. In order to accomplish this, binaries should be installed into the following directories: |
:<strong>Core</strong> | :<strong>Core</strong> | ||
− | :Binaries and scripts for all <em>core</em> packages should be installed into | + | :Binaries and scripts for all <em>core</em> packages should be installed into {{Ic|/usr/bin/core_perl}}. |
:<strong>Vendor</strong> | :<strong>Vendor</strong> | ||
− | :Binaries and scripts for all <em>vendor</em> packages should be installed into | + | :Binaries and scripts for all <em>vendor</em> packages should be installed into {{Ic|/usr/bin/vendor_perl}}. |
:<strong>Site</strong> | :<strong>Site</strong> | ||
− | :Binaries and scripts for all <em>site</em> should default to be installed into | + | :Binaries and scripts for all <em>site</em> should default to be installed into {{Ic|/usr/bin/site_perl}}. |
− | The | + | The {{Ic|perl}} package should include a mechanism to adjust end-users {{Ic|PATH}} entries accordingly so that perl binaries are searched for in the following order: <em>site</em>, <em>vendor</em>, <em>core</em>. |
+ | |||
+ | = Core = | ||
+ | |||
+ | Core modules are perl modules "typically" included in the core Perl distribution. | ||
+ | |||
+ | == Core Directories == | ||
+ | |||
+ | * Modules included in the core Perl distribution should be installed into {{Ic|/usr/lib/perl5}} and {{Ic|/usr/share/perl5}}. | ||
+ | * Only modules contained in the {{Ic|perl}} package should be installed into this directory tree. | ||
+ | * No version subdirectory exists in these paths as the dependencies for packaged modules should ensure that all work with the current {{Ic|perl}} package. | ||
+ | |||
+ | == Core perl packages == | ||
+ | |||
+ | The {{Ic|perl}} package should contain the {{Ic|/usr/bin/perl}} binary, and a minimal set of modules needed in order for simple perl scripts to run and for a base system to operate. It should be maintained in the [core] repository. | ||
+ | |||
+ | The following is a list of a few modules (for example), which are provided in the perl package. (See the PKGBUILD for the offical list). | ||
+ | |||
+ | {{Ic|'perl-checktree' 'perl-collate' 'perl-config' 'perl-cwd' 'perl-dynaloader' 'perl-english' 'perl-env' 'perl-exporter' 'perl-fnctl' 'perl-filehandle' 'perl-find' 'perl-finddepth' 'perl-getopt' 'perl-makemaker' 'perl-socket' 'perl-sys-syslog' 'perl-db-file' 'perl-storable' 'perl-data-dumper' 'perl-digest-md5'}}. | ||
+ | |||
+ | Every module supplied in the perl package shall be added into the {{Ic|provides}} array in the PKGBUILD. Modules in this array should NOT appear in the perl packages {{Ic|conflicts}} or {{Ic|replaces}} arrays. End users should be able to install newer versions of core modules, either in <em>vendor</em> or <em>site</em> directories without file collisions. | ||
= Site = | = Site = | ||
Line 105: | Line 132: | ||
== Site Directories == | == Site Directories == | ||
− | The Perl packages must provide a mechanism for the local administrator to install modules under | + | The Perl packages must provide a mechanism for the local administrator to install modules under {{Ic|/usr/lib/perl5/site_perl}} but must not create or remove those directories. |
− | Modules should be installed to the directories described above in Module Path | + | Modules should be installed to the directories described above in Module Path {{Ic|site}}, programs to {{Ic|/usr/bin/site_perl}} and manual pages under {{Ic|/usr/man}}. |
== Site Installation == | == Site Installation == | ||
Line 123: | Line 150: | ||
Vendor modules are packaged modules, installed via the pacman tool, or modules which have been built into proper Arch Linux packages from a PKGBUILD and makepkg. | Vendor modules are packaged modules, installed via the pacman tool, or modules which have been built into proper Arch Linux packages from a PKGBUILD and makepkg. | ||
+ | |||
+ | == Package Naming == | ||
+ | |||
+ | Perl module packages should be named for the primary module provided. The naming convention for module Foo::Bar is perl-foo-bar. Packages which include multiple modules may additionally include provides for those modules using the same convention. | ||
== Vendor Directories == | == Vendor Directories == | ||
− | The installation directory for Arch Linux modules must be different from that for | + | The installation directory for Arch Linux modules must be different from that for {{Ic|site}} modules. Some guidelines include: |
− | * The current Perl packaging uses the <em>vendor</em> directories for this purpose, which are at present as described in above as | + | * The current Perl packaging uses the <em>vendor</em> directories for this purpose, which are at present as described in above as {{Ic|vendor}}. |
− | * No version subdirectory exists on these directories as the dependencies for packaged modules should ensure that all work with the current | + | * No version subdirectory exists on these directories as the dependencies for packaged modules should ensure that all work with the current {{Ic|perl}} package. |
− | * The Perl distribution includes many modules available separately from CPAN, which may have a newer version. The intent of the | + | * The Perl distribution includes many modules available separately from CPAN, which may have a newer version. The intent of the {{Ic|@INC}} ordering (described above) is to allow such modules to be packaged to <em>vendor</em> which take precedence over the version in <em>core</em>. A packaged module which shadows a <em>core</em> module in this way must be a newer version. |
− | * Module packages must install manual pages into the standard directories using the extensions | + | * Module packages must install manual pages into the standard directories using the extensions {{Ic|.1p}} and {{Ic|.3pm}} to ensure that no conflict arises where a packaged module duplicates a <em>core</em> module. |
− | * | + | * {{Ic|.packlist}} (used for module uninstalls) and {{Ic|perllocal.pod}} (used to record local/site installations) files should not be installed, and should be removed from the package if found. |
* Empty directories should be pruned. | * Empty directories should be pruned. | ||
− | |||
− | |||
− | |||
− | |||
== Vendor Installation == | == Vendor Installation == | ||
Line 149: | Line 176: | ||
make install DESTDIR=$startdir/pkg install || return 1 | make install DESTDIR=$startdir/pkg install || return 1 | ||
− | A depends on perl (>= 5.10.0) is required in order ensure that the module is correctly installed into the new | + | A depends on perl (>= 5.10.0) is required in order ensure that the module is correctly installed into the new {{Ic|@INC}} path. |
== Sample Vendor PKGBUILD == | == Sample Vendor PKGBUILD == | ||
Line 162: | Line 189: | ||
pkgrel=2 | pkgrel=2 | ||
pkgdesc="Perl/CPAN Module HTML::Template : a simple HTML templating system" | pkgdesc="Perl/CPAN Module HTML::Template : a simple HTML templating system" | ||
− | arch=(' | + | arch=('any') |
url="http://search.cpan.org/dist/${_realname}/" | url="http://search.cpan.org/dist/${_realname}/" | ||
license=('GPL' 'Artistic') | license=('GPL' 'Artistic') | ||
Line 171: | Line 198: | ||
build() { | build() { | ||
− | cd ${ | + | cd "${srcdir}/${_realname}-${pkgver}" |
− | + | ||
− | + | # Setting these env variables overwrites any command-line-options we don't want... | |
− | + | export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps \ | |
− | + | PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \ | |
+ | PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \ | ||
+ | PERL5LIB="" PERL_LOCAL_LIB_ROOT="" \ | ||
+ | MODULEBUILDRC=/dev/null | ||
+ | |||
+ | # If using Makefile.PL | ||
+ | { /usr/bin/perl Makefile.PL && | ||
+ | make && | ||
+ | make test && | ||
+ | make install; } || return 1 | ||
+ | |||
+ | # If using Build.PL | ||
+ | { /usr/bin/perl Build.PL && | ||
+ | ./Build && | ||
+ | ./Build test && | ||
+ | ./Build install; } || return 1 | ||
− | + | # remove perllocal.pod and .packlist | |
− | + | find "$pkgdir" -name .packlist -o -name perllocal.pod -delete | |
− | |||
} | } | ||
== Dependencies == | == Dependencies == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
=== Binary Modules === | === Binary Modules === | ||
− | Binary modules must specify a dependency on either | + | Binary modules must specify a dependency on either {{Ic|perl}} with a minimum version of the {{Ic|perl}} package used to build the module, and must additionally depend on the expansion of {{Ic|perlapi-$Config{version}}}using the {{Ic|Config}} module. |
− | = | + | === Architecture-Independent Modules === |
− | + | Architecture-independent modules which require <em>core</em> modules from the {{Ic|perl}} package must specify a dependency on that package. | |
− | |||
− | |||
− | == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | Modules which contain explicit {{Ic|require <em>version</em>}} or {{Ic|use <em>version</em>}} statements must specify a dependency on {{Ic|perl}} with the minimum required version, or more simply the current version. | |
− | + | In the absence of an explicit requirement, architecture-independent modules must depend on a minimum {{Ic|perl}} version of {{Ic|5.10.0}} due to the changes in {{Ic|@INC}} introduced by that version. | |
= Perl6 = | = Perl6 = | ||
− | + | There is currently work in progress on the next major revision, although the specifications have yet to be finalised. | |
− | It is anticipated that when Perl 6 is released it will initially be packaged as perl6, install the binary as | + | It is anticipated that when Perl 6 is released it will initially be packaged as perl6, install the binary as {{Ic|/usr/bin/perl6}} and use different directories for packaged modules to perl: |
− | : | + | : {{Ic|/usr/lib/perl6}} |
− | : | + | : {{Ic|/usr/share/perl6}} |
This will allow Perl 5 and 6 packages and modules (which should be packaged as perl6-foo-bar), to co-exist for as long as required. | This will allow Perl 5 and 6 packages and modules (which should be packaged as perl6-foo-bar), to co-exist for as long as required. | ||
− | At some stage in the future when Perl 6 is sufficiently mature, the package naming may be reversed such that the | + | At some stage in the future when Perl 6 is sufficiently mature, the package naming may be reversed such that the {{Ic|perl}} package contains Perl 6 and the current package becomes {{Ic|perl5}}. |
Revision as of 05:30, 7 January 2013
Contents
Note
There seems to be some confusion where people think this policy is about packaging perl modules. This page covers the policy for how perl itself is configured and packaged. So the policy does influence module packaging especially where files will be installed.
For perl module packaging guidelines see Perl_Package_Guidelines.
Introduction
This policy document was proposed, accepted, and implemented in version 5.10.0 of the perl package. It is the standard regarding to the perl package, related perl packages, and creating perl module packages (both in binary form and in the form of PKGBUILDs). Portions are derived from the Debian Perl Policy document and from various portions of the perl man pages.
5.10 Caveats
NOT TRUE: The directories for scripts do not conform to FHS standards.
Note: FHS describes what directories must be in /usr/bin and does not prohibit adding other directories.
Reasoning
Apparent problems with pre-5.10.0 perl packaging conventions included:
- The current Arch Linux default perl installation installs site and vendor packages into the same directory tree, which frequently causes conflicts if the end user installs and upgrades Arch Linux perl (vendor) packages on top of site packages.
- The current Arch Linux default perl installation installs updates to core modules into the perl core directories, creating file conflicts. Examples include modules such as
Data::Dumper
andversion
. - A symlink-farm is created in
/usr/lib/perl5/
and/usr/lib/perl5/site_perl
which is un-necessary and confusing. - A number of standard modules seem to be missing, or were neglected to be added as provides in the perl package itself, causing confusion and redundant entries in AUR and Community as users try and fix the apparent problem of missing modules, which are provided by perl. This is probably a matter of education.
- Current perl-module PKGBUILD's could be simplified and standardized quite a bit.
This policy would eliminate all these problems.
Pitfalls
Current (apparent) downsides to adopting a policy such as this one:
- An update of every perl module PKGBUILD so that it installs into the correct (vendor) directory tree. It remains somewhat backwards-compatible with the old structure, in that old PKGBUILD's would technically work.
- Introduces changes into the
perl
package, which lives in [core], and proposes a newperl-modules
package, which would live in [extra]. - Non perl packages which compile static copies of the perl interpreter will not operate correctly until recompiled on an Arch Linux PC which adheres to this document. Examples of such packages include
vim
,subversion
, andirssi
. Many such examples exist.
Perl Versions
At any given time, the package perl
should represent the current stable upstream version of Perl revision 5. (see Perl 6).
Only one package may contain the /usr/bin/perl
binary and that package must either be perl or a dependency of that package. In order to provide a minimal installation of Perl for use by applications without requiring the whole of Perl to be installed, the perl
package contains the binary and a basic set of modules. The perl package should declare provide statements for every module provided by the base perl package.
Module Paths
Perl searches three different locations for modules, referred to in this document as core in which modules distributed with Perl are installed, vendor for packaged modules and site for modules installed by the local administrator.
The module search path (@INC
) in the Arch Linux packages has been ordered to include these locations in the following order:
- site
Modules installed by the local administrator for the current version of Perl. Typically, these modules are installed using the cpan or cpanp tool, or are downloaded in source form and installed via make.
/usr/lib/perl5/site_perl/version
/usr/share/perl5/site_perl/version
- vendor
Packaged modules, installed via the pacman tool from core/extra or community, or built into proper Arch Linux packages from ABS/AUR PKGBUILDS.
/usr/lib/perl5/vendor_perl
/usr/share/perl5/vendor_perl
- core
Modules included in the core Perl distribution.
/usr/lib/perl5/core_perl
/usr/share/perl5/core_perl
- obsolete
Obsolete is the pathname to modules installed prior to the establishment of this document. These paths have been removed from @INC in perl 5.12.2.
/usr/lib/perl5/site_perl/current/arch
/usr/lib/perl5/site_perl/current
/usr/lib/perl5/current
In each of the directory pairs above, the lib
component is for binary, architecture dependent (XS) modules, and share
for architecture-independent (pure-perl) modules. Under no circumstances should current
be used as a replacement for version
. Core and Vendor modules should be matched to the current installation of perl.
Documents
The POD files and manual pages and html documentation which do not refer to programs may be stripped from the package, which is normal for most Arch Linux packages in general. This is optional.
Manual pages distributed with Perl packages must be installed into the standard directories:
Programs
Manual pages for programs and scripts are installed into /usr/man/man1
with the extension .1perl
.
Modules
Manual pages for modules are installed into /usr/man/man3
with the extension .3perl
.
Binaries and Scripts
In order to prevent file collisions, it's important to keep binaries generated by core, vendor, and site installs separate. It's also important that the default PATH
environment variable set in each users profile to search for binaries in the same order as perl's @INC
path. In order to accomplish this, binaries should be installed into the following directories:
- Core
- Binaries and scripts for all core packages should be installed into
/usr/bin/core_perl
. - Vendor
- Binaries and scripts for all vendor packages should be installed into
/usr/bin/vendor_perl
. - Site
- Binaries and scripts for all site should default to be installed into
/usr/bin/site_perl
.
The perl
package should include a mechanism to adjust end-users PATH
entries accordingly so that perl binaries are searched for in the following order: site, vendor, core.
Core
Core modules are perl modules "typically" included in the core Perl distribution.
Core Directories
- Modules included in the core Perl distribution should be installed into
/usr/lib/perl5
and/usr/share/perl5
. - Only modules contained in the
perl
package should be installed into this directory tree. - No version subdirectory exists in these paths as the dependencies for packaged modules should ensure that all work with the current
perl
package.
Core perl packages
The perl
package should contain the /usr/bin/perl
binary, and a minimal set of modules needed in order for simple perl scripts to run and for a base system to operate. It should be maintained in the [core] repository.
The following is a list of a few modules (for example), which are provided in the perl package. (See the PKGBUILD for the offical list).
'perl-checktree' 'perl-collate' 'perl-config' 'perl-cwd' 'perl-dynaloader' 'perl-english' 'perl-env' 'perl-exporter' 'perl-fnctl' 'perl-filehandle' 'perl-find' 'perl-finddepth' 'perl-getopt' 'perl-makemaker' 'perl-socket' 'perl-sys-syslog' 'perl-db-file' 'perl-storable' 'perl-data-dumper' 'perl-digest-md5'
.
Every module supplied in the perl package shall be added into the provides
array in the PKGBUILD. Modules in this array should NOT appear in the perl packages conflicts
or replaces
arrays. End users should be able to install newer versions of core modules, either in vendor or site directories without file collisions.
Site
Site Modules are perl modules installed by the local administrator for the current version of Perl. Typically, these modules are installed using the cpan tool, or are downloaded in source form and installed via make (or MakeMaker).
Site Directories
The Perl packages must provide a mechanism for the local administrator to install modules under /usr/lib/perl5/site_perl
but must not create or remove those directories.
Modules should be installed to the directories described above in Module Path site
, programs to /usr/bin/site_perl
and manual pages under /usr/man
.
Site Installation
The following commands should be sufficient in the majority of cases for the local administrator to install modules and must create directories as required:
perl Makefile.PL make install
or
cpan Foo::Bar
Vendor
Vendor modules are packaged modules, installed via the pacman tool, or modules which have been built into proper Arch Linux packages from a PKGBUILD and makepkg.
Package Naming
Perl module packages should be named for the primary module provided. The naming convention for module Foo::Bar is perl-foo-bar. Packages which include multiple modules may additionally include provides for those modules using the same convention.
Vendor Directories
The installation directory for Arch Linux modules must be different from that for site
modules. Some guidelines include:
- The current Perl packaging uses the vendor directories for this purpose, which are at present as described in above as
vendor
. - No version subdirectory exists on these directories as the dependencies for packaged modules should ensure that all work with the current
perl
package. - The Perl distribution includes many modules available separately from CPAN, which may have a newer version. The intent of the
@INC
ordering (described above) is to allow such modules to be packaged to vendor which take precedence over the version in core. A packaged module which shadows a core module in this way must be a newer version. - Module packages must install manual pages into the standard directories using the extensions
.1p
and.3pm
to ensure that no conflict arises where a packaged module duplicates a core module. -
.packlist
(used for module uninstalls) andperllocal.pod
(used to record local/site installations) files should not be installed, and should be removed from the package if found. - Empty directories should be pruned.
Vendor Installation
A module should use the following lines in the PKGBUILD build target.
perl Makefile.PL INSTALLDIRS=vendor || return 1
and this one to install the results into the temporary tree...
make install DESTDIR=$startdir/pkg install || return 1
A depends on perl (>= 5.10.0) is required in order ensure that the module is correctly installed into the new @INC
path.
Sample Vendor PKGBUILD
# $Id$ # Contributer: Barry User <barry@user.com> # Maintainer: Harry Hacker <harry@hacker.com> pkgname=perl-html-template _realname=HTML-Template pkgver=2.9 pkgrel=2 pkgdesc="Perl/CPAN Module HTML::Template : a simple HTML templating system" arch=('any') url="http://search.cpan.org/dist/${_realname}/" license=('GPL' 'Artistic') depends=('perl>=5.10.0') source=("http://www.cpan.org/authors/id/S/SA/SAMTREGAR/${_realname}-${pkgver}.tar.gz") md5sums=("cbf88a486b36284be55765ac7357c187") options=(!emptydirs) build() { cd "${srcdir}/${_realname}-${pkgver}" # Setting these env variables overwrites any command-line-options we don't want... export PERL_MM_USE_DEFAULT=1 PERL_AUTOINSTALL=--skipdeps \ PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'" \ PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \ PERL5LIB="" PERL_LOCAL_LIB_ROOT="" \ MODULEBUILDRC=/dev/null # If using Makefile.PL { /usr/bin/perl Makefile.PL && make && make test && make install; } || return 1 # If using Build.PL { /usr/bin/perl Build.PL && ./Build && ./Build test && ./Build install; } || return 1 # remove perllocal.pod and .packlist find "$pkgdir" -name .packlist -o -name perllocal.pod -delete }
Dependencies
Binary Modules
Binary modules must specify a dependency on either perl
with a minimum version of the perl
package used to build the module, and must additionally depend on the expansion of perlapi-$Config{version
}using the Config
module.
Architecture-Independent Modules
Architecture-independent modules which require core modules from the perl
package must specify a dependency on that package.
Modules which contain explicit require version
or use version
statements must specify a dependency on perl
with the minimum required version, or more simply the current version.
In the absence of an explicit requirement, architecture-independent modules must depend on a minimum perl
version of 5.10.0
due to the changes in @INC
introduced by that version.
Perl6
There is currently work in progress on the next major revision, although the specifications have yet to be finalised.
It is anticipated that when Perl 6 is released it will initially be packaged as perl6, install the binary as /usr/bin/perl6
and use different directories for packaged modules to perl:
-
/usr/lib/perl6
-
/usr/share/perl6
This will allow Perl 5 and 6 packages and modules (which should be packaged as perl6-foo-bar), to co-exist for as long as required.
At some stage in the future when Perl 6 is sufficiently mature, the package naming may be reversed such that the perl
package contains Perl 6 and the current package becomes perl5
.