Debian

在 pdebuild 中將選項傳遞給 lintian

  • June 27, 2021

debuild 有一個選項--lintian-opts允許將選項傳遞給 lintian。如何從 pdebuild 將選項傳遞給 lintian?

debuild直接呼叫lintian,這就是為什麼它可以選擇將參數傳遞給它。pdebuild沒有。

如果你想在lintian你的執行中添加一個呼叫pdebuild,你通常會添加一個pbuilder鉤子,並在那裡指定選項。參見/usr/share/doc/pbuilder/examples/B90lintian範例鉤子,以及如何從 pbuilder-dist 執行 lintian?有關如何使用它的詳細資訊。

這是我的擴展版本,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 並向其傳遞一些選項。

引用自:https://unix.stackexchange.com/questions/655693