Fpm: missing require "zlib" in deb.rb makes big deb package creation fail with error

Created on 14 Dec 2020  路  5Comments  路  Source: jordansissel/fpm

I've encountered an issue with the DEB target for a NodeJS application, converting from DIR.
We are packaging all the node_modules folder together with our application code, so the starting DIR is pretty huge.

FPM smartly tries using zlib to deflate our package, but fails hard with this output:

Doing `require 'backports'` is deprecated and will not load any backport in the next major release.
Require just the needed backports instead, or 'backports/latest'.
Setting workdir {:workdir=>"/tmp", :level=>:info}
Setting from flags: epoch= {:level=>:info}
Setting from flags: iteration=1162 {:level=>:info}
Setting from flags: name=****** {:level=>:info}
Setting from flags: url=http://example.com/no-uri-given {:level=>:info}
Setting from flags: version=1.1.0 {:level=>:info}
Converting dir to deb {:level=>:info}
/home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/package/deb.rb:495:in `block in output': uninitialized constant FPM::Package::Deb::Zlib (NameError)
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/package/deb.rb:494:in `tap'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/package/deb.rb:494:in `output'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/command.rb:487:in `execute'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/clamp-1.0.1/lib/clamp/command.rb:68:in `run'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/command.rb:574:in `run'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/clamp-1.0.1/lib/clamp/command.rb:133:in `run'
    from /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/bin/fpm:7:in `<top (required)>'
    from /home/travis/.rvm/gems/ruby-2.4.1/bin/fpm:23:in `load'
    from /home/travis/.rvm/gems/ruby-2.4.1/bin/fpm:23:in `<main>'

I've experimented monkey-patching a require "zlib" into https://github.com/jordansissel/fpm/blob/master/lib/fpm/package/deb.rb and realized that after that, it does the job excellently.

So I guess I'm opening this Issue, and proposing the solution and can have a PR up for that in a heartbeat.
Let me know what you think and if I can open a PR to fix it.

Most helpful comment

Glad that this helped out someone!

For completeness, the way I've monkey patched it is this:

sudo sed -i '/require "digest"/a require "zlib"' /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/package/deb.rb

All 5 comments

Hi! I've got the same error. I will monkey patch too in the meantime.

Glad that this helped out someone!

For completeness, the way I've monkey patched it is this:

sudo sed -i '/require "digest"/a require "zlib"' /home/travis/.rvm/gems/ruby-2.4.1/gems/fpm-1.11.0/lib/fpm/package/deb.rb

This affected us too, hoping to see the PR merged.

Ditto, also affecting us on Debian Bullseye

@jordansissel Any chance of this being merged please?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amrox picture amrox  路  5Comments

alexzorin picture alexzorin  路  4Comments

samueljc picture samueljc  路  4Comments

fatmcgav picture fatmcgav  路  10Comments

hellosputnik picture hellosputnik  路  4Comments