Bug 133391 - RFE: add __defattr macro
Summary: RFE: add __defattr macro
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Paul Nasrat
QA Contact: Mike McLean
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-09-23 17:57 UTC by Anders F Björklund
Modified: 2007-11-30 22:10 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-03-18 03:12:05 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Anders F Björklund 2004-09-23 17:57:20 UTC
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

Comment 1 Anders F Björklund 2004-09-23 19:03:16 UTC
Some old code used __defattr, but I thought
__rootattr was more obvious? Either is fine.

Comment 2 Anders F Björklund 2004-09-23 19:19:04 UTC
Sorry, checked with some more spec files and
__defattr would be much a better choice here...

So __defattr it is. (awaiting any feedback)

Comment 3 Jeff Johnson 2004-09-23 23:49:12 UTC
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.


Comment 4 Anders F Björklund 2004-09-24 07:07:45 UTC
Meanwhile, each spec "ported" to Darwin uses:

%files
%{__defattr}

With the __defattr defined locally in the spec.

Comment 5 Jeff Johnson 2006-03-18 03:12:05 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.