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

Replace deprecated {File,Dir}.exists? with {File,Dir}.exist? #1981

Closed NicholasBHubbard closed 1 year ago

NicholasBHubbard commented 1 year ago

Ruby 3.2.0 was just released, and the deprecated methods File.exists? and Dir.exists? were completely removed. These methods are used in FPM, so FPM is currently broken under Ruby 3.2.0. Instead we are supposed to use the File.exist? and Dir.exist? methods. This PR replaces all occurrence of these deprecated methods with their preferred counterpart.

jordansissel commented 1 year ago

Thanks for the patch. I’m still taking care of sick family and will be unavailable for an unknown amount of time.

ranjib commented 1 year ago

Take care @jordansissel . Family is always first,

for anywho is facing this with ruby upgrade, update your gemfile like this

gem 'fpm', git: 'https://github.com/NicholasBHubbard/fpm.git', branch: 'replace-deprecated-methods'

and thank you @NicholasBHubbard for the patch.

romulasry commented 1 year ago

gem 'fpm', git: 'https://github.com/NicholasBHubbard/fpm.git', branch: 'replace-deprecated-methods' ERROR: While executing gem ... (Gem::UnknownCommandError) Unknown command fpm, /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:204:in find_command' /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:249:ininvoke_command' /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:191:in process_args' /usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:149:inrun' /usr/local/share/ruby/site_ruby/rubygems/gem_runner.rb:51:in run' /usr/bin/gem:10:in

'

romulasry commented 1 year ago

It would be nice to push an update after this is in because it is broken on latest ruby.

jordansissel commented 1 year ago

Fixing newer versions is good, but we gotta check if this breaks older versions. Picking my favorite ancient version of ruby to see how long ago these methods have existed, it appears that File::exist? and Dir::exist? have been in Ruby since at least Ruby 1.9.3. Citations:

I'm OK to replace the methods as proposed.

jordansissel commented 1 year ago

Checking dependencies:

jordansissel commented 1 year ago

I haven't tried running the test suite yet, so I don't know if anything fails on Ruby 3.2.0 (fpm's GitHub Actions also doesn't use 3.2 at this time).

One option which might help without causing too much of a stir in fpm's dependencies: we could monkey patch File and Dir to add back these removed methods. It's possible to attend to these dependencies with upgrades, but we might find upgrading them causes older versions of ruby to fail, even very recent versions of ruby.

jordansissel commented 1 year ago

reviewing dependencies further -- https://github.com/jordansissel/fpm/pull/1981#issuecomment-1411330564

romulasry commented 1 year ago

I haven't tried running the test suite yet, so I don't know if anything fails on Ruby 3.2.0 (fpm's GitHub Actions also doesn't use 3.2 at this time).

Should be able to fix that here: https://github.com/jordansissel/fpm/blob/main/.github/workflows/ruby.yml

jordansissel commented 1 year ago

I’ll work on a release as time permits.

On Tue, Jan 31, 2023, at 6:08 PM, Jordan Sissel wrote:

Merged #1981 https://github.com/jordansissel/fpm/pull/1981 into main.

— Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/pull/1981#event-8405509848, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABAF2TQXMBMESUXFHDEOVTWVHATFANCNFSM6AAAAAATMJ2MAE. You are receiving this because you are subscribed to this thread.Message ID: @.***>

jordansissel commented 1 year ago

v1.15.1 released with this patch

NicholasBHubbard commented 1 year ago

Thanks Jordan!

ranjib commented 1 year ago

Thank you Jordan. Much appreciated

On Wed, Feb 1, 2023 at 8:58 AM Nicholas Hubbard @.***> wrote:

Thanks Jordan!

— Reply to this email directly, view it on GitHub https://github.com/jordansissel/fpm/pull/1981#issuecomment-1412394504, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACNHEV4L43J2MQIUWQICITWVKI5FANCNFSM6AAAAAATMJ2MAE . You are receiving this because you commented.Message ID: @.***>