I did a bit of debugging on this, and it looks like for this case, the culprit is yaml instead.
This is what I did: * patched the gem2deb code to _not_ delete metadata.yml diff --git a/lib/gem2deb/gem2tgz.rb b/lib/gem2deb/gem2tgz.rb index d03452f..aac5162 100644 --- a/lib/gem2deb/gem2tgz.rb +++ b/lib/gem2deb/gem2tgz.rb @@ -101,7 +101,7 @@ module Gem2Deb f.puts "#########################################################" f.puts(gemspec.to_ruby) end - FileUtils.rm_f('metadata.yml') + #FileUtils.rm_f('metadata.yml') end FileUtils.rm_f('metadata.gz') end * Now, I have the metadata.yml - I just wrote a snippet of code to check the behaviour of gemspec w.r.t metadata file Here it is: ``` require 'yaml' gemspec = YAML.load_file('metadata.yml') File.open('out', 'w') do |f| f.puts(gemspec.to_ruby) end ``` --- NOTE: I'm attaching metadata.yml with this email in case it helps --- * Now I run it, and check the type of file "out" is $ file out out: data while in principle, it _really should_ have been ASCII/txt (tried with a couple more ruby gems, and that is the type I get) * Now, the metadata.yml has the same entry ("- lib") repeated twice in the 'require_paths' field. When I comment one of them, and run the snippet again, I get: $ file out out: ASCII text, with very long lines So my guess is that the same entry repeated twice is messing with gemspec, removing which it works well. Nilesh
--- !ruby/object:Gem::Specification name: ruby-magic-static version: !ruby/object:Gem::Version version: 0.3.5 platform: ruby authors: - Krzysztof WilczyĆski autorequire: bindir: bin cert_chain: - kwilczynski-public.pem date: 2021-03-31 00:00:00.000000000 Z dependencies: - !ruby/object:Gem::Dependency name: mini_portile2 requirement: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 2.5.0 type: :runtime prerelease: false version_requirements: !ruby/object:Gem::Requirement requirements: - - "~>" - !ruby/object:Gem::Version version: 2.5.0 description: | File Magic in Ruby. Simple interface to libmagic for Ruby Programming Language. email: k...@linux.com executables: [] extensions: - ext/magic/extconf.rb extra_rdoc_files: [] files: - AUTHORS - CHANGELOG.md - COPYRIGHT - LICENSE - NOTICE - README.md - VERSION - ext/magic/common.h - ext/magic/extconf.rb - ext/magic/functions.c - ext/magic/functions.h - ext/magic/ruby-magic.c - ext/magic/ruby-magic.h - kwilczynski-public.pem - lib/magic.rb - lib/magic/core/file.rb - lib/magic/core/string.rb - lib/magic/version.rb homepage: https://gitlab.com/gitlab-org/ruby-magic licenses: - Apache-2.0 metadata: bug_tracker_uri: https://gitlab.com/gitlab-org/ruby-magic/-/issues source_code_uri: https://gitlab.com/gitlab-org/ruby-magic changelog_uri: https://gitlab.com/gitlab-org/ruby-magic/-/blob/main/CHANGELOG.md documentation_uri: https://www.rubydoc.info/gems/ruby-magic-static post_install_message: 'Thank you for installing! ' rdoc_options: [] require_paths: - lib - lib required_ruby_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: 2.5.0 required_rubygems_version: !ruby/object:Gem::Requirement requirements: - - ">=" - !ruby/object:Gem::Version version: '0' requirements: [] rubygems_version: 3.1.4 signing_key: specification_version: 4 summary: File Magic in Ruby test_files: []
signature.asc
Description: PGP signature