This section contains some additional troubleshooting tips:
%{_libdir} is tricky.
Use %{_prefix}/lib for data files, and %{_libdir} for libraries. There is a slew of non-trivial FHS issues here as well.
Building as nobody with %files -f file.list
Make sure you have a %defattr(-,root,root) in place, or user/group will not be correct.
A %defattr(-,root,root) will be
honored anywhere in a %files
list.
The Principle of Least Surprise sez' put it at the beginning of file.list.
* %{prefix} is not %{_prefix}
The macro %{prefix} is a side effect macro, silently added when Prefix: whatever is parsed, while the macro %{_prefix} is what is used in configure prefix=%{_prefix} There's also extensive and conventional use of %prefix in Gnome and other packaging.
Fix/mangle the file manifest in %install, not %files. Fixing the file manifest in %install will (eventually) permit constructs like:
%files
%{_bindir}/*
...
and eventually:
%files
/
The risk, of course, is that packages will be polluted by unknown files which cause file conflicts down the road. I believe (but other opinions and traditional wisdom differ) that %files should be made as compact as possible.