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

Dependency Error public_suffix requires Ruby version >= 2.6 and breaks installing on Debian 10 / Buster #1923

Closed
nudgegoonies opened this issue Aug 22, 2022 · 13 comments · Fixed by #1946

Comments

@nudgegoonies
Copy link

nudgegoonies commented Aug 22, 2022

Error installing fpm:
	The last version of public_suffix (< 6.0, >= 2.0.2) to support your Ruby & RubyGems was 4.0.7. Try installing it with `gem install public_suffix -v 4.0.7` and then running the current command again
	public_suffix requires Ruby version >= 2.6. The current ruby version is 2.5.0.

Maybe a similar cause like this one: #1918

I assume this will happen more and more as direct and transitive ruby dependencies will require higher ruby versions that are only available in current Linux distributions. All the LTS distributions like Debian LTS, Ubuntu LTS, RedHat, etc. are "sensitive" to this problem. Debian 11 is not affected and i assume the latest Ubuntu and Fedora versions are not affected too.

P.S.
I think fpm is such "sensitive" because many developers must build software that dynamically links to libraries from these LTS distributions and thus the packaging build step runs on these LTS distributions as well.

@efiop
Copy link

efiop commented Aug 24, 2022

@nudgegoonies We ran into the same issue while building packaged for dvc in https://github.com/iterative/dvc-s3-repo. For the record: easy solution is to just install rbenv and use it to install a newer ruby version iterative/dvc-s3-repo#63 so you don't depend on distro ruby packages at all.

@nudgegoonies
Copy link
Author

@efiop Thank you for the hint 👍

@jamshid
Copy link

jamshid commented Sep 6, 2022

This is also breaking builds installing fpm on centos 7. I know it's EOL in a couple of years but still need to build packages on it.

What I don't understand is that I had fpm 1.14.1 already installed, why does installing it again require the new public_suffix dependency? Did 1.14.1 get rebuilt or did its dependencies change?

[root@35713bfdbaa4 /]# gem --version
2.0.14.1
[root@35713bfdbaa4 /]# ruby --version
ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
[root@35713bfdbaa4 /]# fpm --version
1.14.1

[root@35713bfdbaa4 /]# gem install -v 1.14.1 fpm
Successfully installed fpm-1.14.1
ERROR:  Error installing fpm:
	public_suffix requires Ruby version >= 2.6.

@jordansissel
Copy link
Owner

There's a small hint in the error message:

The last version of public_suffix (< 6.0, >= 2.0.2) to support your Ruby & RubyGems was 4.0.7. Try installing it with gem install public_suffix -v 4.0.7 and then running the current command again

You could try this before installing fpm:

gem install public_suffix -v 4.0.7
gem install fpm

I haven't tested this because I don't have CentOS 7 available for testing just now, but please let me know if it works.

I'm working on self-contained fpm releases that would be more agnostic to OS distro/version. If that is of interest, let me know :)

@jordansissel
Copy link
Owner

That said, if we can't find a workaround for the current version of fpm, let me know.

I looked at the code in fpm that uses the git rubygem, and it seems like the only place fpm uses it is to support gem sources in git repos(1), and only for one method call for cloning a git repository. I wonder if this could be replaced with a shell calls to invoke the git command line. If so, we could remove the dependency on git and its transitive dependency, public_suffix, that is causing this problem.

(1) History: #1558, #1753, #1766

@jamshid
Copy link

jamshid commented Sep 7, 2022

Thank you. Sorry I should have said I tried installing an older public_suffix but it didn't help.

[root@2b7bf4c43a3a /]#  gem install public_suffix:1.5.3 
Successfully installed public_suffix-1.5.3
1 gem installed
[root@2b7bf4c43a3a /]#  gem install fpm:1.14.1
Successfully installed fpm-1.14.1
ERROR:  Error installing fpm:
	public_suffix requires Ruby version >= 2.6.

But I did just stumble on a workaround: gem install --minimal-deps fpm allow fpm to install apparently without installing public_suffix. It seems to work for my purposes -- I use fpm to build a centos 7.9 rpm for a ui project.

FYI below is roughly the Dockerfile I use.

FROM centos:7
RUN yum install -y sudo expect make gcc gawk ruby-devel rubygems rpm-build && echo "gem: --no-document --no-rdoc --no-ri" > ~/.gemrc
RUN gem install --version 1.12.2 ffi && gem install --version 1.6.0 git && gem install --version 0.9.10 rb-inotify && gem install --version 3.2.3 rexml
RUN gem install -v 3.21.0 backports && gem install --minimal-deps fpm && fpm --version # This version works: -v 1.14.1. Needed --minimal-deps to workaround public_suffix.
RUN gem install sass compass && gem install --pre sass-css-importer
RUN curl --fail --silent --location https://rpm.nodesource.com/setup_10.x | bash - && yum install -y bzip2 nodejs
RUN npm config set spin=false
RUN npm install -g bower grunt-cli && npm install -g protractor && npm install -g protractor-html-screenshot-reporter && webdriver-manager update

@Kastakin
Copy link

Kastakin commented Sep 9, 2022

Found this issue thread while looking for a solution for the exact same problem.
I use fpm in a GitHub Actions to produce cross platform installers of my application.
On ubuntu-18.04 I get the same exact error and the proposed gem install --minimal-deps fpm does not changed the outcome.

@jordansissel
Copy link
Owner

jordansissel commented Oct 26, 2022

based on feedback here, I think the next step is to remove the dependency on the git gem. It'll require changing some of the code to not need the git gem anymore and instead invoking the git command line instead of using the Ruby interface, such as in this code: https://github.com/jordansissel/fpm/blob/main/lib/fpm/package/gem.rb#L107-L128

Using bundler to show a graph of dependencies, we can see that public_suffix dependency comes from git rubygem which uses addressable which depends on public_suffix --
image

jordansissel added a commit that referenced this issue Oct 26, 2022
Folks are reporting that fpm cannot be installed easily (or at all) on
older systems because a transitive dependency(1) rejects ruby versions
older than 2.6.

(1) rubygem git depends on addressable which depends on public_suffix

Since the `git` dependency is only used in the `gem` source when
using a git repo as a installation source, and that usage seems pretty
simple -- clone a repo, checkout a branch, etc -- it feels safe to
remove this dependency while still keeping the same functionality.

Fixes #1923
@jordansissel
Copy link
Owner

#1946 should fix this assuming removing the git dependency solves this problem.

jordansissel added a commit that referenced this issue Oct 26, 2022
Folks are reporting that fpm cannot be installed easily (or at all) on
older systems because a transitive dependency(1) rejects ruby versions
older than 2.6.

(1) rubygem git depends on addressable which depends on public_suffix

Since the `git` dependency is only used in the `gem` source when
using a git repo as a installation source, and that usage seems pretty
simple -- clone a repo, checkout a branch, etc -- it feels safe to
remove this dependency while still keeping the same functionality.

Fixes #1923
@srh
Copy link

srh commented Oct 26, 2022

Thank you for addressing this.

I encountered the problem today on AlmaLinux 8, and --minimal-deps or --conservative didn't help with it. What did work around the issue was using --ignore-dependencies on fpm and addressable (and manually installing and specifying all prior dependencies' versions).

@jordansissel
Copy link
Owner

@srh Your tweet reminded me of the issue, so thanks for that :)

@srh
Copy link

srh commented Oct 26, 2022

Ah, double-plus thank you then :-)

jordansissel added a commit that referenced this issue Nov 4, 2022
Folks are reporting that fpm cannot be installed easily (or at all) on
older systems because a transitive dependency(1) rejects ruby versions
older than 2.6.

(1) rubygem git depends on addressable which depends on public_suffix

Since the `git` dependency is only used in the `gem` source when
using a git repo as a installation source, and that usage seems pretty
simple -- clone a repo, checkout a branch, etc -- it feels safe to
remove this dependency while still keeping the same functionality.

Fixes #1923
@jordansissel
Copy link
Owner

fpm 1.15.0 is released and contains this improvement.

If you were having problems installing fpm due to this issue, please try again and it should be fixed now :)

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

Successfully merging a pull request may close this issue.

6 participants