Hi All,

I have an RPM/spec related question.
The spec listing (and listing of /var/tmp/rpm-tmp.36085) is below.

When I try to build an RPM from this spec, I get the following:

[root@mddinstall SW_EMAIL_GW]# rpmbuild -ba /usr/src/redhat/SPECS/
test.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.36085
+ umask 022
+ cd /tmp/test-4.7.0.0.99/output/BUILD
/var/tmp/rpm-tmp.36085: line 21: cd: /tmp/test-4.7.0.0.99/output/
BUILD: No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.36085 (%prep)

RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.36085 (%prep)
[root@mddinstall SW_EMAIL_GW]#

My question is:

How can I instruct the rpmbuild command not to do the 'cd /tmp/
test-4.7.0.0.99/output/BUILD' before the execution of the %prep
stanza ?

Thanks,
Ron.

P.S.: /tmp/test-4.7.0.0.99/output/BUILD is my $RPM_BUILD_ROOT.

--------------------------------------------------------------------------------

[root@mddinstall SW_EMAIL_GW]# cat /usr/src/redhat/SPECS/test.spec
%define debug_package %{nil}
%define __spec_install_post /usr/lib/rpm/brp-compress

%define component_name test
%define rpm_name %{component_name}
%define RPMstf 99
%define RPMversion 4.7.0.0.99
%define topdir /tmp/test-4.7.0.0.99/output
%define _topdir %{topdir}
%define view aor-Infra-integ-4.7.0.3

Name: %{rpm_name}
Version: %{RPMversion}
Copyright: Commercial
Group: Applications/Communications
Packager: Ron Barak (ron.barak2@comverse.com)
BuildRoot: %{_builddir}/%{name}-%{version}
Summary: cdr configurations
BuildArch: i686
Release: STF%{RPMstf}.04
# Example 'Source' line:
# Source: http://metalab.unc.edu/pub/Linux/uti...t-2.0.2.tar.gz
Source0: %{name}-%{version}.tar.bz2
Source1: ${RPM_BUILD_ROOT}/data/comverse/scripts/cksum.pl
Source2: ${RPM_BUILD_ROOT}/data/comverse/scripts/gw.csv
Source3: ${RPM_BUILD_ROOT}/data/comverse/scripts/
build_rpms_devel_generic.pl


%description
explanation comes here
STF: 99

%prep

echo executing: %%prep
%__rm -rf $RPM_BUILD_ROOT
%__mkdir_p $RPM_BUILD_ROOT
pushd $RPM_BUILD_ROOT && /bin/tar -jxvf /tmp/test-4.7.0.0.99/output/
SOURCES/test-4.7.0.0.99.tar.bz2 && popd

%build

# Checksums calculation
if [ -f ${RPM_BUILD_ROOT} ]; then
%__mkdir -p ${RPM_BUILD_ROOT}
fi
cd $RPM_BUILD_ROOT && /tmp/test-4.7.0.0.99/output/CKSUM/cksum.pl
create . /tmp/test-4.7.0.0.99/output/CKSUM/test_cksum.list
if [ -f /tmp/test-4.7.0.0.99/output/CKSUM/test_cksum.list ]; then
%__mkdir -p ${RPM_BUILD_ROOT}/data/comverse/cksums
%__cp /tmp/test-4.7.0.0.99/output/CKSUM/test_cksum.list $
{RPM_BUILD_ROOT}/data/comverse/cksums
else
echo "Error: could not create checksums file /tmp/
test-4.7.0.0.99/output/CKSUM/test_cksum.list"
fi

%__mkdir -p ${RPM_BUILD_ROOT}/data/comverse/scripts
%__cp /users/robarak/data/generic/build_rpms_devel_generic.pl $
{RPM_BUILD_ROOT}/data/comverse/scripts/build_rpms_devel_generic.pl
%__cp /users/robarak/data/generic/cksum.pl ${RPM_BUILD_ROOT}/
data/comverse/scripts/cksum.pl
%__cp /users/robarak/data/generic/gw.csv ${RPM_BUILD_ROOT}/
data/comverse/scripts/gw.csv
%__cp /users/robarak/data/generic/build_rpms_devel_generic.pl /
tmp/test-4.7.0.0.99/output/SOURCES/build_rpms_devel_generic.pl
%__cp /users/robarak/data/generic/cksum.pl /tmp/
test-4.7.0.0.99/output/SOURCES/cksum.pl
%__cp /users/robarak/data/generic/gw.csv /tmp/test-4.7.0.0.99/
output/SOURCES/gw.csv

%install

%clean
%__rm -rf $RPM_BUILD_ROOT

%files -f /tmp/test-4.7.0.0.99/output/BUILD/files.tmp
%defattr(-,gw,gw)
/data/comverse/scripts/build_rpms_devel_generic.pl
/data/comverse/scripts/cksum.pl
/data/comverse/scripts/gw.csv
/data/comverse/cksums/test_cksum.list

# Example %files lines:
#%{homedir_base}/%{rpm_name}
#%files -f %{_topdir}/../kit/include_dest_files
#%attr (775, mal, mal) /home/mal/cksum/mal.cksum

%pre

%post

%postun

%changelog

* Wed Mar 21 2007 Ron Barak -
- Changes mage to make script generic (with CSV).

* Mon Feb 12 2007 Ron Barak 4.7.0.0.5_STF02-
- $user is set now in this script, and not manipulated
- based on input from command line.

* Wed Oct 25 2006 Ron Barak
4.7.0.2.0_STF02-02
- Initial version

[root@mddinstall SW_EMAIL_GW]#

--------------------------------------------------------------------------------
[root@mddinstall SW_EMAIL_GW]# cat /var/tmp/rpm-tmp.36085
#!/bin/sh

RPM_SOURCE_DIR="/tmp/test-4.7.0.0.99/output/SOURCES"
RPM_BUILD_DIR="/tmp/test-4.7.0.0.99/output/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="test"
RPM_PACKAGE_VERSION="4.7.0.0.99"
RPM_PACKAGE_RELEASE="STF99.04"
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
RPM_BUILD_ROOT="/tmp/test-4.7.0.0.99/output/BUILD/test-4.7.0.0.99"
export RPM_BUILD_ROOT


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


echo executing: %prep
/bin/rm -rf $RPM_BUILD_ROOT
/bin/mkdir -p $RPM_BUILD_ROOT
pushd $RPM_BUILD_ROOT && /bin/tar -jxvf /tmp/test-4.7.0.0.99/output/
SOURCES/test-4.7.0.0.99.tar.bz2 && popd


exit 0[root@mddinstall SW_EMAIL_GW]#