Chapter 2. 预备知识

Table of Contents

2.1. Debian 社区的工作者
2.2. 如何做出贡献
2.3. Debian 的社会驱动力
2.4. 技术提醒
2.5. Debian 文档
2.6. 帮助资源
2.7. 仓库状况
2.8. 贡献流程
2.9. 新手贡献者和维护者

这里给出您在投入 Debian 相关工作之前应当理解掌握的一些必备的预备知识。

在 Debian 社区中有这几类常见的角色:

  • 上游作者(upstream author):程序的原始作者。
  • 上游维护者(upstream maintainer):目前在上游维护程序代码的人。
  • 软件包维护者(maintainer):制作并维护该程序 Debian 软件包的人。
  • 赞助者(sponsor):帮助维护者上传软件包到 Debian 官方仓库的人(在通过内容检查之后)。
  • 导师(mentor):帮助新手维护者熟悉和深入打包的人。
  • Debian 开发者(DD, Debian Developer):Debian 社区的官方成员。DD 拥有向 Debian 官方仓库上传的全部权限。
  • Debian 维护者(Debian Maintainer, DM):拥有对 Debian 官方仓库部分上传权限的人。

注意,您不可能在一夜之间成为 Debian 开发者(DD),因为成为 DD 所需要的远不只是技术技巧。不过别因此而气馁,如果您的软件包对其他人有用,您可以当这个软件的软件包维护者,然后通过一位赞助者来上传这份软件,或者您可以申请成为 Debian 维护者

还有,要成为 Debian 开发者不一定要创建新软件包。对已有软件做出贡献也是成为 Debian 开发者的理想途径。眼下正有很多软件包等着好的维护者来接手(参见 Section 2.8, “贡献流程”)。

请参考下列文档来了解应当如何为 Debian 作出贡献:

为做好准备和 Debian 进行交互,请理解 Debian 的社会动力学:

  • 我们都是志愿者。

    • 任何人都不能把事情强加给他人。
    • 您应该主动地做自己想做的事情。
  • 友好的合作是我们前行的动力。

    • 您的贡献不应致使他人增加负担。
    • 只有当别人欣赏和感激您的贡献时,它才有真正的价值。
  • Debian 并不是一所学校,在这里没有所谓的老师会自动地注意到您。

    • 您需要有自学大量知识和技能的能力。
    • 其他志愿者的关注是非常稀缺的资源。
  • Debian 一直在不断进步。

    • Debian 期望您制作出高质量的软件包。
    • 您应该随时调整自己来适应变化。

在这篇指南之后的部分中,我们只关注打包的技术方面。因此,请参考下面的文档来理解 Debian 的社会动力学:

这里给出一些技术上的建议,参考行事可以让您与其他维护者共同维护软件包时变得更加轻松有效,从而让 Debian 项目的输出成果最大化。

[Note] Note

对软件进行除错(debug)通常会比编写初始可用的软件花费更多的时间。

Please make yourself ready to read the pertinent part of the latest Debian documentation to generate perfect Debian packages:

All these documents are published to https://www.debian.org using the unstable suite versions of corresponding Debian packages. If you wish to have local accesses to all these documents from your base system, please consider to use techniques such as apt-pinning and chroot (Section 7.10, “chroot”).[5]

如果本指南文档的内容与官方的 Debian 文档有所冲突,那么官方的那些总是对的。请使用 reportbug 工具向 debmake-doc 软件包报告问题。

这里有一些替代性的教程文档,您可以与本指南一起阅读进行参考:

[Tip] Tip

When reading these tutorials, you should consider using the debmake command in place of the dh_make command.

在您决定在某些公共场合问出您的问题之前,请先做好自己能做到的事情,例如,阅读能找到的文档:

要获取您所需要的信息,一种有效的方法是在网页搜索引擎中构建类似“关键字 site:lists.debian.org”这样具有限制条件的搜索字符串来限定搜索的域名。

制作一个小型测试用软件包也是了解打包细节的一个好办法。对当前已有的维护良好的软件包进行检查则是了解其他人如何制作软件包的最好方法。

如果您对打包仍然存在疑问,您可以使用以下方式与他人进行沟通:

如果您在做好功课后能在这些场合中合适地提出您的疑问的话,那些更有经验的 Debian 开发者会很愿意帮助您。

[Caution] Caution

Debian 的开发是一个不断变动的目标。您在网上找到的某些信息可能是过时的、不正确的或者不适用的,使用时请留意。

请了解 Debian 仓库的当前状况。

  • Debian 已经包含了绝大多数种类程序的软件包。
  • Debian 仓库内软件包的数量是活跃维护者的数十倍。
  • 遗憾的是,某些软件包缺乏维护者的足够关注。

因此,对已经存在于仓库内的软件包做出贡献是十分欢迎的(这也更有可能得到其他维护者的支持和协助上传)。

[Tip] Tip

来自 devscripts 软件包的 wnpp-alert 命令可以检查已安装软件中需要接手或已被丢弃的软件包。

[Tip] Tip

The how-can-i-help package can show opportunities for contributing to Debian on packages installed locally.

这里使用类 Python 伪代码,给出了向 Debian 贡献名为 program 的软件所走的贡献流程:

if exist_in_debian(program):
  if is_team_maintained(program):
    join_team(program)
  if is_orphaned(program): # maintainer: Debian QA Group
    adopt_it(program)
  elif is_RFA(program): # Request for Adoption
    adopt_it(program)
  else:
    if need_help(program):
      contact_maintainer(program)
      triaging_bugs(program)
      preparing_QA_or_NMU_uploads(program)
    else:
      leave_it(program)
else: # new packages
  if not is_good_program(program):
    give_up_packaging(program)
  elif not is_distributable(program):
    give_up_packaging(program)
  else: # worth packaging
    if is_ITPed_by_others(program):
      if need_help(program):
        contact_ITPer_for_collaboration(program)
      else:
        leave_it_to_ITPer(program)
    else: # really new
      if is_applicable_team(program):
        join_team(program)
      if is_DFSG(program) and is_DFSG(dependency(program)):
        file_ITP(program, area="main") # This is Debian
      elif is_DFSG(program):
        file_ITP(program, area="contrib") # This is not Debian
      else: # non-DFSG
        file_ITP(program, area="non-free") # This is not Debian
      package_it_and_close_ITP(program)

其中:

您或是需要填写并提交一份 ITP,或是需要“收养”一个软件包并开始为其工作。请见“Debian 开发者参考(Debian Developer's Reference)”文档:

新手贡献者和维护者可能想知道在开始向 Debian 进行贡献之前需要事先学习哪些知识。根据您个人的侧重点不同,下面有我的一些建议供您参考:

  • 打包

    • POSIX shellmake 的基本知识。
    • 一些 PerlPython 的入门知识。
  • 翻译

    • 基于 PO 的翻译系统的工作原理和基本知识。
  • 文档

    • 文本标记语言的基础知识(XML、ReST、Wiki 等)。

新手贡献者和维护者可能想知道从哪里开始向 Debian 进行贡献。根据您掌握的技能,下面有我的一些建议供您参考:

这些活动应当能让您在各位 Debian 社区成员之间得到存在感,从而建立您的信誉与名气。

新手维护者应当避免打包具有潜在高度安全隐患的程序:

  • setuidsetgid 程序
  • 守护进程(daemon)程序
  • 安装至 /sbin//usr/sbin/ 目录的程序

在积累足够的打包经验后,您可以再尝试打包这样的程序。



[4] 绝大多数 Debian 维护者使用 git 而非其它版本控制系统,如 hgbzr 等等。

[5] It is unwise to run your base system under the pure unstable suite even for the development system. Normally, most package development activities use unstable chroot as in Section 7.10, “chroot”. By using virtualization, you can test demanding situation such as the full Desktop system, network daemons, and system installer in the unstable suite environment even from the base system running the stable suite.

[6] 这一条不是绝对的要求,但请注意:遇上不友好的上游可能需要大家为此投入大量精力,而一个友好的上游则能协助解决程序的各类问题。