BUG: Return of BugReport2005x02x11x170019: Error when building RPMs, attempt to mv nonexistent file
Bug
BugReport2005x02x11x170019 included a patch to resolve the issue. This was included in motion-3.1.19_snap2. It appears this bug was reintroduced with the 3.2.1 branch.
To recap the original bug. RPM builds failed on SuSE systems because the RPM spec attempted to move a file that did not exist. The simple fix was to verify the file existed before attempting to move it. In short, line 35 of motion.spec should be changed
From:
mv %{buildroot}%{_sysconfdir}/motion-dist.conf %{buildroot}%{_sysconfdir}/%{name}/.
To :
if [ -f %{buildroot}%{_sysconfdir}/motion-dist.conf ] ; then mv %{buildroot}%{_sysconfdir}/motion-dist.conf %{buildroot}%{_sysconfdir}/%{name}/. ; fi
Test case
Environment
Motion version: |
3.2.1 |
ffmpeg version: |
|
Shared libraries: |
curl, xmlrpc, ffmpeg, mysql, postgresql |
Server OS: |
SuSE 9.3 Pro, Kernel 2.6.11 |
--
PaulBeltrani - 14 Jul 2005
Follow up
Thanks for your report and for the suggested fix.
I have one question though.
It seems the real issue is that the file does not exist and checking for this does not really fix the real issue which is that the motion-dist.conf is not where it should be.
I do not have a Suse system. Can you perhaps investigate why the file fails to be created in the first place?
--
KennethLavrsen - 15 Jul 2005
Actually, it IS created in the first place and in the correct, final location.
From the Makefile:
install *.conf motion.init-Debian motion.init-RH motion.init-FreeBSD.sh /var/tmp/motion-%{3.2.2}-root/usr/share/doc/motion-3.2.2/examples
install motion-dist.conf /var/tmp/motion-%{3.2.2}-root/etc/motion
for prog in motion; \
From the Build:
install *.conf motion.init-Debian motion.init-RH motion.init-FreeBSD.sh /var/tmp/motion-%{3.2.2}-root/usr/share/doc/motion-3.2.2/examples
install motion-dist.conf /var/tmp/motion-%{3.2.2}-root/etc/motion
for prog in motion; \
Error:
+ mv '/var/tmp/motion-%{3.2.2}-root/etc/motion-dist.conf' '/var/tmp/motion-%{3.2.2}-root/etc/motion/.'
mv: cannot stat `/var/tmp/motion-%{3.2.2}-root/etc/motion-dist.conf': No such file or directory
This mv isn't necessary as the make process has already installed "motion-dist.conf" in /var/tmp/motion-%{3.2.2}-root/etc/motion/ (See the build output above)
My questions would be: Why does the spec file include a line to put it there again? Why does it expect it find it in /var/tmp/motion-%{3.2.2}-root/etc/? I guess I'll have to boot a Fedora box.
BTW, There appears to be an extra "%" in the
BuildRoot definition on line 11 of the spec file.
--
PaulBeltrani
I just tried removing the 'mv' on my Fedora Core 4. I get an error. I have pasted the entire last part of the rpm build below.
for prog in motion; \
do \
(install $prog /var/tmp/motion-3.2.2-root/usr/bin ); \
done
--------------------------------------------------------------------------------
Install complete! The default configuration file, motion-dist.conf, has been
installed to /var/tmp/motion-3.2.2-root/etc. You need to rename/copy it to /var/tmp/motion-3.2.2-root/etc/motion.conf
for Motion to find it. More configuration examples as well as init scripts
can be found in /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2/examples.
+ mv /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2/examples/motion.init-RH /var/tmp/motion-3.2.2-root/etc/init.d/motion-temp
+ sed -e 's/MOTION-\/usr\//MOTION-/g' /var/tmp/motion-3.2.2-root/etc/init.d/motion-temp
+ rm /var/tmp/motion-3.2.2-root/etc/init.d/motion-temp
+ chmod +x /var/tmp/motion-3.2.2-root/etc/init.d/motion
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/motion-3.2.2
extracting debug info from /var/tmp/motion-3.2.2-root/usr/bin/motion
791 blocks
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
Processing files: motion-3.2.2-1
error: File not found by glob: /var/tmp/motion-3.2.2-root/etc/motion/*
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.46407
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd motion-3.2.2
+ DOCDIR=/var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2
+ export DOCDIR
+ rm -rf /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2
+ /bin/mkdir -p /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2
+ cp -pr CHANGELOG COPYING CREDITS INSTALL README motion_guide.html /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2
+ cp -pr motion-dist.conf thread1.conf thread2.conf thread3.conf thread4.conf /var/tmp/motion-3.2.2-root/usr/share/doc/motion-3.2.2
+ exit 0
Processing files: motion-debuginfo-3.2.2-1
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
RPM build errors:
File not found by glob: /var/tmp/motion-3.2.2-root/etc/motion/*
So now the question is - why is there the difference between Suse and Fedora?
I have the feeling the IF statement covers over a more basic error in the spec file.
I have removed the extra % in the buildroot.
--
KennethLavrsen - 16 Jul 2005
The problem occurs during the "make install" of the compile stage of the RPM build.
FC4 appears to override the defaults from the source package and sets "sysconfdir" to ${DESTDIR}/etc during this step. This is odd as it uses /etc/motion everywhere else during the process. I expect the move statement in the spec file is there to recover from this behavior. I have not looked at the RPM macros to determine why this happens.
SuSE 9.3 simply passes in DESTDIR.
Partial output from rpm build on FC4:
...
+ /usr/bin/make prefix=/var/tmp/motion-3.2.2-root/usr exec_prefix=/var/tmp/motion-3.2.2-root/usr bindir=/var/tmp/motion-3.2.2-root/usr/bin sbindir=
/var/tmp/motion-3.2.2-root/usr/sbin sysconfdir=/var/tmp/motion-3.2.2-root/etc datadir=/var/tmp/motion-3.2.2-root/usr/share includedir=/var/tmp/moti
on-3.2.2-root/usr/include libdir=/var/tmp/motion-3.2.2-root/usr/lib libexecdir=/var/tmp/motion-3.2.2-root/usr/libexec localstatedir=/var/tmp/motion
-3.2.2-root/var sharedstatedir=/var/tmp/motion-3.2.2-root/usr/com mandir=/var/tmp/motion-3.2.2-root/usr/share/man infodir=/var/tmp/motion-3.2.2-roo
t/usr/share/info install
...
mkdir -p /var/tmp/motion-3.2.2-root/etc
...
install motion-dist.conf /var/tmp/motion-3.2.2-root/etc
Partial output from rpm build on
SuSE 9.3:
...
+ make DESTDIR=/var/tmp/motion-3.2.2-root install
...
mkdir -p /var/tmp/motion-3.2.2-root/etc/motion
...
install motion-dist.conf /var/tmp/motion-3.2.2-root/etc/motion
--
PaulBeltrani - 21 Jul 2005
Fix record
I decided to implement the suggested fix to at least allow Suse users to make RPMs and use them.
But long term is could be nice to find out what the difference is and maybe make a better fix.
--
KennethLavrsen - 19 Jul 2005