加入收藏 | 设为首页 | 会员中心 | 我要投稿 辽源站长网 (https://www.0437zz.com/)- 云专线、云连接、智能数据、边缘计算、数据安全!
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

带你初步了解RPM包

发布时间:2019-11-05 21:38:20 所属栏目:Windows 来源:Ankur Sinha
导读:也许,Fedora 社区追求其促进自由和开源的软件及内容的使命的著名的方式就是开发 Fedora 软件发行版了。因此,我们将很大一部分的社区资源用于此任务也就不足为奇了。这篇文章总结了这些软件是如何打包的,以及使之成为可能的基础工具,如 rpm 之类。 RPM
副标题[/!--empirenews.page--]

带你初步了解RPM包

也许,Fedora 社区追求其促进自由和开源的软件及内容的使命的著名的方式就是开发 Fedora 软件发行版了。因此,我们将很大一部分的社区资源用于此任务也就不足为奇了。这篇文章总结了这些软件是如何“打包”的,以及使之成为可能的基础工具,如 rpm 之类。

RPM:最小的软件单元

可供用户选择的“版本”和“风味版”(spins / labs / silverblue)其实非常相似。它们都是由各种软件组成的,这些软件经过混合和搭配,可以很好地协同工作。它们之间的不同之处在于放入其中的具体工具不同。这种选择取决于它们所针对的用例。所有这些的“版本”和“风味版”基本组成单位都是 RPM 软件包文件。

RPM 文件是类似于 ZIP 文件或 tarball 的存档文件。实际上,它们使用了压缩来减小存档文件的大小。但是,除了文件之外,RPM 存档中还包含有关软件包的元数据。可以使用 rpm 工具查询:

  1. $ rpm -q fpaste
  2. fpaste-0.3.9.2-2.fc30.noarch
  3.  
  4. $ rpm -qi fpaste
  5. Name : fpaste
  6. Version : 0.3.9.2
  7. Release : 2.fc30
  8. Architecture: noarch
  9. Install Date: Tue 26 Mar 2019 08:49:10 GMT
  10. Group : Unspecified
  11. Size : 64144
  12. License : GPLv3+
  13. Signature : RSA/SHA256, Thu 07 Feb 2019 15:46:11 GMT, Key ID ef3c111fcfc659b9
  14. Source RPM : fpaste-0.3.9.2-2.fc30.src.rpm
  15. Build Date : Thu 31 Jan 2019 20:06:01 GMT
  16. Build Host : buildhw-07.phx2.fedoraproject.org
  17. Relocations : (not relocatable)
  18. Packager : Fedora Project
  19. Vendor : Fedora Project
  20. URL : https://pagure.io/fpaste
  21. Bug URL : https://bugz.fedoraproject.org/fpaste
  22. Summary : A simple tool for pasting info onto sticky notes instances
  23. Description :
  24. It is often useful to be able to easily paste text to the Fedora
  25. Pastebin at http://paste.fedoraproject.org and this simple script
  26. will do that and return the resulting URL so that people may
  27. examine the output. This can hopefully help folks who are for
  28. some reason stuck without X, working remotely, or any other
  29. reason they may be unable to paste something into the pastebin
  30.  
  31. $ rpm -ql fpaste
  32. /usr/bin/fpaste
  33. /usr/share/doc/fpaste
  34. /usr/share/doc/fpaste/README.rst
  35. /usr/share/doc/fpaste/TODO
  36. /usr/share/licenses/fpaste
  37. /usr/share/licenses/fpaste/COPYING
  38. /usr/share/man/man1/fpaste.1.gz

安装 RPM 软件包后,rpm 工具可以知道具体哪些文件被添加到了系统中。因此,删除该软件包也会删除这些文件,并使系统保持一致状态。这就是为什么要尽可能地使用 rpm 安装软件,而不是从源代码安装软件的原因。

依赖关系

如今,完全独立的软件已经非常罕见。甚至 fpaste,连这样一个简单的单个文件的 Python 脚本,都需要安装 Python 解释器。因此,如果系统未安装 Python(几乎不可能,但有可能),则无法使用 fpaste。用打包者的术语来说,“Python 是 fpaste 的运行时依赖项。”

构建 RPM 软件包时(本文不讨论构建 RPM 的过程),生成的归档文件中包括了所有这些元数据。这样,与 RPM 软件包归档文件交互的工具就知道必须要安装其它的什么东西,以便 fpaste 可以正常工作:

  1. $ rpm -q --requires fpaste
  2. /usr/bin/python3
  3. python3
  4. rpmlib(CompressedFileNames) <= 3.0.4-1
  5. rpmlib(FileDigests) <= 4.6.0-1
  6. rpmlib(PayloadFilesHavePrefix) <= 4.0-1
  7. rpmlib(PayloadIsXz) <= 5.2-1
  8.  
  9. $ rpm -q --provides fpaste
  10. fpaste = 0.3.9.2-2.fc30
  11.  
  12. $ rpm -qi python3
  13. Name : python3
  14. Version : 3.7.3
  15. Release : 3.fc30
  16. Architecture: x86_64
  17. Install Date: Thu 16 May 2019 18:51:41 BST
  18. Group : Unspecified
  19. Size : 46139
  20. License : Python
  21. Signature : RSA/SHA256, Sat 11 May 2019 17:02:44 BST, Key ID ef3c111fcfc659b9
  22. Source RPM : python3-3.7.3-3.fc30.src.rpm
  23. Build Date : Sat 11 May 2019 01:47:35 BST
  24. Build Host : buildhw-05.phx2.fedoraproject.org
  25. Relocations : (not relocatable)
  26. Packager : Fedora Project
  27. Vendor : Fedora Project
  28. URL : https://www.python.org/
  29. Bug URL : https://bugz.fedoraproject.org/python3
  30. Summary : Interpreter of the Python programming language
  31. Description :
  32. Python is an accessible, high-level, dynamically typed, interpreted programming
  33. language, designed with an emphasis on code readability.
  34. It includes an extensive standard library, and has a vast ecosystem of
  35. third-party libraries.
  36.  
  37. The python3 package provides the "python3" executable: the reference
  38. interpreter for the Python language, version 3.
  39. The majority of its standard library is provided in the python3-libs package,
  40. which should be installed automatically along with python3.
  41. The remaining parts of the Python standard library are broken out into the
  42. python3-tkinter and python3-test packages, which may need to be installed
  43. separately.
  44.  
  45. Documentation for Python is provided in the python3-docs package.
  46.  
  47. Packages containing additional libraries for Python are generally named with
  48. the "python3-" prefix.
  49.  
  50. $ rpm -q --provides python3
  51. python(abi) = 3.7
  52. python3 = 3.7.3-3.fc30
  53. python3(x86-64) = 3.7.3-3.fc30
  54. python3.7 = 3.7.3-3.fc30
  55. python37 = 3.7.3-3.fc30

解决 RPM 依赖关系

(编辑:辽源站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

推荐文章
    热点阅读