Re: Files listed twice question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.

> 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.

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 you've
realized the debate-ability of auto-listing, is something like what will
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 -type 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 specify
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 have
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 have
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
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux