Product SiteDocumentation Site

5.3. 源码包的结构

5.3.1. 格式

一个源码包通常包括三个文件,.dsc.orig.tar.gz.debian.tar.xz(或 .diff.gz)。它们允许从编程语言撰写的程序源代码文件中,创建二进制软件包(如前所述的 .deb 文件)。
.dsc (Debian Source Control) 文件是包括 RFC 2822 标头 (如同 control 文件于 第 5.2.1 节 “描述:control 文件”) 的简短文本档,描述原始软件包及包括的其他文件。由维护者签署,保证其真实性。详情见 第 6.6 节 “检查软件包真实性”

例 5.1. 一个.dsc 文件

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 3.0 (quilt)
Source: zim
Binary: zim
Architecture: all
Version: 0.75.1-1
Maintainer: Zim Package Maintainers <zim@packages.debian.org>
Uploaders: Raphaël Hertzog <hertzog@debian.org>
Homepage: https://zim-wiki.org
Standards-Version: 4.6.1
Vcs-Browser: https://salsa.debian.org/debian/zim
Vcs-Git: https://salsa.debian.org/debian/zim.git
Build-Depends: debhelper-compat (= 13), python3, python3-gi, python3-xdg, gir1.2-gtk-3.0, dh-python
Package-List:
 zim deb x11 optional arch=all
Checksums-Sha1:
 b4baa294ebc28b07393739875d94fab9557a2e5e 2510821 zim_0.75.1.orig.tar.gz
 e592c9ab8b12276283c6a7bed2246f2e9a843093 10416 zim_0.75.1-1.debian.tar.xz
Checksums-Sha256:
 88e175d7f7e141896f9e958989d252d722556af17bc4bc6f065e7d54287d0385 2510821 zim_0.75.1.orig.tar.gz
 30847b58bb2503b707f1d5c5c356eead31e61db09e677348f07383fcdda3bcb3 10416 zim_0.75.1-1.debian.tar.xz
Files:
 cc73838c1312b5e161d15a51ae4247c4 2510821 zim_0.75.1.orig.tar.gz
 ad84c5ac373071e4957490caf03f3a8b 10416 zim_0.75.1-1.debian.tar.xz

-----BEGIN PGP SIGNATURE-----
Comment: Signed by Raphael Hertzog

iQEzBAEBCgAdFiEE1823g1EQnhJ1LsbSA4gdq+vCmrkFAmO15esACgkQA4gdq+vC
mrkB4AgAj2tYiDW4aQdZfJHr/GGU9rHL99+lTL1VmrXr/I6Z8ggig0JGbTH4Z3lg
QNRu1PbFDJgdO1ho+c0b474iOsT4QTIUu9vHX/enwJ1MiQw8wGDNlsJIS+S33j5n
745p9Y782LTyKaaKPnilHst7pTIGNjmFRlqJr9E8K3gRjZjpTg6HE420epZ6haf1
+gk2npbsy2Psu1LsrbDUCa415COsogar6fpU3Kui3/p8ijT1ED1y9CqoNxATequp
nHkwpnwmi24Y5+RV79SXKW3ECOHTHGKCRWGFtSwCFg0LcAq69cTwnyphXt0gW/+Z
RtG81/jI+mMeRUGsdzdjAVlLK7K75w==
=0po3
-----END PGP SIGNATURE-----
需要注意的是源码包也有依赖(Build-Depends),和那些二进制包依赖完全不同,因为它们需要设置编译软件所需工具的选项后,再来构建二进制包。
.orig.tar.gz 文件包括原开发者提供的源代码。要求 Debian 的软件包维护者不要修改它,以便检查原来的文件与集成后的文件 (比较校验码就知道) 并且尊重其他著者的意愿。
The .debian.tar.xz contains all of the modifications made by the Debian maintainer, especially the addition of a debian directory containing the instructions to execute to construct one or more Debian binary packages.

5.3.2. Debian 中的使用

The source package is the foundation of everything in Debian. All Debian packages come from a source package, and each modification in a Debian package is the consequence of a modification made to the source package. The Debian maintainers work with the source package, knowing, however, the consequences of their actions on the binary packages. The fruits of their labors are thus found in the source packages available from Debian: you can easily go back to them and everything stems from them. 第 15 章 创建 Debian 软件包 contains some examples.
When a new version of a source package arrives on the Debian server, it will then be used by a network of machines of different architectures for compilation on the various architectures supported by Debian.