Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does the rpmbuild warning "File listed twice" ACTUALLY MEAN?

I need to specify common attributes for one of the major directories in the package, and special permission for some of it subdirs. e.g.

%files
%attr(-, myuser, mygroup) /opt/myapp 
%attr(750, myuser, mygroup) /opt/myapp/bin  # no exec permission to other
/etc  # this is the reason I can't use %defattr(-, myuser, mygroup)

I get the "file listed twice" warning on every file under /opt/myapp/bin, naturally. My question is, what does it actually mean? What does rpmbuild do with it? I can't find an answer anywhere. Can I just ignore it? What takes precedence, the first or the last occurrence?

I prefer not to list everything under myapp explicitly to solve this. is there any other way? Thanks

like image 676
davka Avatar asked Dec 25 '12 12:12

davka


2 Answers

I am posting here just in case someone has the same issue and finds this old question.

Recently (how recently depends on the distro) the macro %exclude has been added to rpmbuild.

%files
%attr(-, myuser, mygroup) /opt/myapp
%exclude /opt/myapp/bin
%attr(750, myuser, mygroup) /opt/myapp/bin  # no exec permission to other

The advantage here is not as evident as having a set of files or folders to exclude:

%files
%attr(-, myuser, mygroup) /opt/myapp
%exclude /opt/myapp/[bin|data|whatever]
%attr(750, myuser, mygroup) /opt/myapp/bin  # no exec permission to other
%attr(777, myuser, myothergroup) /opt/myapp/data
%attr(640, myuser, myothergroup) /opt/myapp/whatever

Strangely the [a|b] syntax works with %exclude but not with the other directives in %files (eg I can use a regex to exclude but not to include, doh)

like image 178
Bruno9779 Avatar answered Nov 12 '22 12:11

Bruno9779


Change it to this:

%files
%dir %attr(-, myuser, mygroup) /opt/myapp
%attr(750, myuser, mygroup) /opt/myapp/bin

notice the %dir for the directory. That should get rid of the files listed twice warning.

like image 9
nobodyknows Avatar answered Nov 12 '22 14:11

nobodyknows