FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 11-27-2008, 10:55 AM
Till Maas
 
Default automatically include files in %doc only if they are not empty

Hiyas,

on a package I recently packaged for Fedora, there is an empty TODO file
included. Is there an easy way to mark this file in %files to be included
only if it is not empty? This would make it easier to not forget to add the
file in case it will be filed with some contents in a future release.

Regards,
Till
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-27-2008, 01:58 PM
Michael Schwendt
 
Default automatically include files in %doc only if they are not empty

On Thu, 27 Nov 2008 12:55:07 +0100, Till Maas wrote:

> Hiyas,
>
> on a package I recently packaged for Fedora, there is an empty TODO file
> included. Is there an easy way to mark this file in %files to be included
> only if it is not empty? This would make it easier to not forget to add the
> file in case it will be filed with some contents in a future release.

%prep and %check : easy enough to add a bash conditional expression
(e.g. which exits with failure if the file exists and has a size greater
than zero -- or the opposite, a zero size, for files you want to exclude).

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-28-2008, 09:14 AM
Till Maas
 
Default automatically include files in %doc only if they are not empty

On Thu November 27 2008, Michael Schwendt wrote:
> On Thu, 27 Nov 2008 12:55:07 +0100, Till Maas wrote:

> > on a package I recently packaged for Fedora, there is an empty TODO file
> > included. Is there an easy way to mark this file in %files to be included
> > only if it is not empty? This would make it easier to not forget to add
> > the file in case it will be filed with some contents in a future release.
>
> %prep and %check : easy enough to add a bash conditional expression
> (e.g. which exits with failure if the file exists and has a size greater
> than zero -- or the opposite, a zero size, for files you want to exclude).

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.

Regards,
Till
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 11-28-2008, 01:53 PM
Michael Schwendt
 
Default automatically include files in %doc only if they are not empty

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.

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 04:19 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org