我尝试列出安装 Ruby 所必需的软件包。例如,在 Archlinux 上:
$ pacman -Si ruby
Repository : extra
Name : ruby
Version : 2.7.1-3
Description : An object-oriented language for quick and easy programming
Architecture : x86_64
URL : https://www.ruby-lang.org/en/
Licenses : BSD custom
Groups : None
Provides : None
Depends On : gdbm openssl libffi libyaml gmp zlib rubygems ruby-irb
Optional Deps : ruby-docs: Ruby documentation
tk: for Ruby/TK
Conflicts With : None
Replaces : None
Download Size : 3.30 MiB
Installed Size : 13.34 MiB
Packager : Anatol Pomozov <[email protected]>
Build Date : Sat 22 Aug 2020 03:46:33 IST
Validated By : MD5 Sum SHA-256 Sum Signature
换句话说,Depends On : gdbm openssl libffi libyaml gmp zlib rubygems
这就是我在 Ubuntu 中想要的。
在 Ubuntu 上,我尝试这样做:
$ apt-cache show ruby
输出为:
Package: ruby
Architecture: amd64
Version: 1:2.5.1
Multi-Arch: allowed
Priority: optional
Section: interpreters
Source: ruby-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Antonio Terceiro <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 37
Provides: irb, rdoc, rubygems
Depends: ruby2.5
Suggests: ri, ruby-dev
Conflicts: ruby-activesupport-2.3, ruby-activesupport-3.2
Breaks: apt-listbugs (<< 0.1.6), rbenv (<= 0.4.0-1), ruby-debian (<< 0.3.8+b3), ruby-switch (<= 0.1.0)
Replaces: irb, rdoc, rubygems
Filename: pool/main/r/ruby-defaults/ruby_2.5.1_amd64.deb
Size: 5712
MD5sum: 4fbbfcf2431190a889f2430ffd017110
SHA1: 2b56994915b61fe6009613e0b879d9de16699206
SHA256: b01fd79a656f1e36542d1dd1046713ffb2d5f29902e433d06884333fcb151488
Homepage: http://www.ruby-lang.org/
Description-en: Interpreter of object-oriented scripting language Ruby (default version)
Ruby is the interpreted scripting language for quick and easy
object-oriented programming. It has many features to process text
files and to do system management tasks (as in perl). It is simple,
straight-forward, and extensible.
.
This package is a dependency package, which depends on Debian's default Ruby
version (currently v2.5).
Description-md5: 9b1885fba57cb2974ce14902f85d3e27
Task: kubuntu-desktop, kubuntu-full
Supported: 5y
它没有列出像这样的软件包openssl或者库作为依赖。但当我试图清除openssl(这很危险,我只是运行了命令并按下了 N 键来跳过删除),它还在删除列表中列出了 ruby。这意味着 Ruby 依赖于 OpenSSL。
我也关注过类似的答案这,其中列出了依赖于 ruby 的软件包,而不是 ruby 所依赖的软件包。
如果你问为什么这很重要,原因是我正在编写一个指南,介绍如何使用各种 optflags(CFLAGS)编译 Ruby 以提高性能,主要针对 Arch。然后还想添加 Ubuntu,但我没有得到构建 Ruby 所需的完整依赖项列表。我无法列出 arch 包,因为 Ubuntu 有一些不同且奇怪的名称。比如调用base-devel
asbuild-essential
等。
那么列出包的方法是什么?
答案1
apt-rdepends
从同名包中使用:
$ apt-rdepends ruby
ruby
Depends: ruby2.7
ruby2.7
Depends: libc6 (>= 2.4)
Depends: libruby2.7 (>= 2.7.0~preview1)
Depends: rubygems-integration (>= 1.8)
libc6
Depends: libcrypt1
Depends: libgcc-s1
libcrypt1
Depends: libc6 (>= 2.25)
libgcc-s1
Depends: gcc-10-base (= 10.2.0-6)
Depends: libc6 (>= 2.14)
gcc-10-base
...
ca-certificates
Depends: debconf (>= 0.5)
Depends: debconf-2.0
Depends: openssl (>= 1.1.1)
openssl
Depends: libc6 (>= 2.15)
Depends: libssl3 (>= 3.0.0~~alpha1)
libssl3
Depends: debconf (>= 0.5)
Depends: debconf-2.0
Depends: libc6 (>= 2.25)
既然你感兴趣建筑该包,您可能需要-b
递归列出包的构建依赖项的选项。