Discussion:
cd: ./test-2.3.0/BUILD: No such file or directory
(too old to reply)
w***@yahoo.ca
2008-01-03 14:50:01 UTC
Permalink
$ make rpm
VER=`cat ../../../distribution_vob/VERSION` ; \
rm -rf ./tmp ; \
rm -rf test-$VER ;\
rm -f test-$VER.tar.gz ;\
rm -rf /var/tmp/test* ;\

mkdir -p ./tmp ;\
mkdir -p /tmp/BUILD ;\
mkdir -p /tmp/SOURCES ;\
cp ../auxiliary/ctestd.conf ./tmp ;\
cp ../auxiliary/ltestd.conf ./tmp ;\
cp ../auxiliary/testd ./tmp/testd.init ;\
cp ../net-test-5.4.1/apps/.libs/testtrap ./tmp ;\
cp ../net-test-5.4.1/agent/.libs/testd ./tmp ;\
cp -d ../net-test-5.4.1/agent/.libs/libnettestagent.so.* ./tmp ;\
cp -d ../net-test-5.4.1/agent/.libs/libnettestmibs.so.* ./tmp ;\
cp -d ../net-test-5.4.1/testlib/.libs/libnettest.so.* ./tmp ;\
cp -d ../net-test-5.4.1/agent/helpers/.libs/libnettesthelpers.so.* ./
tmp ;\
cp ../VERSION ./tmp ;\
cp ../RELEASE ./tmp
VER=`cat ../../../distribution_vob/VERSION` ; \
mv ./tmp "test-$VER/" ; \
tar --check-links -czvf "./test-$VER.tar.gz" ./test-"$VER"/* ; \
cp "./test-$VER.tar.gz" /tmp/SOURCES/
./test-2.3.0/ctestd.conf
./test-2.3.0/libnettestagent.so.15
./test-2.3.0/libnettestagent.so.15.1.0
./test-2.3.0/libnettesthelpers.so.15
./test-2.3.0/libnettesthelpers.so.15.1.0
./test-2.3.0/libnettestmibs.so.15
./test-2.3.0/libnettestmibs.so.15.1.0
./test-2.3.0/libnettest.so.15
./test-2.3.0/libnettest.so.15.1.0
./test-2.3.0/ltestd.conf
./test-2.3.0/RELEASE
./test-2.3.0/testd
./test-2.3.0/testd.init
./test-2.3.0/testtrap
./test-2.3.0/VERSION
rpmbuild -bb ./test.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.16902
+ umask 022
+ cd ./test-2.3.0/BUILD
/var/tmp/rpm-tmp.16902: line 21: cd: ./test-2.3.0/BUILD: No such file
or directory
error: Bad exit status from /var/tmp/rpm-tmp.16902 (%prep)


RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.16902 (%prep)
make: *** [rpm] Error 1





Please help to fix this error.
The test.spec is as follows:
%define sourced_version %(cat ../../../dist/VERSION)

Release: %(cat ../../../dist/RELEASE)

# Override target directory for binary rpms
%define _rpmdir ../../../dist/packages/linux
%define _prefix /usr/local
%define _topdir /tmp

Summary: test Agent
Name: test
Vendor: mycomp
Version: %{sourced_version}
License: Commercial
Group: Applications/Cryptography
Source: %{name}-%{version}.tar.gz
Packager: test Support
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -
n)
AutoReqProv: no
%description
test Agent

%prep
%setup

%build

%install
%define RPM_BUILD_DIR ./tmp/%{name}-%{version}

rm -rf $RPM_BUILD_ROOT
#make install DESTDIR=$RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT/%{_prefix}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/test
mkdir -p $RPM_BUILD_ROOT/var/net-test
mkdir -p $RPM_BUILD_ROOT/etc/init.d

install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testtrap
$RPM_BUILD_ROOT/%{_bindir}/testtrap
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testd
$RPM_BUILD_ROOT/%{_sbindir}/testd
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettest.so.15
$RPM_BUILD_ROOT/%{_libdir}/libnettest.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettestagent.so.
15 $RPM_BUILD_ROOT/%{_libdir}/libnettestagent.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettesthelpers.so.
15 $RPM_BUILD_ROOT/%{_libdir}/libnettesthelpers.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettestmibs.so.15
$RPM_BUILD_ROOT/%{_libdir}/libnettestmibs.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/ctestd.conf
$RPM_BUILD_ROOT/%{_datadir}/test/testd.conf
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/ltestd.conf
$RPM_BUILD_ROOT/var/net-test/testd.conf
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testd.init
$RPM_BUILD_ROOT/etc/init.d/testd

%clean
rm -rf $RPM_BUILD_ROOT

%post
if ! grep "/usr/local/lib" -q /etc/ld.so.conf ; then
echo "/usr/local/lib" >> /etc/ld.so.conf
/sbin/ldconfig
fi

# add testd as a service via the init subsystem
chkconfig --add testd
# disable testd initially
chkconfig --level 0123456 testd off

%postun -p /sbin/ldconfig

%preun
chkconfig --del testd

%files
%defattr(-, root, root)
%dir /usr/local
%dir /usr/local/lib
%dir /usr/local/bin
%dir /usr/local/sbin
%attr(0544,root,root) /usr/local/bin/testtrap
%attr(0544,root,root) /usr/local/sbin/testd
%attr(0444,root,root) /usr/local/lib/libnettest.so.15
%attr(0444,root,root) /usr/local/lib/libnettestagent.so.15
%attr(0444,root,root) /usr/local/lib/libnettesthelpers.so.15
%attr(0444,root,root) /usr/local/lib/libnettestmibs.so.15
%attr(0544,root,root) /etc/init.d/testd
%config(noreplace) %attr(0444,root,root) /usr/local/share/test/
testd.conf
%config(noreplace) %attr(0444,root,root) /var/net-test/testd.conf
Michal Jaegermann
2008-01-03 20:23:17 UTC
Permalink
Post by w***@yahoo.ca
$ make rpm
+ cd ./test-2.3.0/BUILD
/var/tmp/rpm-tmp.16902: line 21: cd: ./test-2.3.0/BUILD: No such file
or directory
....
Post by w***@yahoo.ca
%define sourced_version %(cat ../../../dist/VERSION)
Release: %(cat ../../../dist/RELEASE)
# Override target directory for binary rpms
%define _rpmdir ../../../dist/packages/linux
%define _prefix /usr/local
%define _topdir /tmp
Things like the above make your specs immediately broken. You have no
way to tell what will be a location from where somebody would try to use
that spec file. Apart of that your private macro (re)definitions go
into your own ~/.rpmmacros; eventually you may pass these on a command
line likely from some "driver" script. "Third party" supplied stuff
should not be installed in /usr/local, which is for something else, but
in /opt. If your Makefiles are reasonable then doing
'make prefix=... ....' should work just fine (and that includes an
installation phase as well).
Post by w***@yahoo.ca
%define RPM_BUILD_DIR ./tmp/%{name}-%{version}
This is obviously broken again. You have no idea at what moment that
may be used and from what directory. That is why a default definition
of %_builddir is %{_topdir}/BUILD. Indeed you can change that - if you
know what you are doing and what for. If you would bother to look at
/var/tmp/rpm-tmp.16902 script, which was left there after an error exit,
that it would be immediately clear that a random hackery is a wrong way
to get what you want. Instead of trying to fight with predefined
defaults just try to use these.

Michal
w***@yahoo.ca
2008-01-04 15:44:12 UTC
Permalink
I modify the makefile, test.spec and .rpmmacros to use the default
path.
How to solve the build error?

$ make rpm
VER=`cat ../../../dist/VERSION` ; \
rm -rf ./tmp ; \
rm -rf test-$VER ;\
rm -f test-$VER.tar.gz ;\
rm -rf /var/tmp/test*
mkdir -p ./tmp ;\
cp ../auxiliary/ctestd.conf ./tmp ;\
cp ../auxiliary/ltestd.conf ./tmp ;\
cp ../auxiliary/testd ./tmp/testd.init ;\
cp ../net-test-5.4.1/apps/.libs/testtrap ./tmp ;\
cp ../net-test-5.4.1/agent/.libs/testd ./tmp ;\
cp -d ../net-test-5.4.1/agent/.libs/libnettestagent.so.* ./tmp ;\
cp -d ../net-test-5.4.1/agent/.libs/libnettestmibs.so.* ./tmp ;\
cp -d ../net-test-5.4.1/testlib/.libs/libnettest.so.* ./tmp ;\
cp -d ../net-test-5.4.1/agent/helpers/.libs/libnettesthelpers.so.* ./
tmp ;\
cp ../VERSION ./tmp ;\
cp ../RELEASE ./tmp
VER=`cat ../../../dist/VERSION` ; \
mv ./tmp "test-$VER/" ; \
tar -czvf "./test-$VER.tar.gz" ./test-"$VER"/* ; \
rpmbuild -bb ./test.spec
./test-2.3.0/ctestd.conf
./test-2.3.0/libnettestagent.so.15
./test-2.3.0/libnettestagent.so.15.1.0
./test-2.3.0/libnettesthelpers.so.15
./test-2.3.0/libnettesthelpers.so.15.1.0
./test-2.3.0/libnettestmibs.so.15
./test-2.3.0/libnettestmibs.so.15.1.0
./test-2.3.0/libnettest.so.15
./test-2.3.0/libnettest.so.15.1.0
./test-2.3.0/ltestd.conf
./test-2.3.0/RELEASE
./test-2.3.0/testd
./test-2.3.0/testd.init
./test-2.3.0/testtrap
./test-2.3.0/VERSION
error: File ./test-2.3.0/SOURCES/test-2.3.0.tar.gz: No such file or
directory
make: *** [rpm] Error 1



makefile is:
RPM_PATH=./tmp
VER=`cat ../../../dist/VERSION`

default:
@echo "rpm"

all:
@make rpm

rpm: clean copy_files
VER=`cat ../../../dist/VERSION` ; \
mv $(RPM_PATH) "test-$$VER/" ; \
tar -czvf "./test-$$VER.tar.gz" ./test-"$$VER"/* ; \
rpmbuild -bb ./test.spec

copy_files:
mkdir -p $(RPM_PATH) ;\
cp ../auxiliary/ctestd.conf $(RPM_PATH) ;\
cp ../auxiliary/ltestd.conf $(RPM_PATH) ;\
cp ../auxiliary/testd $(RPM_PATH)/testd.init ;\
cp ../net-test-5.4.1/apps/.libs/testtrap $(RPM_PATH) ;\
cp ../net-test-5.4.1/agent/.libs/testd $(RPM_PATH) ;\
cp -d ../net-test-5.4.1/agent/.libs/libnettestagent.so.* $(RPM_PATH) ;
\
cp -d ../net-test-5.4.1/agent/.libs/libnettestmibs.so.* $(RPM_PATH) ;
\
cp -d ../net-test-5.4.1/testlib/.libs/libnettest.so.* $(RPM_PATH) ;\
cp -d ../net-test-5.4.1/agent/helpers/.libs/libnettesthelpers.so.* $
(RPM_PATH) ;\
cp ../VERSION $(RPM_PATH) ;\
cp ../RELEASE $(RPM_PATH)

clean:
VER=`cat ../../../dist/VERSION` ; \
rm -rf $(RPM_PATH) ; \
rm -rf test-$$VER ;\
rm -f test-$$VER.tar.gz ;\
rm -rf /var/tmp/test*



test.spec is:
%define sourced_version %(cat ../../../dist/VERSION)

Release: %(cat ../../../dist/RELEASE)

Summary: Test Agent
Name: test
Vendor: Mycomp, Inc.
#Version: %{libmaj}.%{libmin}.%{librel}
Version: %{sourced_version}
License: Commercial
Group: Applications/Cryptography
Source: %{name}-%{version}.tar.gz
Packager: Test Support
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -
n)
AutoReqProv: no
%description
Test Agent

%prep
%setup

%build


%install
rm -rf $RPM_BUILD_ROOT

mkdir -p $RPM_BUILD_ROOT/%{_prefix}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
mkdir -p $RPM_BUILD_ROOT/%{_sbindir}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/test
mkdir -p $RPM_BUILD_ROOT/var/net-test
mkdir -p $RPM_BUILD_ROOT/etc/init.d

install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testtrap
$RPM_BUILD_ROOT/%{_bindir}/testtrap
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testd
$RPM_BUILD_ROOT/%{_sbindir}/testd
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettest.so.15
$RPM_BUILD_ROOT/%{_libdir}/libnettest.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettestagent.so.
15 $RPM_BUILD_ROOT/%{_libdir}/libnettestagent.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettesthelpers.so.
15 $RPM_BUILD_ROOT/%{_libdir}/libnettesthelpers.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/libnettestmibs.so.15
$RPM_BUILD_ROOT/%{_libdir}/libnettestmibs.so.15
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/ctestd.conf
$RPM_BUILD_ROOT/%{_datadir}/test/testd.conf
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/ltestd.conf
$RPM_BUILD_ROOT/var/net-test/testd.conf
install $RPM_BUILD_DIR/%{name}-%{sourced_version}/testd.init
$RPM_BUILD_ROOT/etc/init.d/testd

%clean
rm -rf $RPM_BUILD_ROOT

%post
if ! grep "/usr/local/lib" -q /etc/ld.so.conf ; then
echo "/usr/local/lib" >> /etc/ld.so.conf
/sbin/ldconfig
fi

# add testd as a service via the init subsystem
chkconfig --add testd
# disable testd initially
chkconfig --level 0123456 testd off

%postun -p /sbin/ldconfig

%preun
chkconfig --del testd

%files
%defattr(-, root, root)
%dir /usr/local
%dir /usr/local/lib
%dir /usr/local/bin
%dir /usr/local/sbin
%attr(0544,root,root) /usr/local/bin/testtrap
%attr(0544,root,root) /usr/local/sbin/testd
%attr(0444,root,root) /usr/local/lib/libnettest.so.15
%attr(0444,root,root) /usr/local/lib/libnettestagent.so.15
%attr(0444,root,root) /usr/local/lib/libnettesthelpers.so.15
%attr(0444,root,root) /usr/local/lib/libnettestmibs.so.15
%attr(0544,root,root) /etc/init.d/testd
%config(noreplace) %attr(0444,root,root) /usr/local/share/test/
testd.conf
%config(noreplace) %attr(0444,root,root) /var/net-test/testd.conf
Loading...