rubygems-avoid-platform-specific-gems.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. From: Jakub Jirutka <jakub@jirutka.cz>
  2. Date: Fri, 19 May 2017 19:56:00 +0200
  3. Subject: [PATCH] Rubygems: don't install platform-specific gems
  4. Gems with native extensions typically contain just source code that is
  5. built during installation on user's system. However, Rubygems allows to
  6. publish even platform-specific gems with prebuilt binaries for specific
  7. platform. The problem is that Rubygems uses only short platform
  8. identification like x86_64-linux; it does not identify used libc.
  9. And sadly platform-specific gems for linux are built against glibc, so
  10. they may not work on musl libc.
  11. This patch is a workaround for the aforesaid problem. It removes local
  12. platform from Rubygems' supported platforms to force it always pick
  13. a platform-agnostic (source) gem. Users can override it using
  14. `--platform` option.
  15. --- a/lib/rubygems.rb
  16. +++ b/lib/rubygems.rb
  17. @@ -759,7 +759,10 @@
  18. def self.platforms
  19. @platforms ||= []
  20. if @platforms.empty?
  21. - @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
  22. + # XXX: Patched to avoid installing platform-specific gems with binaries
  23. + # linked against glibc.
  24. + @platforms = [Gem::Platform::RUBY]
  25. + #@platforms = [Gem::Platform::RUBY, Gem::Platform.local]
  26. end
  27. @platforms
  28. end