views:

464

answers:

1

Hi all,

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...)

+2  A: 

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.

codeDr
I see that I have the same definitions as you.I think that when I choose to use the --quiet flag it should go with: !verbose:exec > /dev/nullWhat do you say?
Yaneeve
There are two quiet flags: -q and --quiet.-q will keep from listing the output tar extracts--quiet controls the ouptut of the messages produced by rpmbuild.The 'set -x' flag is implanted in the prep stage is controlled by the 'verbose' variable within the rpmbuild macro environment.
codeDr