在 pdebuild 中将选项传递给 lintian

在 pdebuild 中将选项传递给 lintian

debuild 有一个选项--lintian-opts,允许将选项传递给 lintian。如何从 pdebuild 将选项传递给 lintian?

答案1

debuild直接调用lintian,这就是为什么它可以选择向其传递参数。pdebuild没有。

如果您想lintianpdebuild运行添加调用,通常需要添加一个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

环境变量LINTLINTOPTS可用于调用 lintian 并向其传递一些选项。

相关内容