English Finnish
Tools to Help
It's easy to find unowned directories with `+rpmls+` from rpmdevtools or `+rpm -qlv+`. Just a bit of carefulness is needed to not include core filesystem directories, such as %_bindir, %_libdir (and obvious others, e.g. from the "filesystem" pkg) which don't belong into your package.
Common Mistakes
Here are some examples of common packaging mistakes in spec %files lists to avoid
Wildcarding Files inside a Created Directory
Unversioned
%{_datadir}/foo/*
This includes everything _in_ "foo", but not "foo" itself. "rpm -qlv pkgname" will show a missing drwxr-xr-x entry for "foo". Correct would be:
%{_datadir}/foo/
to include the directory _and_ the entire tree below it.
Versioned
%{_docdir}/%{name}-%{version}/*
%{_includedir}/%{name}-%{version}/*.h
This is the same as the unversioned scenario with the addition that every time the package is upgraded to a new version the old directory will remain on the filesystem. Correct would be:
%{_docdir}/%{name}-%{version}/
%dir %{_includedir}/%{name}-%{version}
%{_includedir}/%{name}-%{version}/*.h
Forgetting to Include a Toplevel Directory
%dir %{_libdir}/foo-2/fu
%dir %{_libdir}/foo-2/bar
%{_libdir}/foo-2/fu/*.so
%{_libdir}/foo-2/bar/config*
Here it is an attempt at including the directories explicitly with the %dir macro. However, while "bar" is included, "foo-2" is not. Typically packagers run into that mistake if all installed files are stored only in subdirs of the parent "foo-2" directory. Correct would be:
%dir %{_libdir}/foo-2
%dir %{_libdir}/foo-2/fu
%dir %{_libdir}/foo-2/bar
%{_libdir}/foo-2/fu/*.so
%{_libdir}/foo-2/bar/config*
Only Including Files
%{_datadir}/%{name}/db/raw/*.db
%{_datadir}/%{name}/pixmaps/*.png