Skip to content
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

packaging deb using 1.14.0 leads to a NameError #1854

Closed
kares opened this issue Nov 10, 2021 · 5 comments
Closed

packaging deb using 1.14.0 leads to a NameError #1854

kares opened this issue Nov 10, 2021 · 5 comments

Comments

@kares
Copy link

kares commented Nov 10, 2021

namely NameError: uninitialized constant FPM::Package::CPAN (compared to version 1.13.x)

due the use of the FPM::Package::CPAN from 13621c9 (in the FPM::Package::Deb class)

trying to use require "fpm/package/deb" one needs to these extra "seemingly unrelated" requires:

require "fpm/package/gem"
require "fpm/package/cpan"

require "fpm/package/deb"
...
dir.convert(FPM::Package::Deb)

(likely a similar limitation exists for FPM::Package::Rpm -> require "fpm/package/gem")

@jordansissel
Copy link
Owner

jordansissel commented Nov 10, 2021 via email

@jordansissel
Copy link
Owner

% bundle exec ruby -r./lib/fpm/package/deb.rb -e 'FPM::Package::Deb.new.convert(FPM::Package::Deb)'
/home/jls/projects/fpm/lib/fpm/package/deb.rb:680:in `converted_from': uninitialized constant FPM::Package::CPAN (NameError)

Reproduced via api

@jordansissel
Copy link
Owner

I'm on the fence about the "best" solution here. Added require is simple, but maybe checking the type as a string instead of a const...

jordansissel added a commit that referenced this issue Nov 10, 2021
When converting, we check if the original package was of a certain type.
In order for those types/constants to be available, we have to require
those files.

Test cases which now work correctly with this commit, but had failed
prior:

    % bundle exec ruby -r./lib/fpm/package/rpm.rb -e 'FPM::Package::RPM.new.tap { |x| x.name = "fancy" }.convert(FPM::Package::RPM)'
    % bundle exec ruby -r./lib/fpm/package/deb.rb -e 'FPM::Package::Deb.new.tap { |x| x.name = "fancy" }.convert(FPM::Package::Deb)'

Fixes #1854
@jordansissel
Copy link
Owner

fpm 1.14.1 pushed which has (hopefully) fixed this. Can you try?

@jsvd
Copy link

jsvd commented Nov 11, 2021

Confirmed it works now, thanks for the super fast fix <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants