dragora-installer: apply fixes and minor changes
[dragora.git] / patches / ruby / rubygems-avoid-platform-specific-gems.patch
blob74a536558240f74fc3c12465326e6fd5bc8f5592
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
5 Gems with native extensions typically contain just source code that is
6 built during installation on user's system. However, Rubygems allows to
7 publish even platform-specific gems with prebuilt binaries for specific
8 platform. The problem is that Rubygems uses only short platform
9 identification like x86_64-linux; it does not identify used libc.
10 And sadly platform-specific gems for linux are built against glibc, so
11 they may not work on musl libc.
13 This patch is a workaround for the aforesaid problem. It removes local
14 platform from Rubygems' supported platforms to force it always pick
15 a platform-agnostic (source) gem. Users can override it using
16 `--platform` option.
18 --- a/lib/rubygems.rb
19 +++ b/lib/rubygems.rb
20 @@ -743,7 +743,10 @@
21 def self.platforms
22 @platforms ||= []
23 if @platforms.empty?
24 - @platforms = [Gem::Platform::RUBY, Gem::Platform.local]
25 + # XXX: Patched to avoid installing platform-specific gems with binaries
26 + # linked against glibc.
27 + @platforms = [Gem::Platform::RUBY]
28 + #@platforms = [Gem::Platform::RUBY, Gem::Platform.local]
29 end
30 @platforms
31 end