File tree Expand file tree Collapse file tree 1 file changed +28
-5
lines changed Expand file tree Collapse file tree 1 file changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -865,7 +865,7 @@ Hello, world!
865
865
Linux
866
866
` ` `
867
867
868
- **试完记得装回正常的版本哦!**
868
+ **试完记得装回正常的版本哦**!如果需要保持自己修改后的版本,可参考前文描述的[固定包的方法](#apt-hold)或[APT 优先级机制](#priority)。
869
869
870
870
` ` ` shell
871
871
$ apt-cache policy sudo
@@ -956,22 +956,45 @@ esac
956
956
957
957
这是一个 Makefile 的通配符规则,表示所有的目标都使用 `dh` 命令来处理。例如,执行 `debian/rules build` 时,Makefile 会将 `build` 作为目标传递给 `dh`,因此等价于执行 `dh build`。
958
958
959
- 可以使用 `--no-act` 参数来查看 `dh` 会执行哪些操作:
959
+ 可以使用 `DH_NO_ACT=1` 环境变量来查看 `dh` 会执行哪些操作:
960
960
961
961
` ` ` shell
962
- $ dh clean --no-act
962
+ $ DH_NO_ACT=1 debian/rules clean
963
+ dh clean
963
964
dh_testdir
964
965
debian/rules override_dh_auto_clean
965
966
dh_autoreconf_clean
966
967
dh_clean
968
+ $ # 或者使用 dh --no-act 命令
969
+ $ # 此时需要阅读 ` debian/rules` 确认 dh 是怎么被调用的
967
970
```
968
971
969
- 如果需要覆盖某个 `dh` 的操作,可以在 `debian/rules` 中添加对应的规则,例如:
972
+ ` dh ` 的各项操作细节都有其对应的 ` man ` 文档可以参考。 如果需要覆盖某个 ` dh ` 的操作,可以在 ` debian/rules ` 中添加对应的规则,例如:
970
973
971
974
``` makefile
975
+ # 在某个操作之前做一些事情
976
+ execute_before_dh_auto_clean :
977
+ echo "Something before dh_auto_clean"
978
+
979
+ # 在某个操作之后做一些事情
980
+ execute_after_dh_auto_clean :
981
+ echo "Something after dh_auto_clean"
982
+
983
+ # 覆盖某个操作
972
984
override_dh_auto_clean :
973
985
echo " Custom clean step"
974
- dh_auto_clean
986
+ ```
987
+
988
+ 在使用 `dpkg-buildpackage` 构建完成后,可以使用 `lintian` 来检查包是否符合 Debian 的规范。在打包的目录执行即可:
989
+
990
+ ```shell
991
+ lintian -i -I
992
+ ```
993
+
994
+ 添加的 ` -i ` 和 ` -I ` 选项可以显示更多的信息。如果你对打包质量的要求更高,可以开启 lintian 的 pedantic 模式,并且启用实验性质的一些检查:
995
+
996
+ ``` shell
997
+ lintian --pedantic -E -i -I
975
998
```
976
999
977
1000
#### 使用 ` checkinstall ` 快速打包 {#checkinstall}
You can’t perform that action at this time.
0 commit comments