使用 --quiet 选项标志运行 rpmbuild 命令会产生大量调试信息

发布于 2024-07-21 15:36:12 字数 3280 浏览 10 评论 0原文

我希望最大限度地减少 rpm 构建过程的输出。

我运行以下命令: rpmbuild -ba --quiet "/tmp/yaneeve/kit/linux/rpm_spec"

我的系统是:Linux yaneeve-lnx-82-5 2.4.21- 47.ELsmp #1 SMP Wed Jul 5 20:38:41 EDT 2006 i686 i686 i386 GNU/Linux

rpmbuild 版本是: RPM version 4.2.3

我的 rpm 的 %prep 部分规范文件是:

%prep

. $LOGGER_FUNC_FILE_LOCATION/logger.sh

SCRIPT_NAME='rpm_spec-prep'
SOURCE_DIR=`readlink -f -n %{_sourcedir}`
PACKAGE_DIR=`readlink -f -n %{_pkg_script_dir}`
BUILD_PRODUCT_DIR=`readlink -f -n %{_build_product_dir}`
RESOURCE_DIR=`readlink -f -n %{_resource_dir}`

log $SCRIPT_NAME INFO "In the prep stage of the rpm spec file..."

if [[ -d $SOURCE_DIR && `ls -a $SOURCE_DIR | wc -w` -gt 2 ]] ; then
    log $SCRIPT_NAME INFO "Source directory exists and is not empty - deleting content."
    rm -rf $SOURCE_DIR//*
    if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to remove $SOURCE_DIR/* - exiting."
        exit 1
    fi
fi

if [ ! -f $PACKAGE_DIR/include_src_files.sh ]; then
    log $SCRIPT_NAME ERROR "File list does not exist - aborting."
    exit 1
else
    $PACKAGE_DIR/include_src_files.sh $BUILD_PRODUCT_DIR $RESOURCE_DIR $SOURCE_DIR
    if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to run include_src_files.sh script - exiting."
        exit 1
    fi
fi

rpmbuild 结果创建了以下脚本(注意 set -x):

#!/bin/sh

  RPM_SOURCE_DIR="/tmp/yaneeve/output/kit/SOURCES"
  RPM_BUILD_DIR="/tmp/yaneeve/output/kit/BUILD"
  RPM_OPT_FLAGS="-O2 -g -pipe -march=i386 -mcpu=i686"
  RPM_ARCH="i386"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="YANEEVE-APP"
  RPM_PACKAGE_VERSION="4.2.2.0"
  RPM_PACKAGE_RELEASE="01.0"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  RPM_BUILD_ROOT="/tmp/yaneeve/output/kit/SOURCES"
  export RPM_BUILD_ROOT


  set -x
  umask 022
  cd /tmp/yaneeve/output/kit/BUILD
LANG=C
export LANG
unset DISPLAY


. $LOGGER_FUNC_FILE_LOCATION/logger.sh

SCRIPT_NAME='rpm_spec-prep'
SOURCE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/SOURCES`
PACKAGE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/../../kit/linux`
BUILD_PRODUCT_DIR=`readlink -f -n /tmp/yaneeve/output/kit/..`
RESOURCE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/../../conf`

log $SCRIPT_NAME INFO "In the prep stage of the rpm spec file..."

if [[ -d $SOURCE_DIR && `ls -a $SOURCE_DIR | wc -w` -gt 2 ]] ; then
    log $SCRIPT_NAME INFO "Source directory exists and is not empty - deleting content."
        rm -rf $SOURCE_DIR//*
        if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to remove $SOURCE_DIR/* - exiting."
        exit 1
    fi
fi

if [ ! -f $PACKAGE_DIR/include_src_files.sh ]; then
        log $SCRIPT_NAME ERROR "File list does not exist - aborting."
        exit 1
else
    $PACKAGE_DIR/include_src_files.sh $BUILD_PRODUCT_DIR $RESOURCE_DIR $SOURCE_DIR
        if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to run include_src_files.sh script - exiting."
        exit 1
    fi
fi

为什么插入 set -x? 我相信这就是打印大量调试信息的原因? 我究竟做错了什么? 或者,我的 rpmbuild 程序有错误吗?

(抱歉,如果我的问题有点过于描述性......)

I wish to minimize the output of my rpm build procedure.

I run the following command: rpmbuild -ba --quiet "/tmp/yaneeve/kit/linux/rpm_spec"

My system is: Linux yaneeve-lnx-82-5 2.4.21-47.ELsmp #1 SMP Wed Jul 5 20:38:41 EDT 2006 i686 i686 i386 GNU/Linux

The rpmbuild version is: RPM version 4.2.3

The %prep section of my rpm spec file is:

%prep

. $LOGGER_FUNC_FILE_LOCATION/logger.sh

SCRIPT_NAME='rpm_spec-prep'
SOURCE_DIR=`readlink -f -n %{_sourcedir}`
PACKAGE_DIR=`readlink -f -n %{_pkg_script_dir}`
BUILD_PRODUCT_DIR=`readlink -f -n %{_build_product_dir}`
RESOURCE_DIR=`readlink -f -n %{_resource_dir}`

log $SCRIPT_NAME INFO "In the prep stage of the rpm spec file..."

if [[ -d $SOURCE_DIR && `ls -a $SOURCE_DIR | wc -w` -gt 2 ]] ; then
    log $SCRIPT_NAME INFO "Source directory exists and is not empty - deleting content."
    rm -rf $SOURCE_DIR//*
    if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to remove $SOURCE_DIR/* - exiting."
        exit 1
    fi
fi

if [ ! -f $PACKAGE_DIR/include_src_files.sh ]; then
    log $SCRIPT_NAME ERROR "File list does not exist - aborting."
    exit 1
else
    $PACKAGE_DIR/include_src_files.sh $BUILD_PRODUCT_DIR $RESOURCE_DIR $SOURCE_DIR
    if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to run include_src_files.sh script - exiting."
        exit 1
    fi
fi

The rpmbuild creates the following script as a result (NOTICE THE set -x):

#!/bin/sh

  RPM_SOURCE_DIR="/tmp/yaneeve/output/kit/SOURCES"
  RPM_BUILD_DIR="/tmp/yaneeve/output/kit/BUILD"
  RPM_OPT_FLAGS="-O2 -g -pipe -march=i386 -mcpu=i686"
  RPM_ARCH="i386"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="YANEEVE-APP"
  RPM_PACKAGE_VERSION="4.2.2.0"
  RPM_PACKAGE_RELEASE="01.0"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  RPM_BUILD_ROOT="/tmp/yaneeve/output/kit/SOURCES"
  export RPM_BUILD_ROOT


  set -x
  umask 022
  cd /tmp/yaneeve/output/kit/BUILD
LANG=C
export LANG
unset DISPLAY


. $LOGGER_FUNC_FILE_LOCATION/logger.sh

SCRIPT_NAME='rpm_spec-prep'
SOURCE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/SOURCES`
PACKAGE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/../../kit/linux`
BUILD_PRODUCT_DIR=`readlink -f -n /tmp/yaneeve/output/kit/..`
RESOURCE_DIR=`readlink -f -n /tmp/yaneeve/output/kit/../../conf`

log $SCRIPT_NAME INFO "In the prep stage of the rpm spec file..."

if [[ -d $SOURCE_DIR && `ls -a $SOURCE_DIR | wc -w` -gt 2 ]] ; then
    log $SCRIPT_NAME INFO "Source directory exists and is not empty - deleting content."
        rm -rf $SOURCE_DIR//*
        if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to remove $SOURCE_DIR/* - exiting."
        exit 1
    fi
fi

if [ ! -f $PACKAGE_DIR/include_src_files.sh ]; then
        log $SCRIPT_NAME ERROR "File list does not exist - aborting."
        exit 1
else
    $PACKAGE_DIR/include_src_files.sh $BUILD_PRODUCT_DIR $RESOURCE_DIR $SOURCE_DIR
        if [ $? -ne 0 ]; then
        log $SCRIPT_NAME ERROR "Unable to run include_src_files.sh script - exiting."
        exit 1
    fi
fi

Why is the set -x getting inserted?
I believe that that is the reason for the extensive debug information printed?
What am I doing wrong?
Or, is there a bug with my rpmbuild program?

(Sorry if my question is a bit too descriptive...)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鲜血染红嫁衣 2024-07-28 15:36:12

您的发行版上的 %prep 宏已展开,并包含 -x 集。
在我的发行版 /usr/lib/rpm/macros 中,我发现了以下内容:

<块引用>

导出类路径}\
%{verbose:set -x}%{!verbose:exec > > %{verbose:set -x}%{!verbose:exec > /dev/null}\
umask 022\
cd \"%{u2p:%{_builddir}}\"\

您需要取消设置详细变量才能删除“set -x”。

The %prep macro on your distribution is expanded, and contains the set -x.
On my distro in /usr/lib/rpm/macros I found the following:

export CLASSPATH}\
%{verbose:set -x}%{!verbose:exec > /dev/null}\
umask 022\
cd \"%{u2p:%{_builddir}}\"\

You need unset the verbose variable to get the 'set -x' removed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文