[Fedora-packaging] unwanted directory removal during rpm build

Scott Frankel frankel at circlesfx.com
Tue Sep 1 06:07:13 UTC 2009


Hello,

I'm new to rpm package development and just joined this list.  I'm  
trying to create an rpm, but working subdirs of BUILDROOT are getting  
deleted between %build and %install.  This causes subsequent copy  
operations to fail and rpmbuild to error out with a bad exit status.   
The `rm -rf` that removes the working dir is not coming from any  
explicit statement in my spec file.

I'm copying pertinent lines from shell output, the spec file, and  
system configuration below.  I'm hopeful someone can suggest a work- 
around.

Thanks in advance!
Scott




 From shell output.  Note the `rm -rf` line (line 18) before the `cp - 
r` that expects to access the subdirs, /opt/foo.

[ ... ]
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.j5y3vI
+ umask 022
+ cd /home/frankel/foo/versions/0.9.6/fedora/BUILD
+ cd foo-0.9.6
+ LANG=C
+ export LANG
+ unset DISPLAY
+ rm -rf /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64
+ mkdir /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64
+ mkdir /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64/foo
+ mkdir /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64/opt
+ mkdir /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64/opt/foo
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.rQlamD
+ umask 022
+ cd /home/frankel/foo/versions/0.9.6/fedora/BUILD
+ '[' /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64 '!=' / ']'
+ rm -rf /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64
++ dirname /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64
+ mkdir -p /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT
+ mkdir /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64
+ cd foo-0.9.6
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cp -r schema /home/frankel/foo/versions/0.9.6/fedora/BUILDROOT/ 
foo-0.9-6.x86_64/opt/foo
cp: cannot create directory `/home/frankel/foo/versions/0.9.6/fedora/ 
BUILDROOT/foo-0.9-6.x86_64/opt/foo': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.rQlamD (%install)
[ ... ]


I'm using the following one-liner in a bash script to execute the build:

	setarch x86_64 rpmbuild -ba  --define "_topdir `pwd`" --define "_arch  
x86_64" $1


The spec file has this %build section (in its entirety), followed by  
the first of the failed copies.  Note that these are contiguous lines  
of specfile code between %build and %install.

[ ... ]
	%build
	rm -rf $RPM_BUILD_ROOT
	mkdir $RPM_BUILD_ROOT
	mkdir $RPM_BUILD_ROOT/opt
	mkdir $RPM_BUILD_ROOT/opt/foo


	%install
	cp -r schema $RPM_BUILD_ROOT/opt/foo
[ ... ]


Here's a yum list rpm* from my system:

Installed Packages
rpm.x86_64                            4.7.1-1.fc11                      
installed
rpm-apidocs.noarch                    4.7.1-1.fc11                      
installed
rpm-build.x86_64                      4.7.1-1.fc11                      
installed
rpm-devel.x86_64                      4.7.1-1.fc11                      
installed
rpm-libs.x86_64                       4.7.1-1.fc11                      
installed
rpm-python.x86_64                     4.7.1-1.fc11                      
installed
rpmconf.noarch                        0.1.6-1.fc11                      
installed
rpmdepsize.x86_64                     1.0-3.fc11                        
installed
rpmdevtools.noarch                    7.3-1.fc11                        
installed
rpmlint.noarch                        0.90-1.fc11                       
installed
rpmorphan.noarch                      1.4-5.fc11                        
installed
rpmreaper.x86_64                      0.1.6-1.fc11                      
installed
rpmrebuild.noarch                     2.3-3.fc11                        
installed
Available Packages
rpm-devel.i586                        4.7.1-1.fc11                      
updates
rpm-libs.i586                         4.7.1-1.fc11                      
updates







More information about the Fedora-packaging mailing list