Debian 维护者指南

杨博远

简体中文翻译 (2017-2019, 2024) 

Fonzie Huang

简体中文翻译 (2018) 

xiao sheng wen(肖盛文)

简体中文翻译 (2021) 

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

本指南在撰写过程中参考了以下几篇文档:

  • “Making a Debian Package (AKA the Debmake Manual)”, 版权所有 © 1997 Jaldhar Vyas.
  • “The New-Maintainer’s Debian Packaging Howto”, 版权所有 © 1997 Will Lowe.
  • “Debian New Maintainers’ Guide”, 版权所有 © 1998-2002 Josip Rodin, 2005-2017 Osamu Aoki, 2010 Craig Small 以及 2010 Raphaël Hertzog。

本指南的最新版本应当可以在下列位置找到:

摘要

本篇《Debian 维护者指南》(2025-02-05)教程文档面向普通 Debian 用户和未来的开发者,描述了使用 debmake 命令构建 Debian 软件包的方法。

本指南注重描述现代的打包风格,同时提供了许多简单的示例。

  • POSIX shell 脚本打包
  • Python3 脚本打包
  • C 和 Makefile/Autotools/CMake
  • 含有共享库的多个二进制软件包的打包,等等。

本篇《Debian 维护者指南》可看作《Debian 新维护者手册》的继承文档。


目录

1. 前言
2. 概览
3. 预备知识
3.1. Debian 社区的工作者
3.2. 如何做出贡献
3.3. Debian 的社会驱动力
3.4. 技术提醒
3.5. Debian 文档
3.6. 帮助资源
3.7. 仓库状况
3.8. 贡献流程
3.9. 新手贡献者和维护者
4. 工具的配置
4.1. Email setup
4.2. mc 设置
4.3. git 设置
4.4. quilt 设置
4.5. devscripts 设置
4.6. sbuild 设置
4.7. Persistent chroot setup
4.8. gbp 设置
4.9. HTTP 代理
4.10. 私有 Debian 仓库
4.11. 虚拟机
4.12. 本地网络中的虚拟机
5. 简单打包
5.1. Packaging tarball
5.2. 大致流程
5.3. 什么是 debmake?
5.4. 什么是 debuild?
5.5. 第一步:获取上游源代码
5.6. Step 2: Generate template files with debmake
5.7. 第三步:编辑模板文件
5.8. Step 4: Building package with debuild
5.9. Step 3 (alternatives): Modification to the upstream source
5.10. Patch by diff -u approach
5.11. Patch by dquilt approach
5.12. Patch by dpkg-source --auto-commit approach
6. 打包工作的基础
6.1. 打包工作流
6.2. debhelper package
6.3. 软件包名称和版本
6.4. 原生 Debian 软件包
6.5. debian/rules 文件
6.6. debian/control 文件
6.7. debian/changelog file
6.8. debian/copyright 文件
6.9. debian/patches/* 文件
6.10. debian/source/include-binaries 文件
6.11. debian/watch 文件
6.12. debian/upstream/signing-key.asc file
6.13. debian/salsa-ci.yml 文件
6.14. 其它 debian/* 文件
7. Quality of packaging
7.1. Reformat debian/* files with wrap-and-sort
7.2. Validate debian/* files with debputy
8. Sanitization of the source
8.1. Fix with Files-Excluded
8.2. Fix with debian/rules clean
8.3. Fix with extend-diff-ignore
8.4. Fix with tar-ignore
8.5. Fix with git clean -dfx
9. More on packaging
9.1. 软件包自定义
9.2. Customized debian/rules
9.3. Variables for debian/rules
9.4. 新上游版本
9.5. Manage patch queue with dquilt
9.6. 构建命令
9.7. Note on sbuild
9.8. Special build cases
9.9. 上传 orig.tar.gz
9.10. 跳过的上传
9.11. 错误报告
10. 高级打包
10.1. Historical perspective
10.2. 当前的趋势
10.3. Note on build system
10.4. 持续集成
10.5. 自举
10.6. 编译加固
10.7. 可重现的构建
10.8. Substvar
10.9. 库软件包
10.10. 多体系结构
10.11. Debian 二进制软件包的拆分
10.12. 拆包的场景和例子
10.13. Multiarch library path
10.14. Multiarch header file path
10.15. Multiarch *.pc file path
10.16. 库符号
10.17. Library package name
10.18. 库变迁
10.19. binNMU 安全
10.20. 调试信息
10.21. -dbgsym package
10.22. debconf
11. Packaging with git
11.1. Salsa 存储库
11.2. Salsa 账户设置
11.3. Salsa 持续集成服务
11.4. 分支名称
11.5. Patch unapplied Git repository
11.6. Patch applied Git repository
11.7. Note on gbp
11.8. Note on dgit
11.9. Patch by gbp-pq approach
11.10. Manage patch queue with gbp-pq
11.11. gbp import-dscs --debsnap
11.12. Note on dgit-maint-debrebase workflow
11.13. Quasi-native Debian packaging
12. 提示
12.1. 在 UTF-8 环境下构建
12.2. UTF-8 转换
12.3. Hints for Debugging
13. 工具的使用
13.1. debdiff
13.2. dget
13.3. mk-origtargz
13.4. origtargz
13.5. git deborig
13.6. dpkg-source -b
13.7. dpkg-source -x
13.8. debc
13.9. piuparts
13.10. bts
14. 更多示例
14.1. 挑选最好的模板
14.2. 无 Makefile(shell,命令行界面)
14.3. Makefile(shell,命令行界面)
14.4. pyproject.toml (Python3, CLI)
14.5. Makefile(shell,图形界面)
14.6. pyproject.toml(Python3, 图形界面)
14.7. Makefile(单个二进制软件包)
14.8. Makefile.in + configure(单个二进制软件包)
14.9. Autotools(单个二进制文件)
14.10. CMake(单个二进制软件包)
14.11. Autotools(多个二进制软件包)
14.12. CMake(多个二进制软件包)
14.13. 国际化
14.14. 细节
15. debmake(1) 手册页
15.1. 名称
15.2. 概述
15.3. 描述
15.3.1. 可选参数:
15.4. 示例
15.5. 帮助软件包
15.6. 注意事项
15.7. 除错
15.8. 作者
15.9. 许可证
15.10. 参见
16. debmake options
16.1. Shortcut options (-a, -i)
16.2. debmake -b
16.3. debmake -cc
16.4. Snapshot upstream tarball (-d, -t)
16.5. debmake -j
16.6. debmake -k
16.7. debmake -P
16.8. debmake -T
16.9. debmake -x