jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.17k stars 1.07k forks source link

"gem install fpm" is not sufficient to have fpm correctly installed #2043

Open avivace opened 11 months ago

avivace commented 11 months ago

I'm working on a base container image to run FPM and, following the Install instructions, it may seem that gem install fpm on a system where Ruby is installed is enough.

That's false. The ruby json gem is needed and the rpm-build system package are pre-requisites.

jordansissel commented 11 months ago

Thanks for the report! Sounds like we can improve the docs a bit to help in the future :)

Focusing on specific points:

json gem:

Interesting! I haven't needed to install the json gem in years as it comes with all recent Ruby installations that I've used. If we can document this better, I'm happy to learn about it.

To my knowledge, the json gem is part of Ruby's standard library and has been since Ruby 1.9 (see also: #1950). At some point this became part of the "default gem" set somewhere in the 2.x series of Ruby. There is a json gem, though as a "default gem" I haven't tried upgrading or uninstalling it. You'd need to install the json gem for Ruby 1.8, but that is an extremely old Ruby and likely a rare use case as far as I can tell.

Can you provide more details about your container? How are you installing Ruby, and what version? I'd like to help figure out what's causing this problem.

rpm-build

For building rpms, you are right that the rpmbuild tool is needed. I've found it difficult to document this kind of thing, and it's not needed for folks who are building only debian packages, for example.

It's likely that the docs could be improved to better provider new users with a successful path for installing fpm and any dependencies they'd need.

There is a small bit of documentation regarding dependencies needed for certain package types (rpm, snap). I'd love for this to be improved for other package types and making this stuff more discoverable.

When running, if fpm needs a tool and finds that it is missing, I've tried to make fpm provide an actionable error message indicating that a dependency is missing for a particular package type. In cases where the environment can be modified, this kind of feedback is usually actionable (fpm cannot build rpms because rpmbuild is missing, user installs a dependency, problem resolved). However, in your case, you'd want all possible dependencies installed.

As for docker, we have some documentation and tooling for building fpm for a container which might help you further - https://fpm.readthedocs.io/en/v1.15.1/docker.html - I haven't tested this in a while, but the goal is to provide a way to build a container with fpm and any needed dependencies. Even if the tooling doesn't help, the Dockerfile might be of use to you.