Debian 上的 ruby​​gems 是怎么回事?这是不同的和奇怪的 [英] What's the deal with rubygems on Debian? It's different and strange

查看:24
本文介绍了Debian 上的 ruby​​gems 是怎么回事?这是不同的和奇怪的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到 Debian 上的 ruby​​gems 至少有以下奇怪之处(在我的例子中是 5.0 lenny):

  • 软件包进入不同的安装位置:/var/lib/gems vs/usr/lib/ruby/gems
  • debian 包是 ruby​​gems 1.3.6,更新 ruby​​gems 到最新版本 (1.3.7) 不起作用:
<上一页>$ sudo gem 更新--系统错误:执行 gem 时...(RuntimeError)gem update --system 在 Debian 上被禁用.RubyGems 可以通过 aptitude 或 apt-get 使用官方 Debian 存储库进行更新.

  • 并非所有 gem 都像在其他系统上那样工作.例如,在安装 Phusion Passenger 时,即使它确实已安装,它也没有检测到机架"gem.
  • 使用源 tarball 手动安装 ruby​​gems 并重新安装我的所有 gem(到/usr/lib/ruby/gems)使我的问题消失了.

有什么关系?为什么debian的包不一样?

解决方案

请注意,我在下面写的内容最近发生了重大变化.Debian Ruby 团队或多或少地彻底改造了他们的整个方法,包括但不限于他们的 RubyGems 打包.我不确定 Debian 6,但在 之后的版本中,从 Debian 安装 Ruby 和 RubyGems 包应该是安全的,甚至可能被推荐.显然,这也将渗透到 Ubuntu 中.


混合到两个不同的包管理器通常是一个非常糟糕的主意.Debian-Ruby 团队尽最大努力修补 RubyGems,使其成为一个稍微不那么糟糕的主意.

此外,Debian 有一套旨在保持系统一致性的规则.RubyGems 有自己的一套规则.不幸的是,这两组规则不兼容.因此,Debian-Ruby 开发人员修补 RubyGems 以尊重 Debian 的 规则而不是 RubyGems 的规则.将 gem 从 /usr/lib/ruby 移动到 /var/lib 就是其中之一.

另一个问题是 Debian stable 是稳定的.这意味着 Debian 团队保证整个系统的行为,所有 20000 个软件包,在发布期间永远不会改变.但是 RubyGems 开发人员不会单独提供他们的错误修复,获得错误修复的唯一方法是升级到具有(可能)不同行为的新版本.因此,Debian-Ruby 开发人员不能只使用未经修改的 RubyGems 源,他们必须对 1.3.7 中的错误修复进行逆向工程并将它们应用到 他们的 1.3.6 版本,以确保向后兼容.

一般来说,您应该避免混用包管理器.对所有东西都使用 RubyGems(在这种情况下,最好从源代码安装 RubyGems,而不是使用 Debian 包)或对所有东西使用 APT,在这种情况下,您可能对 DebGem,由 Phusion 人(Ruby Enterprise Edition 和 Phusion Passenger 的制造商)提供的服务,它为几乎所有 Gems 提供 Debian 和 Ubuntu 软件包.

I've noticed at least the following oddities around rubygems on Debian (5.0 lenny in my case):

  • Packages go into a different installation location: /var/lib/gems vs /usr/lib/ruby/gems
  • The debian package is rubygems 1.3.6, and updating rubygems to the latest version (1.3.7) doesn't work:

  $ sudo gem update --system
  ERROR:  While executing gem ... (RuntimeError)
    gem update --system is disabled on Debian. RubyGems can be updated using the official Debian repositories by aptitude or apt-get.

  • Not all gems appear to work like they do on other systems. For instance, when installing Phusion Passenger, it did not detect the "rack" gem even though it was definitely installed.
  • Manually installing rubygems using the source tarball and reinstalling all my gems (to /usr/lib/ruby/gems) made my problems go away.

What's the deal? Why is debian's package different?

解决方案

Note that what I wrote below has significantly changed recently. The Debian Ruby Team has more or less completely revamped their entire approach, including but not limited to their packaging of RubyGems. I'm not sure about Debian 6, but in the version after that, installing Ruby and the RubyGems package from Debian should be safe, maybe even recommended. And obviously, that is going to trickle down into Ubuntu as well.


[EDIT: The following is outdated as of Debian 7 at the latest.]

Mixing to two different package managers is generally a very bad idea. The Debian-Ruby team tries their best to patch RubyGems in such a way that it becomes a slightly less bad idea.

Also, Debian has a set of rules that are intended to keep the system consistent. RubyGems also has its own set of rules. Those two sets of rules are unfortunately not compatible. So, the Debian-Ruby developers patch RubyGems to respect Debian's rules instead of RubyGems's. Moving gems from /usr/lib/ruby to /var/lib is one of those things.

Another problem is that Debian stable is, well, stable. This means that the Debian team guarantees that the behavior of the entire system, all 20000 packages, will never change during a release. But the RubyGems developers don't make their bugfixes available separately, the only way to get a bugfix is to upgrade to a new version, with (potentially) different behavior. Therefore, the Debian-Ruby developers cannot just take the RubyGems sources unmodified, they have to reverse engineer the bugfixes from 1.3.7 and apply them to their version of 1.3.6, to ensure backwards compatibility.

In general, you should avoid mixing package managers. Either use RubyGems for everything (in which case it is best to install RubyGems from source instead of using the Debian package) or use APT for everything, in which case you might be interested in DebGem, a service by the Phusion guys (makers of Ruby Enterprise Edition and Phusion Passenger) which provides Debian and Ubuntu packages for pretty much all Gems.

这篇关于Debian 上的 ruby​​gems 是怎么回事?这是不同的和奇怪的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆