list files in %files section of .spec
Gordon Messmer
gordon.messmer at gmail.com
Mon Dec 7 20:13:07 UTC 2015
On 12/07/2015 02:06 AM, arnaud gaboury wrote:
> In fact, I just did this and it build fine:
>
> %files
> %defattr(-, root, root, -)
> %{_libdir}/%{name}/*
> %{_localstatedir}/*
> %{_sysconfdir}/*
>
> When looking at various spec files from Fedora repo, I can't see such
> method.Most spec files contain a very long list of files. Why? Is
> there any reason not to use /* ?
As Michael said, it's good practice to guard against missing files (such
as an optional component not building and later not installing due to a
missing BuildRequires), and because you typically need specific paths
when you have sub-packages. The other thing you want to watch out for
is listing directories in the %files section that the package doesn't
really own.
For instance, look at the output of "rpm -qf /usr/bin". You'll see just
one package. However, if you listed "/*" in your %files section, then
/usr and /usr/bin would be part of your package. In the past, it also
created a situation where your package might specify different ownership
or permissions for those directories. IIRC, rpm now treats that as a
conflict, which would prevent your package from installing.
So, if your package were the only one that created "%{_libdir}/%{name}"
then you might want to list that, without the trailing wildcard, so that
the directory is correctly owned by your package and removed when the
package is removed.
More information about the users
mailing list