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.08k stars 1.07k forks source link

fpm install fails on RHEL8 Ruby 2.5.0 due to dotenv #2048

Open asgeirn opened 4 months ago

asgeirn commented 4 months ago
RUN gem install --no-document --minimal-deps dotenv:2.8.1 fpm
38.64 ERROR:  Error installing fpm:
38.64   dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.
38.78 Successfully installed dotenv-2.8.1
38.78 Successfully installed rexml-3.2.6
38.78 Successfully installed stud-0.0.23
38.78 1 gem installed
Liukke commented 4 months ago

I'm seeing the same problem as well.

We have RHEL7 systems running system ruby as 2.6. These are now failing to install fpm:

gem install -N fpm
ERROR:  Error installing fpm:
               The last version of dotenv (>= 0) to support your Ruby & RubyGems was 2.8.1. Try installing it with `gem install dotenv -v 2.8.1` and then running the current command again
               dotenv requires Ruby version >= 3.0. The current ruby version is 2.6.10.210.

Trying to pin the version of dotenv like the error suggest doesn't work. If I manually install dotenv 2.8.1 as the error suggest and try to install fpm again, it still fails:

gem install -N dotenv -v 2.8.1
Fetching dotenv-2.8.1.gem
Successfully installed dotenv-2.8.1
1 gem installed

gem install -N fpm
ERROR:  Error installing fpm:
    dotenv requires Ruby version >= 3.0. The current ruby version is 2.6.10.210.

We also have RHEL8 systems running system ruby 2.7 and this is happening on those as well:

gem install -N fpm
ERROR:  Error installing fpm:
    dotenv requires Ruby version >= 3.0. The current ruby version is 2.7.8.225.

It looks like fpm is making dotenv 3.0.0 a hard requirement for some reason:

gem install --explain -N fpm
Gems to install:
  rexml-3.2.6
  stud-0.0.23
  dotenv-3.0.0
  insist-1.0.0
  mustache-0.99.8
  clamp-1.0.1
  cabin-0.9.0
  pleaserun-0.0.32
  arr-pm-0.0.12
  backports-3.24.1
  fpm-1.15.1
Elvrarin commented 4 months ago

fpm has a dependency on pleaserun. pleaserun is making the newest version of dotenv a hard requirement.

Relevant Issue from pleaserun https://github.com/jordansissel/pleaserun/issues/153

asgeirn commented 4 months ago

Perhaps pleaserun could be an optional dependency for fpm?

alucardgt86 commented 4 months ago

This also an issue in amazon linux 2 as ruby is 2.6 so would be nice to have dotenv version as 2.8.1 and up.

DmitryGrayscale commented 4 months ago

fpm has a dependency on pleaserun. pleaserun is making the newest version of dotenv a hard requirement.

causing problems since 2022 as far as I can see..

asgeirn commented 4 months ago

For those interested, I've created forks of pleaserun and fpm to lock the dotenv version to one compatible with Ruby 2.

How to use:

  1. Create legacy GitHub personal access token with packages:read permission
  2. Install fpm using the following:
    gem sources --add https://${USERNAME}:${TOKEN}@rubygems.pkg.github.com/asgeirn/
    gem install --no-document fpm --version "1.15.1042"
jordansissel commented 4 months ago

@asgeirn thanks for providing a workaround!

I’ll look into pleaserun’s dotenv dependency a bit more and see about removing that dependency soon.

aschlei commented 4 months ago

Ran into this as well; the behavior is strange as it almost seems like a bug in ruby gems. I can get fpm to install fairly easily on CentOS 7 (ruby 2.0, gem 2.0.14.1) with:

gem install dotenv -v 2.8.1 -N
gem install rexml -v 3.2.4 -N
gem install backports -v 3.21.0 -N
gem install fpm -N

But on Rocky Linux 8 (ruby 2.5, gem 2.7.6.3), even if I install dotenv first, it still tries to install the latest, even if the installed dotenv meets the requirements of pleaserun:

# gem install dotenv -v 2.8.1 -N
Fetching: dotenv-2.8.1.gem (100%)
Successfully installed dotenv-2.8.1
1 gem installed
# gem install fpm -N
Fetching: rexml-3.2.6.gem (100%)
Successfully installed rexml-3.2.6
Fetching: stud-0.0.23.gem (100%)
Successfully installed stud-0.0.23
Fetching: dotenv-3.1.0.gem (100%)
ERROR:  Error installing fpm:
        dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.

Even with flags that I thought should explicitly tell it not to upgrade deps that already meet the requirements (though I've never had to use these in the past; that seems to be the default behavior:

# gem install fpm -N --conservative --minimal-deps
ERROR:  Error installing fpm:
        dotenv requires Ruby version >= 3.0. The current ruby version is 2.5.0.
aschlei commented 4 months ago

My workaround for installing on EL 8; basically just explicitly install the dependencies of pleaserun and fpm and then install those without any deps:

gem install dotenv -v 2.8.1 -N
gem install clamp -v 1.0.1 -N
gem install mustache -v 0.99.8 -N
gem install cabin insist stud arr-pm backports rexml -N
gem install pleaserun --ignore-dependencies -N
gem install fpm --ignore-dependencies -N