Description of problem: Not all platforms have a "root" group as number 0. On Darwin and Mac OS X, for instance, it's "wheel". Here is a macro that can be used for the %files: %ifnos darwin %define __rootattr %defattr(-,root,root) %else %define __rootattr %defattr(-,root,wheel) %endif Then you can just use a construct like this later: %files %{__rootattr} %doc README %{_bindir}/* Makes things neater, to avoid that %if everywhere ? BTW; Here is the entry from /etc/group (and friends): wheel:*:0:root And here is the matching entry from /etc/passwd: root:*:0:0:System Administrator:/var/root:/bin/sh
Some old code used __defattr, but I thought __rootattr was more obvious? Either is fine.
Sorry, checked with some more spec files and __defattr would be much a better choice here... So __defattr it is. (awaiting any feedback)
What really needs doing is to automagically add %defattr to every %files in every package so that root/wheel issues can be fixed as part of build configuration, not in every bleeping package spec file. There is no case where adding %defattr after %files is not the Right Thing To Do. Coreespondingly, there is no case that not adding %defattr is ever correct. So a deeper change, not just hiding "wheel" behind a macro, is what is really needed.
Meanwhile, each spec "ported" to Darwin uses: %files %{__defattr} With the __defattr defined locally in the spec.
There's nothing preventing configuring and using %{__defattr} to hide a default "wheel" group. Changing default packaging styles to use %{__defattr} everywhere ain't likely to happen.