1
0
mirror of https://github.com/jordansissel/fpm synced 2025-04-29 14:58:00 +02:00

add --cpan-package-name-postfix and fix automatic names cpan pkgs

use --cpan-package-name-prefix and --cpan-package-name-postfix to
create the cpan package name

do not assume a dash between the prefix and the package name

change the defualt prefix from perl to perl- because for deb packages
you want the prefix to be lib and do not want a -
This commit is contained in:
Aran Cox 2022-10-27 14:21:09 -05:00
parent d4309c2b21
commit 1564cd9944
3 changed files with 12 additions and 2 deletions

@ -225,6 +225,9 @@ General Options
* ``--cpan-package-name-prefix NAME_PREFIX``
- (cpan only) Name to prefix the package name with.
* ``--cpan-package-name-postfix NAME_POSTFIX``
- (cpan only) Name to prefix the package name with.
* ``--[no-]cpan-test``
- (cpan only) Run the tests before packaging?
@ -663,6 +666,8 @@ cpan
- The CPAN mirror to use instead of the default.
* ``--cpan-package-name-prefix NAME_PREFIX``
- Name to prefix the package name with.
* ``--cpan-package-name-postfix NAME_POSTFIX``
- Name to prefix the package name with.
* ``--cpan-perl-bin PERL_EXECUTABLE``
- The path to the perl executable you wish to run.
* ``--cpan-perl-lib-path PERL_LIB_PATH``

@ -14,6 +14,8 @@
- The CPAN mirror to use instead of the default.
* ``--cpan-package-name-prefix NAME_PREFIX``
- Name to prefix the package name with.
* ``--cpan-package-name-postfix NAME_POSTFIX``
- Name to prefix the package name with.
* ``--cpan-perl-bin PERL_EXECUTABLE``
- The path to the perl executable you wish to run.
* ``--cpan-perl-lib-path PERL_LIB_PATH``

@ -20,7 +20,10 @@ class FPM::Package::CPAN < FPM::Package
"Only use the specified mirror for metadata.", :default => false
option "--package-name-prefix", "NAME_PREFIX",
"Name to prefix the package name with.", :default => "perl"
"Name to prefix the package name with.", :default => "perl-"
option "--package-name-postfix", "NAME_POSTFIX",
"Name to prefix the package name with.", :default => ""
option "--test", :flag,
"Run the tests before packaging?", :default => true
@ -392,7 +395,7 @@ class FPM::Package::CPAN < FPM::Package
def fix_name(name)
case name
when "perl"; return "perl"
else; return [attributes[:cpan_package_name_prefix], name].join("-").gsub("::", "-")
else; return "#{attributes[:cpan_package_name_prefix]}#{name.downcase}#{attributes[:cpan_package_name_postfix]}".gsub("::", "-")
end
end # def fix_name