Re: Files listed twice question

Tim Mooney <[email protected]> Wed, 24 Sep 2008 17:28:36 -0500 (CDT)
Newsgroups gmane.linux.redhat.rpm.general
Message-ID <[email protected]>
In regard to: Re: Files listed twice question, [email protected]...:

>> I'm an absolute newbie trying to package an application with RPM for the
>> first time and would like to mark some files as config files.
>> The top directory of this aplication has several files and directories,
>> only two of which hold config files. Thus, I'm doing something like this
>> in my spec file:
>>
>> %files
>> /usr/local/myAppTopDir/
>> %config /usr/local/myAppTopDir/configDir1/*
>> %config /usr/local/myAppTopDir/configDir2/*
>>
>> Obviously, this generates several 'file listed twice' warnings. However,
>> I queried the generated rpm and didn't find anything wrong with it. All
>> config files where included and correctly marked as config files.
>>
>> So my questions are: can I safely ignore these warnings or listing files
>> twice like I have causes a problem I'm not seeing now? is there a better
>> way to do what I want?
>
> You could ignore them, but it is not recommended.  The problem is that you
> are effectively listing them twice the way you have it above.  Your first
> entry "/usr/local/myAppTopDir/" tells it to add that directory and
> everything under it.  Your next two entries and inside that first entry's
> list.

My recommendation would be to just use a couple more globs:

%files
%dir /usr/local/myAppTopDir
# this should catch most non-hidden files and dirs, except those that
# start with c or other non-alpha characters.
/usr/local/myAppTopDir/[A-Za-bd-z0-9]*

#
# If you have any other files or directories that start with c, beyond
# configDir1 and configDir2, you'll need to list them or use a glob
# that catches them but not configDir? , something like
#
# /usr/local/myAppTopDir/c[A-Za-np-z0-9]*

#
%dir /usr/local/myAppTopDir/configDir1
%config /usr/local/myAppTopDir/configDir1/*

%dir /usr/local/myAppTopDir/configDir2
%config /usr/local/myAppTopDir/configDir2/*



I also personally avoid the use of auto-generated files lists.

Tim
-- 
Tim Mooney                                  [email protected]
Enterprise Computing & Infrastructure       701-231-1076 (Voice)
Room 242-J6, IACC Building                  701-231-8541 (Fax)
North Dakota State University, Fargo, ND 58105-5164