![在 pdebuild 中将选项传递给 lintian](https://linux22.com/image/192352/%E5%9C%A8%20pdebuild%20%E4%B8%AD%E5%B0%86%E9%80%89%E9%A1%B9%E4%BC%A0%E9%80%92%E7%BB%99%20lintian.png)
debuild 有一个选项--lintian-opts
,允许将选项传递给 lintian。如何从 pdebuild 将选项传递给 lintian?
答案1
debuild
直接调用lintian
,这就是为什么它可以选择向其传递参数。pdebuild
没有。
如果您想lintian
向pdebuild
运行添加调用,通常需要添加一个pbuilder
挂钩,并在其中指定选项。请参阅/usr/share/doc/pbuilder/examples/B90lintian
示例钩子,以及如何从 pbuilder-dist 运行 lintian?了解如何使用它的详细信息。
答案2
这是我的扩展版本,B90lintian
支持将选项传递给 lintian:
#!/bin/bash
set -e
BUILDDIR="${BUILDDIR:-/tmp/buildd}"
if [ "$LINT" = 1 ] || [ -n "$LINTOPTS" ]; then
apt-get install -y "${APTGETOPT[@]}" lintian
# Because pbuilder has not home directory, calling su - pbuilder will print
# su: warning: cannot change directory to /nonexistent: No such file or directory
# To avoid that warning and to provide the proper current working directory for any
# relative file names used in LINTOPTS, set pbuilder's home directory to source
# directory, which is the (only) subdirectory of the build directory
usermod --home "$BUILDDIR"/*/ pbuilder
echo "I: start of lintian output"
# use this version if you want lintian to fail the build
#su -c "lintian -I --show-overrides $LINTARGS $BUILDDIR/*.changes" - pbuilder
# use this version if you don't want lintian to fail the build
su -c "lintian -I --show-overrides $LINTOPTS $BUILDDIR/*.changes; :" - pbuilder
echo "I: end of lintian output"
fi
环境变量LINT
和LINTOPTS
可用于调用 lintian 并向其传递一些选项。