automatically include files in %doc only if they are not empty
Michael Schwendt
mschwendt at gmail.com
Fri Nov 28 14:53:24 UTC 2008
On Fri, 28 Nov 2008 11:14:29 +0100, Till Maas wrote:
> I would like to avoid breaking the build in this case. I hoped there was some
> macro, e.g. named exclude_empty, that would allow to exclude files only if
> they are empty. This is what I came up with:
>
> %define exclude_empty() %(test -s %1 && echo %1)
>
> It should then be used somehow like this:
> %files
> %doc %exclude_empty TODO
>
> But it seems to always exclude the file.
That's because the -s check happens in %_sourcedir not $RPM_BUILD_DIR.
Constructing a %files list file in %install would require more than
one line, but there you are inside the build dir. I dunno whether
that's worth it. %doc files don't toggle between empty/not-empty so
often.
More information about the fedora-devel-list
mailing list