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
mån 2009-08-31 klockan 23:07 -0700 skrev Scott Frankel:
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
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 [ ... ]
The %build section must not create files or directories in the $RPM_BUILD_ROOT. That must only be done in the %install section.
The Fedora packaging guidelines says that the first command in the %install section must be "rm -rf $RPM_BUILD_ROOT". If you are using a recent RPM version this will be enforced automatically, which is what happens in this case.
%build
%install rm -rf $RPM_BUILD_ROOT mkdir $RPM_BUILD_ROOT mkdir $RPM_BUILD_ROOT/opt mkdir $RPM_BUILD_ROOT/opt/foo cp -r schema $RPM_BUILD_ROOT/opt/foo
Mattias
On Sep 1, 2009, at 12:20 AM, Mattias Ellert wrote:
mån 2009-08-31 klockan 23:07 -0700 skrev Scott Frankel: The %build section must not create files or directories in the $RPM_BUILD_ROOT. That must only be done in the %install section.
The Fedora packaging guidelines says that the first command in the %install section must be "rm -rf $RPM_BUILD_ROOT". If you are using a recent RPM version this will be enforced automatically, which is what happens in this case.
%build
%install rm -rf $RPM_BUILD_ROOT mkdir $RPM_BUILD_ROOT mkdir $RPM_BUILD_ROOT/opt mkdir $RPM_BUILD_ROOT/opt/foo cp -r schema $RPM_BUILD_ROOT/opt/foo
Thanks for the information! Scott
packaging@lists.fedoraproject.org