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

Bump minimum required version to meet required dependencies #1949

Closed
wants to merge 1 commit into from
Closed

Bump minimum required version to meet required dependencies #1949

wants to merge 1 commit into from

Conversation

edolnx
Copy link

@edolnx edolnx commented Nov 2, 2022

While fpm may still stick to the conventions of Ruby 1.9, several of it's dependencies no longer support that release. I recently discovered this trying to build on an older ruby in a resource constrained system. The json gem requires ruby 2.3 or later and the public_suffix gem requires ruby 2.6 or later. So I'm proposing this PR to bump the minimum version requirement to 2.6.2 which seems to work without issue. Hopefully this will help someone in the future who is in the same boat I was in.

@jordansissel if you feel this is inappropriate, just let me know what you think would be a better approach. Happy to just make a PR to the README if that makes more sense.

While fpm may run on Ruby 1.9, several of it's dependencies no
longer support that release. I recently discovered this trying
to build on an older ruby. The `json` gem requires 2.3 or later
and the `public_suffix` gem requires 2.6 or later. So I'm
proposing this PR to bump the minumum version requirement to
2.6.2 which seems to work without issue.
@jordansissel
Copy link
Owner

Hi Carl! I’m in favor of making the minimum version more accurate as you propose :)

I have some good news — I recently removed the dependency on public_suffix in #1946, and that should bring the minimum down to what the json gem requires.

as for json? Maybe we can figure out what minimum version of Ruby ships with json and go with that? I forget some of the history, but Ruby ships with json in the standard library, so it’s possible we don’t even need as an external gem dependency?

@edolnx
Copy link
Author

edolnx commented Nov 2, 2022

A quick search tells me that a version of json is bundled in 1.9.2, but for whatever reason when doing a gem install fpm it wants to pull a newer version. So I'm not sure what to make of that...

@edolnx
Copy link
Author

edolnx commented Nov 2, 2022

In fairness, I don't think it's a big deal that the json gem is being updated. The only frustration I had was the system I was trying to install on had no ruby and all I wanted to do was run fpm. So I started with 1.9.5 as per the fpm.gemspec and then got caught by dependency errors. So maybe just sticking with 2.3 is good enough? I can certainly re-run my tests since I have the older rubys installed via asdf-vm just for this reason once the new gem with #1946 is pushed.

@jordansissel
Copy link
Owner

Looking at the history, the json gem was added in in The Ancient Times (63494e9, January 2011!).

As a test, I tried removing the json dependency from the latest main branch (56a97c4) and things seem to work!

Test suite without json gem on Ruby 3.1.0

356 examples, 0 failures, 14 pending

Maybe we could try removing the json dependency also? Might be worth a try.

I have trouble testing very old Ruby versions because they dont' compile against newer versions of OpenSSL, etc, and I haven't tried using VMs.

@jordansissel
Copy link
Owner

Here's the diff I used:

diff --git a/fpm.gemspec b/fpm.gemspec
index 1848da4..f4f8f04 100644
--- a/fpm.gemspec
+++ b/fpm.gemspec
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|

   # For parsing JSON (required for some Python support, etc)
   # http:https://flori.github.com/json/doc/index.html
-  spec.add_dependency("json", ">= 1.7.7", "< 3.0") # license: Ruby License
+  #spec.add_dependency("json", ">= 1.7.7", "< 3.0") # license: Ruby License

   # For logging
   # https://github.com/jordansissel/ruby-cabin

If you can test, that'd be awesome. You can build your own fpm gem file by running gem build fpm.gemspec and it'll spit out a .gem file you can gem install whatever.gem as a local file; it'll still ask rubygems.org for help satisfying dependencies.

@jordansissel
Copy link
Owner

Regrettably, I have taken this too far, and fortunately, I now have some fun news to share! I was able to get Ruby 1.9.3 to run fpm with only minor modifications.

Would that help?

jordansissel added a commit that referenced this pull request Nov 3, 2022
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949
jordansissel added a commit that referenced this pull request Nov 3, 2022
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949

Fixes #1741, #1264, #1949
jordansissel added a commit that referenced this pull request Nov 3, 2022
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949

Fixes #1741, #1264, #1949
jordansissel added a commit that referenced this pull request Nov 3, 2022
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949

Fixes #1741, #1264, #1949
jordansissel added a commit that referenced this pull request Nov 4, 2022
The original `json` gem dependency was added in the original fpm.gemspec
because, at the time, Ruby 1.8.7 was common and required an external
`json` dependency for parsing JSON.

Later, Ruby releases since 1.9.1 have bundled `json`[1].

Therefore, it feels safe to remove this dependency. As a bonus, the
rubygems `json` gem places requirements on the minimum version of Ruby.
At this time, the latest `json` gem requires Ruby >= 2.3.

If the `json` gem dependency is removed, fpm will still retain the
ability to process JSON while lowering the minimum required Ruby version
to Ruby 1.9.x -- It's not perfect, but it's a start! :)

[1] https://docs.ruby-lang.org/en/2.3.0/NEWS-1_9_1.html

The idea for this change change came originally from a discussion
with @edolnx in #1949

Fixes #1741, #1264, #1949
@edolnx
Copy link
Author

edolnx commented Nov 7, 2022

Sorry it took so long to get back to you. Works fine in my environment. Thanks Jordan!

@edolnx edolnx closed this Nov 7, 2022
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 this pull request may close these issues.

None yet

2 participants