Why do I get Files Listed Twice when building my RPM?
My understanding is that if I specify the %dir directive under the %files list, RPM will not list any files under that directory. Doing this can allow you to set specific permissions for the directory in question (or user, group etc). However I still get "files listed twice warning" messages when in addition to the directory that is specified I also explicitly list the files. This sounds daft I know, but the files have different permissions to the directory which is why I need to define the directory separately using the %dir directive.
If I was not using the %dir directive then yes I would expect to see these warning messages.
Am I correct?
UPDATE:
Actually, the file listed twice seems to only appear when I combine the %dir directive with the %config directive.
So the following is fine with no warning messages:
%files
%dir %attr(0755,testuser,test) /app/product/tracking-tool/bin/
%dir %attr(0755,testuser,test) /app/product/tracking-tool/bin/scripts/
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/run.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/count.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/delete.sh
%attr(0755,vscc_prod,vscc) /app/product/tracking-tool/bin/scripts/script1.sh
But the following results in warning messages:
%config %dir %attr(0755,testuser,test) /app/product/tracking-tool/config/
%config %dir %attr(0755,testuser,test) /app/product/tracking-tool/config/properties
%config %dir %attr(0755,testuser,test) /app/product/tracking-tool/config/other
%config %attr(0644,testuser,test) /app/product/tracking-tool/config/xmlconfig.xml
%config %attr(0644,testuser,test) /app/product/tracking-tool/config/properties/logging.properties
%config %attr(0600,testuser,test) /app/product/tracking-tool/config/properties/test.txt
%config %attr(0600,testuser,test) /app/product/tracking-tool/config/other/other.txt
Warning appear as follows:
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/xmlconfig.xml
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/properties/logging.properties
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/properties/test.txt
[WARNING] warning: File listed twice: /app/product/tracking-tool/config/other/other.txt
As far as I'm aware the %config directive doesn't allow additional directives after it since it's just used to mark files as configuration files. Try something like this (I'm still not 100% sure the %config directive works for directories, the documentation doesn't say whether it does or not):
%files
%config /app/product/tracking-tool/config/xmlconfig.xml
%config /app/product/tracking-tool/config/properties/logging.properties
%config /app/product/tracking-tool/config/other/other.txt
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/properties
%dir %attr(0755,testuser,test) /app/product/tracking-tool/config/other
%attr(0644,testuser,test) /app/product/tracking-tool/config/xmlconfig.xml
%attr(0644,testuser,test) /app/product/tracking-tool/config/properties/logging.properties
%attr(0600,testuser,test) /app/product/tracking-tool/config/properties/test.txt
%attr(0600,testuser,test) /app/product/tracking-tool/config/other/other.txt