kwilczynski / ruby-magic

Simple interface to libmagic for Ruby Programming Language
Apache License 2.0
27 stars 8 forks source link

Reconciling mini_portile2 version with Nokogiri #22

Closed boone closed 2 years ago

boone commented 2 years ago

Hi, I'm working on a project and want to include both Nokogiri and ruby-magic. I get this error from bundler:

Bundler could not find compatible versions for gem "mini_portile2":
  In snapshot (Gemfile.lock):
    mini_portile2 (= 2.6.1)

  In Gemfile:
    nokogiri was resolved to 1.12.5, which depends on
      mini_portile2 (~> 2.6.1)

    ruby-magic was resolved to 0.4.0, which depends on
      mini_portile2 (~> 2.5.0)

I was able to solve this for myself by forking this project and updating it to use mini_portile2 2.6.1: https://github.com/boone/ruby-magic/commit/730c26504c4a99a9c1d58e4b8ac4f98eb7b40045

I'm happy to submit a PR from that, but it seems that Nokogiri's main is already using mini_portile2 2.7.0 (https://github.com/sparklemotion/nokogiri/pull/2322). Instead of trying to keep up, I wonder if there's a better way?

Thank you.

stanhu commented 2 years ago

Could we just relax the version requirement to be ~> 2.6?

boone commented 2 years ago

@stanh that might work, but I'm not sure of the actual version needs for either project. The mini_portile2 changelog does not have a lot of changes, so it seems reasonable.

stanhu commented 2 years ago

@boone Yeah, let's just revise it to "~> 2.6" then. I should hope CI should catch any build issues.

stanhu commented 2 years ago

Strangely, Rubygems is not allowing me to push:

422 Unprocessable Entity
RubyGems.org cannot process this gem.
Please try rebuilding it and installing it locally to make sure it's valid.
stanhu commented 2 years ago

@flavorjones Have you seen this before? I'm wondering if something relating to native gems might be confusing RubyGems.

flavorjones commented 2 years ago

Heya, I think it's safe to pin mini_portile to ~> 2.6 or some other version, if you're not taking advantage of a new feature.

I haven't seen that error before. Have you done sanity checks on the generated gemfile? Does file tell you it's a "POSIX tar archive"? And if so, can you crack it open and see the contained gzipped files?

stanhu commented 2 years ago

Yeah, the gem installs just fine locally, and it's a valid .tar file:

$ file ruby-magic-0.5.0.gem
ruby-magic-0.5.0.gem: POSIX tar archive
$ tar xvf ruby-magic-0.5.0.gem
metadata.gz
data.tar.gz
checksums.yaml.gz
$ tar tvf data.tar.gz
-rw-rw-r-- wheel/wheel      52 2021-09-30 22:09 AUTHORS
-rw-rw-r-- wheel/wheel    3532 2021-09-30 22:09 CHANGELOG.md
-rw-rw-r-- wheel/wheel     739 2021-09-30 22:09 CONTRIBUTORS.md
-rw-rw-r-- wheel/wheel      42 2021-09-30 22:09 COPYRIGHT
-rw-rw-r-- wheel/wheel   11358 2021-09-30 22:09 LICENSE
-rw-rw-r-- wheel/wheel   19583 2021-09-30 22:09 NOTICE
-rw-rw-r-- wheel/wheel    1497 2021-09-30 22:09 README.md
-rw-rw-r-- wheel/wheel     992 2021-09-30 22:09 dependencies.yml
-rw-rw-r-- wheel/wheel    3842 2021-09-30 22:09 ext/magic/common.h
-rw-rw-r-- wheel/wheel   12668 2021-09-30 22:09 ext/magic/extconf.rb
-rw-rw-r-- wheel/wheel    6270 2021-09-30 22:09 ext/magic/functions.c
-rw-rw-r-- wheel/wheel    1894 2021-09-30 22:09 ext/magic/functions.h
-rw-rw-r-- wheel/wheel   41250 2021-09-30 22:09 ext/magic/ruby-magic.c
-rw-rw-r-- wheel/wheel    9711 2021-09-30 22:09 ext/magic/ruby-magic.h
-rw-rw-r-- wheel/wheel    1493 2021-09-30 22:09 kwilczynski-public.pem
-rw-rw-r-- wheel/wheel    5078 2021-09-30 22:09 lib/magic.rb
-rw-rw-r-- wheel/wheel    1149 2021-09-30 22:09 lib/magic/core/file.rb
-rw-rw-r-- wheel/wheel     543 2021-09-30 22:09 lib/magic/core/string.rb
-rw-rw-r-- wheel/wheel     775 2021-09-30 22:09 lib/magic/version.rb
kwilczynski commented 2 years ago

Hi @stanhu,

I published a new version on your behalf. Hopefully everything will work fine, as per:

$ gem install ruby-magic -P HighSecurity
Building native extensions. This could take a while...
Thank you for installing!
Successfully installed ruby-magic-0.5.0
1 gem installed

Krzysztof

stanhu commented 2 years ago

@kwilczynski Thanks! I wonder what was wrong on my end. I tried it on two different systems.

kwilczynski commented 2 years ago

Hi @stanhu,

@kwilczynski Thanks! I wonder what was wrong on my end. I tried it on two different systems.

My pleasure! Thank your for updating the dependencies! Much appreciated as always.

Your systems are macOS, correct? (it would hardly be a problem, of course) This is what I use:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.3 LTS
Release:    20.04
Codename:   focal

$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]

$ gem -v
3.2.22

This is a simple virtual machine I am using as my "workstation" for development and such. There isn't anything special about it.

Krzysztof

boone commented 2 years ago

Thanks everyone!

kwilczynski commented 2 years ago

Hi @boone,

Thanks everyone!

You are welcome! I am sorry you had some issues initially! If you need anything else, do let us know, we would be happy to help.

Having said that, I am curious what project you are working on which uses this little project - is this something you can share?

Krzysztof

stanhu commented 2 years ago

@kwilczynski I actually tried on both macOS and Linux machines and got the same result. It worked in the past.

kwilczynski commented 2 years ago

Hi @stanhu ,

@kwilczynski I actually tried on both macOS and Linux machines and got the same result. It worked in the past.

That is very odd indeed! Especially since the gem installed locally. Any problems with some proxies you have set? Any version mismatches? I assume that as per usual you are up-to-date.

I wonder if there is a way to enable some sort of a debug output during push.

Krzysztof