Page 1 of 1

[SOLVED] - rpmbuild: warning: File listed twice

Posted: 2019/03/13 23:33:13
by warron.french
While executing an rpmbuild command against a custom SPEC file I seem to be running into a warning and am not sure what I should do about it precisely.

I see warnings in the format of:

Code: Select all

warning: File listed twice: /the/path/to/file/i_know
There are several hundred lines precisely like this. Did I miss something like I am not supposed to specify paths to include filenames or something like that?

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/14 00:02:06
by TrevorH
It's telling you that you listed that file twice in two different places in the spec file. Maybe it's being selected by a wildcard as well?

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/14 01:19:14
by warron.french
Interesting, because I listed every single file explicitly in the %files section by doing something like:

Code: Select all

find /opt/atmvs >> ~/rpmbuild/SPECS/atmvs.spec
Then I used vi to move the files up into the appropriate line space under %files specifically.

Thanks for replying so quickly TrevorH.

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/14 06:47:52
by remirepo
Such list will include directories (and their content), and files

A simple
%files
/opt/atmvs

Will do the same, without duplicate.

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/14 23:51:12
by warron.french
Hello remirepo, thanks for the feedback.

To be clear, all that I have to do is simply put:

Code: Select all

%files
/opt/atmvs

That's it?

Thank you.

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/14 23:52:44
by warron.french
TrevorH wrote:
2019/03/14 00:02:06
It's telling you that you listed that file twice in two different places in the spec file. Maybe it's being selected by a wildcard as well?
By the way TrevorH, would a good test for proof be to simply egrep -c the line that is supposedly listed twice in the SPEC file?

That would be a valid check, correct?

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/15 00:58:23
by TrevorH
Remi already provided the best solution and the answer to why it does what it does now. Your find is printing both the filename and the directory in which they reside - the directory one already includes everything inside it.

Re: rpmbuild: warning: File listed twice

Posted: 2019/03/16 04:48:58
by warron.french
Thank you both, TrevorH and Remi,
I took your input, applied it, and successfully stopped seeing the "warning: File listed twice" output for every line listed in my %files section of my SPEC file.

All I had to do was consolidate every since file listed under /opt/atmvs and also under /usr/local/bin, and simply put both directories each on a line of their own.

The new %files section looks like this:

Code: Select all

%files
/usr/local/bin
/opt/atmvs
So in essence the warning output is actually mistaken; twice implies 2, and every line for every file of my original SPEC file was saying for fileA, as an example:

warning: File listed twice: /opt/atmvs/fileA

and to make matters worse, the output listed such a line 4x, 5x, or even 6x.

Very confusing, definitely misleading, but thank you for helping me correct this problem to erradicate the warnings.