Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Packager should ignore directories in spec.files for back-compat with old gemspecs #413

Closed
jeremy opened this Issue · 1 comment

2 participants

@jeremy

Granted that spec.files must all be files for the gem to validate.

However, many old gemspecs use spec.files = Dir['lib/**/*'] style globs for file listings, resulting in intermediate directories in spec.files.

RubyGems 2.0 can't package these gemspecs any more. It tries to add the dirs to the tarball as if they were files.

I think it's probably worth maintaining compatibility with old gemspecs:

diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb
index 1769af0..0707a26 100644
--- a/lib/rubygems/package.rb
+++ b/lib/rubygems/package.rb
@@ -196,7 +196,7 @@ class Gem::Package
         open file, 'rb' do |src_io|
           dst_io.write src_io.read 16384 until src_io.eof?
         end
-      end
+      end if stat.file?
     end
   end
@jeremy jeremy referenced this issue from a commit in rails/rails
@jeremy jeremy Omit directories from gemspec.files for RubyGems 2 compat.
RG2 packager expects each spec.files path to be a file and bombs when it tries to tarball a dir.

May revert if rubygems/rubygems#413 is accepted.
bb8923d
@drbrain drbrain was assigned
@drbrain drbrain closed this in 486ed83
@tkadauke tkadauke referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.