Re: Files listed twice question
Adrián Márques <[email protected]> Thu, 25 Sep 2008 12:52:03 -0300
| Newsgroups | gmane.linux.redhat.rpm.general |
|---|---|
| Message-ID | <[email protected]> |
Thanks a lot Greg and Tim for your answers. They were very helpful and are much appreciated. Adri=E1n. [email protected] escribi=F3: >> I'm an absolute newbie trying to package an application with RPM for t= he >> 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 th= is >> 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. Howeve= r, >> I queried the generated rpm and didn't find anything wrong with it. Al= l >> config files where included and correctly marked as config files. >> >> So my questions are: can I safely ignore these warnings or listing fil= es >> twice like I have causes a problem I'm not seeing now? is there a bett= er >> way to do what I want? >> =20 > > 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 fir= st > 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. > > =20 >> I have been looking through the list archives so I know many of you >> would advice me to explicitly list all files. I know this would take >> care of this particular problem, but I don't want to do that unless I >> really have to, since I find globbing significantly more practical in >> this case. >> =20 > > I agree that globbing tends to be a bit easier to handle in some cases = as > you are learning. You could list your first entry with a %doc prefix, = and > then provide more specific blobbing for the rest of that first entries > contents. > > Does that make sense? > > > Another method you can try, and based on your later comments I think yo= u've > realized the debate-ability of auto-listing, is something like what wil= l > follow. I do this to gather up file lists for when I package Informix: > > %define INSTALLDIR /opt/informix > > %install > <snip> > find $INSTALLDIR -printf "%y&attr(%m,%u,%g) %p\n" | grep -v > "$INSTALLDIR\/etc\/.*" | sed 's/^d/\%dir /' | sed 's/&/%/' | sed > 's/^[^%]//' | sed 's!%{buildroot}!!' > %{_tmppath}/%{name}-files > find $INSTALLDIR/etc -printf "%y&config &attr(%m,%u,%g) %p\n" -not -typ= e d > | grep -v "^[dl]" |grep -v "$INSTALLDIR\/etc$"| sed 's/&/%/g' | sed > 's/^f//' | sed 's!%{buildroot}!!' >> %{_tmppath}/%{name}-files > > %files -f %{_tmppath}/%{name}-files > > > Now... its a tad convoluted, but basically the first find does this: > 1: find everything in the $INSTALLDIR and print it to stdout as > "<type>&attr(<mode>,<uid>,<gid>) /path/to/file\n" > 2: Ignore all files in my $INSTALLDIR/etc directory cause I want to spe= cify > them later as config files > 3: If a line starts with d its a directory, so label it as such > 4: change the & in &attr to %, thus %attr > 5: Any line that doesnt start with a %, needs to > 6: Remove the %{buildroot} path from each line (I use the ! so I dont h= ave > to worry about escaping the slashes) > 7: write to file > > And the second one does this: > 1: find everything that is not a directory in $INSTALLDIR/etc and print= it > to stdout as: > "<type>&config &attr(<mode>,<uid>,<gid>) /path/to/file\n" > 2: If a line starts with d or l ignore it > 3: Get rid of the line that is the $INSTALLDIR/etc path > 4: change the & in &attr to %, thus %attr > 5: Any line that starts with F, remove the f > 6: Remove the %{buildroot} path from each line (I use the ! so I dont h= ave > to worry about escaping the slashes) > 7: append to the file > > > If anyone has a nicer method i'd love to see it. It took me a while to > clean it up to this point. > > -greg > > _______________________________________________ > Rpm-list mailing list > [email protected] > https://www.redhat.com/mailman/listinfo/rpm-list > =20