我希望最小化我的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程序是否存在错误?

(对不起,如果我的问题有点描述性...)

最佳答案

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



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

08-16 20:03