-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CPAN->deb related fixes #1947
base: main
Are you sure you want to change the base?
CPAN->deb related fixes #1947
Conversation
prior version created automatic dependencies for deb packages that weren't named according to the standard specified here: https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html
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 -
The auto-depends for cpan modules worked well on rpm because of the use of capabilities (ie: perl(IO::Handle)) but deb packages of CPAN modules generate dependencies that might not exist because they are provided by another package and therefore need to be filtered out. For instance, perl(IO::Handle) would be turned into libio-handle-perl, and that package doesn't exist. The IO/Handle.pm file is actually in package perl-base. Prior to this patch, fpm would filter out a short list of modules (vars, warnings, strict, and Config) and with this patch you can add to that list with --cpan-package-reject-from-depends.
I like with the idea of this change -- that is, to emit Debian packages that more closely match what Debian calls their own Perl packages. It makes sense! I found a few things which I would considering a breaking change, and I'm not sure what the best next step is. I'd like to find a path forward that reduces surprises to folks who are upgrading and receive this change. Here's some differences I noted. In my tests, I was not using any new flags. When packaging Regexp::Common, the provides are:
When packaging HTTP::Request, the
The impact is that someone upgrading (from the current version of FPM to something with this PR included) would get very different debian package results which are likely to cause disruptions. This change impacts the provides and depends fields (of Debian packages), but the original package name is the same in both main and this PR -- perl-http-message_6.44_all.deb perl-regexp-common_2017060201_all.deb, for example. |
@wbraswell @NicholasBHubbard Y'all use the cpan feature a bit, I think? Can y'all take a look at this and let us know your thoughts? I'm mostly interested in the behavior changes and less worried about the code itself. |
Please give @NicholasBHubbard and a little time to carefully review this PR, to make sure it's not something we're already working on fixing ourselves. |
@jordansissel |
This PR looks good to me, and I agree that it is probably a good idea for CPAN deb packages to be named using Debian conventions. A test for this functionality should probably be added to either deb_spec.rb or cpan_spec.rb. |
@NicholasBHubbard @wbraswell thanks for the swift review <3 |
Summarizing my above comments, this change feels pretty significant and could cause problems for users who are expecting the previous behavior after they upgrade, or more specifically, aren't expecting to be surprised ;) Thoughts:
@aranc23 what do you think? |
Since the package name is set in cpan.rb, I couldn't figure out how to tell what the target was in order to implement different package names depending on the output format. Is that context available in the source module?
I think that would be straightforward. |
I’ll see if I can help come up with a little demo to show how to do this
…On Mon, Oct 31, 2022, at 8:54 AM, Aran wrote:
> Make the package names follow Debian style, not just the Provides/Depends fields. That is, this PR still produces packages named 'perl-whatever' instead of 'libwhatever-perl':
>
Since the package name is set in cpan.rb, I couldn't figure out how to tell what the target was in order to implement different package names depending on the output format. Is that context available in the source module?
>
> Have a documented way to restore the old behavior (packages and dependencies named perl-whatever):
> I think that would be straightforward.
>
—
Reply to this email directly, view it on GitHub <#1947 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AABAF2TMABBC77GRGEJVXF3WF7TSNANCNFSM6AAAAAARQMXGTA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Here's some details about the internals and what methods are called when fpm converts a package. Inside fpm, package conversion will pass through a
Here's a link to the Deb converted_from code: Lines 675 to 760 in 5b104bc
In this scenario, we can add additional handling for the CPAN case to change the package name itself. diff --git a/lib/fpm/package/deb.rb b/lib/fpm/package/deb.rb
index 77b69e1..34f7fb8 100644
--- a/lib/fpm/package/deb.rb
+++ b/lib/fpm/package/deb.rb
@@ -681,6 +681,18 @@ class FPM::Package::Deb < FPM::Package
end.flatten
if origin == FPM::Package::CPAN
+
+ # By default, we'd prefer to name Debian-targeted Perl packages using the
+ # same naming scheme that Debian itself uses, which is usually something
+ # like "lib<module-name-hyphenated>-perl", such as libregexp-common-perl
+ #
+ # Therefore, if the --cpan-package-name-prefix flag is not set, we should
+ # make our package name use this same scheme.
+ if !attributes[:cpan_package_name_prefix_given?]
+ logger.info("Changing package name to match Debian's typical libmodule-name-perl style")
+ self.name = "lib#{self.name.sub(/^perl-/, "")}-perl"
+ end
+
# The fpm cpan code presents dependencies and provides fields as perl(ModuleName)
# so we'll need to convert them to something debian supports. Using the above patch, I can try it with:
Thoughts? Does this look right? :) |
@aranc23 I made a small change in the command-line docs generator that now caused a merge conflict on your docs/cli-reference.rst changes. I regenerate the docs before each release, so it's safe to remove the changes to the flag documentation (cli-reference.rst, etc) |
This reverts commit ae1a628.
…depends" This reverts commit b4e138f.
…pkgs" This reverts commit 1564cd9.
The auto-depends for cpan modules worked well on rpm because of the use of capabilities (ie: perl(IO::Handle)) but deb packages of CPAN modules generate dependencies that might not exist because they are provided by another package and therefore need to be filtered out. For instance, perl(IO::Handle) would be turned into libio-handle-perl, and that package doesn't exist. The IO/Handle.pm file is actually in package perl-base. Prior to this patch, fpm would filter out a short list of modules (vars, warnings, strict, and Config) and with this patch you can add to that list with --cpan-package-reject-from-depends.
I see this PR today and still not merged whereas you look all agree about it. |
@jordansissel & @NicholasBHubbard : are we all in agreement that this PR can be merged now? |
looks good to me |
Hi folks, |
I found a few issues when building deb packages from CPAN modules:
The names of automatic dependencies created from the CPAN modules didn't match the standard (and what I observed to be the case on Ubuntu 20.04) (https://www.debian.org/doc/packaging-manuals/perl-policy/ch-module_packages.html)
The naming of deb packages from CPAN modules couldn't be set correctly using the --cpan-package-name-prefix option because the code assumed there is a dash between the prefix and the package/module name. It also can't be set correctly without adding a --cpan-package-name-postfix option. (ie: Config::Validator, rpm: perl-Config-Validator, deb: libconfig-validator-perl)
Automatic dependency creation for CPAN modules in deb packages needed the ability to filter out some modules that are provided by other packages or base perl package so I added --cpan-package-reject-from-depends