[Rubygems-developers] "misnamed gem" error when building platform-specific gem repository on i386-linux platform

Eric Hodel drbrain at segment7.net
Sun Feb 10 18:10:10 EST 2008

On Feb 6, 2008, at 15:47 PM, Alexey Verkhovsky wrote:
> Hello all,
> I'm upgrading RubyGems to 1.0.1 in RubyWorks repository (which, among
> other things, includes gems with precompiled extensions), and having
> the following problem:
> 1. In the process of installing the gem with extensions, we set
> spec.platform to Config::CONFIG['arch'], which is 'i386-linux'

Use Ruby::Platform::CURRENT if your gem contains compiled files.

> 2. Gem::Builder#build creates the new gem file, which uses
> @spec.file_name as a name. As it happens, @spec.file_name replaces the
> platform from i386-linux to x86-linux, so
>    I end up with a file name like 'mongrel-1.1.3-x86-linux.gem'
> 3. In a later step, the build is indexing gem repository using 'gem
> generate_index' command. At this time, Gem::Indexer#build_index
> performs this check:
>    gemfile =~ /\/#{Regexp.escape spec.original_name}.*\.gem\z/i
> Note that it uses spec.original_name, not spec.full_name. Of course,
> none of the *-x86-linux.gem files satisfy this check. Oops.
> So, is it a simple bug in the indexer.rb (which should use
> spec.full_name, not spec.original_name),

No.  This check is for legacy gems.

> or am I doing something wrong?

Follow the new API as described in the release notes (set it to  

irb(main):006:0> s = Gem::Specification.new
irb(main):008:0> s.name = 'test'
irb(main):009:0> s.version = 1
irb(main):010:0> s.platform = Gem::Platform::CURRENT
irb(main):011:0> s.full_name
=> "test-1-x86-linux"
irb(main):012:0> s.original_name
=> "test-1-x86-linux"

More information about the Rubygems-developers mailing list