[Fedora-packaging] recursively adding files/folders in %files

Michael Schwendt mschwendt at gmail.com
Wed May 9 16:48:26 UTC 2012


On Wed, 09 May 2012 17:04:28 +0200, JS (Jochen) wrote:

> On 09.05.2012 16:51, Kamal Ahmed wrote:
> > Is there a way to add all files recursively in the %files macro ?
> > I tried :
> >
> > %dir %{python_sitelib}/%{name}
> > but that just adds the target directory in the rpm.
> >
> > in my %install macro, i have:
> >
> > mkdir -p -m 755 %{buildroot}/%{python_sitelib}/%{name}
> > python -m compileall pcore/
> > cp -r pcore/*.pyc %{buildroot}/%{python_sitelib}/%{name}
> >
> >
> 
> You can just add
> 
> %{python_sitelib}/%{name}/
> 
> into the %files stanza. It's imporant, that the line ands with a
> backslash. This indicates, that all files and directories will be
> recursively add to the package.

It is _not_ important, and it is not a "backslash" but a "trailing slash".

Adding the trailing slash is just highly recommended since it increases
readability of the spec file. One can easily see whether it's the path to
a directory or a single file.

-- 
Fedora release 17 (Beefy Miracle) - Linux 3.3.4-4.fc17.x86_64
loadavg: 0.00 0.02 0.05


More information about the packaging mailing list