update 开始贡献/ukylin打包指南.md.
This commit is contained in:
parent
c01cfd4499
commit
f10c97dd3b
|
@ -1,6 +1,7 @@
|
|||
**ukylin打包指南**
|
||||
|
||||
**关于本文档**
|
||||
### **关于本文档**
|
||||
|
||||
|
||||
本文档为一个介绍DEB包制作的指导性文档,重点指导你完成第一个DEB包的制作,具体DEB包的制作细则则会分散在各个具体规范中,我们将不断更新和完善此文档。
|
||||
|
||||
|
@ -16,7 +17,8 @@
|
|||
|
||||
保持客观。(使用 [popcon](http://popcon.debian.org/) 等等)
|
||||
|
||||
**1. 软件打包**
|
||||
### **1. 软件打包**
|
||||
|
||||
|
||||
一个ukylin下的软件包通常包含一系列文件的集合,它们定义了应用程序或者库文件可以如何通过包管理器(比如apt,yum等)进行发行部署。作为一种替代源码编译安装的方式,打包,即制作DEB软件包,将应用程序的二进制文件,配置文档,man/info帮助页面等文件合并打包在一个文件中,从而使软件的安装变得简单起来。通过软件包管理器,完成获取,安装,卸载,查询等一系列操作。
|
||||
|
||||
|
@ -72,7 +74,8 @@ ukylin试图规范化多种多样的开源项目到一个连贯的系统。因
|
|||
|
||||
维护软件包的 git 仓库。
|
||||
|
||||
**2. 打包规则**
|
||||
### **2. 打包规则**
|
||||
|
||||
|
||||
每个操作系统都自成体系,彼此之间除了技术路线、里程碑不同之外,软件包的组织方式也有所不同。
|
||||
|
||||
|
@ -122,7 +125,8 @@ multiarch 软件包拆分的场景和做法:
|
|||
| bar -doc | doc \* | all | foreign | 程序的配套文档文件 |
|
||||
| baz | script | all | foreign | 解释型程序文件 |
|
||||
|
||||
**3. 打包验证**
|
||||
### **3. 打包验证**
|
||||
|
||||
|
||||
(1)你必须测试你的软件包看是否存在安装问题。debi命令可以帮助你测试所有生成的二进制软件包。
|
||||
|
||||
|
@ -170,7 +174,8 @@ check自测用例通过。
|
|||
|
||||
(6)特别是软件选型升级后,对其他软件包的影响,很难独立判断,需要做集成测试。
|
||||
|
||||
**4. 打包规范**
|
||||
### **4. 打包规范**
|
||||
|
||||
|
||||
规则和规范是一个逐步完善的过程,需要确保已有的规则得到遵循。
|
||||
|
||||
|
@ -316,7 +321,8 @@ ukylin 修订版本(**-r**): [0-9][+.\~a-z0-9A-Z]\*
|
|||
- 对上游源代码中使用的时间戳,使用 debhelper 提供的环境变量
|
||||
**\$SOURCE_DATE_EPOCH** 的值。
|
||||
|
||||
**5. 一个例子**
|
||||
### **5. 一个例子**
|
||||
|
||||
|
||||
**5.1. 总体流程**
|
||||
|
||||
|
@ -429,8 +435,24 @@ ukylin 修订版本(**-r**): [0-9][+.\~a-z0-9A-Z]\*
|
|||
|
||||
**debian/rules(维护者版本):.**
|
||||
|
||||
| \$ vim debhello-0.0/debian/rules ... hack, hack, hack, ... \$ cat debhello-0.0/debian/rules \#!/usr/bin/make -f export DH_VERBOSE = 1 export DEB_BUILD_MAINT_OPTIONS = hardening=+all export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed %: dh \$@ override_dh_auto_install: dh_auto_install -- prefix=/usr |
|
||||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
```
|
||||
$ vim debhello-0.0/debian/rules
|
||||
... hack, hack, hack, ...
|
||||
$ cat debhello-0.0/debian/rules
|
||||
#!/usr/bin/make -f
|
||||
export DH_VERBOSE = 1
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
|
||||
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_install:
|
||||
dh_auto_install -- prefix=/usr
|
||||
```
|
||||
|
||||
|
||||
如上在 **debian/rules** 文件中导出=**DH_VERBOSE** 环境变量可以强制 **debhelper**
|
||||
工具输出细粒度的构建报告。
|
||||
|
@ -453,8 +475,29 @@ DESTDIR=debian/debhello prefix=/usr**”。
|
|||
|
||||
**debian/control(维护者版本):.**
|
||||
|
||||
| \$ vim debhello-0.0/debian/control ... hack, hack, hack, ... \$ cat debhello-0.0/debian/control Source: debhello Section: devel Priority: optional Maintainer: Osamu Aoki \<osamu@debian.org\> Build-Depends: debhelper-compat (= 13) Standards-Version: 4.5.1 Homepage: <https://salsa.debian.org/debian/debmake-doc> Rules-Requires-Root: no Package: debhello Architecture: any Multi-Arch: foreign Depends: \${misc:Depends}, \${shlibs:Depends} Description: Simple packaging example for debmake This Debian binary package is an example package. (This is an example only) |
|
||||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
```
|
||||
$ vim debhello-0.0/debian/control
|
||||
... hack, hack, hack, ...
|
||||
$ cat debhello-0.0/debian/control
|
||||
Source: debhello
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Maintainer: Osamu Aoki <osamu@debian.org>
|
||||
Build-Depends: debhelper-compat (= 13)
|
||||
Standards-Version: 4.5.1
|
||||
Homepage: https://salsa.debian.org/debian/debmake-doc
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: debhello
|
||||
Architecture: any
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Simple packaging example for debmake
|
||||
This Debian binary package is an example package.
|
||||
(This is an example only)
|
||||
```
|
||||
|
||||
|
||||
在 **debian/**
|
||||
目录下还有一些其它的模板文件。根据具体场景,它们也需要进行更新。之后可以开始对软件包进行构建。
|
||||
|
@ -466,8 +509,24 @@ DESTDIR=debian/debhello prefix=/usr**”。
|
|||
|
||||
**debhello 0.0 版使用 debuild 命令产生的文件:.**
|
||||
|
||||
| \$ cd .. \$ tree -FL 1 . \|— debhello-0.0/ \|— debhello-0.0.tar.gz \|— debhello-dbgsym_0.0-1_amd64.deb \|— debhello_0.0-1.debian.tar.xz \|— debhello_0.0-1.dsc \|— debhello_0.0-1_amd64.build \|— debhello_0.0-1_amd64.buildinfo \|— debhello_0.0-1_amd64.changes \|— debhello_0.0-1_amd64.deb \|— debhello_0.0.orig.tar.gz -\> debhello-0.0.tar.gz 1 directory, 9 files |
|
||||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
```
|
||||
$ cd ..
|
||||
$ tree -FL 1
|
||||
.
|
||||
├── debhello-0.0/
|
||||
├── debhello-0.0.tar.gz
|
||||
├── debhello-dbgsym_0.0-1_amd64.deb
|
||||
├── debhello_0.0-1.debian.tar.xz
|
||||
├── debhello_0.0-1.dsc
|
||||
├── debhello_0.0-1_amd64.build
|
||||
├── debhello_0.0-1_amd64.buildinfo
|
||||
├── debhello_0.0-1_amd64.changes
|
||||
├── debhello_0.0-1_amd64.deb
|
||||
└── debhello_0.0.orig.tar.gz -> debhello-0.0.tar.gz
|
||||
1 directory, 9 files
|
||||
```
|
||||
|
||||
|
||||
您可以看见生成的全部文件。
|
||||
|
||||
|
@ -483,7 +542,7 @@ DESTDIR=debian/debhello prefix=/usr**”。
|
|||
|
||||
- **debhello_0.0-1_amd64.build** 是构建日志文件。
|
||||
|
||||
- **debhello_0.0-1_amd64.buildinfo** 是 **dpkg-genbuildinfo**(1)
|
||||
- **debhello_0.0-1_amd64.buildinfo** 是 **dpkg-genbuildinfo**
|
||||
生成的元数据文件。
|
||||
|
||||
- **debhello_0.0-1_amd64.changes** 是 Debian 二进制软件包的元数据文件。
|
||||
|
|
Loading…
Reference in New Issue