PDA

View Full Version : .rpm help ,please



Diametric
11th July 2011, 07:56 PM
Hello,

I am attempting to compile my first .rpm - however, I am getting an erro I do not understand.

When I attempt to:


rpmbuild -ba myfile.spec

I get the following error:



RPM build errors:
Bad syntax: %attr(640)
Bad syntax: %attr(640)
Bad syntax: %attr(640)

Here is the section of my .spec file where I have this designated:

%attr(640,root,named,0755)

I have this in three different directory listings (thus the error repeated three times). I've attempted to change this to 0640 and even just a - but each time, no matter what I change it to it errors out to what the changed setting is. I'm pretty sure I do not have a spacing issue or some other typographical issue going on here...but I'm at a loss.

Does any one have any idea as to what could be happening?

Thanks in advance!

PabloTwo
11th July 2011, 08:20 PM
The "%attr" is used to set permissions and ownership on specific files if they need to differ from the defaults. Example:

%attr (444,root,root) %{_sysconfdir}/%{name}/rms.auth
Note the space between "%attr" and the first "(" character. If what you need is the "default" file attributes, that's done like so,

%files
%defattr(-,root,root,-)

yum install rpmlint
Check your spec file for errors and warnings...

rpmlint my.spec

leigh123linux
11th July 2011, 08:34 PM
The "%attr" is used to set permissions and ownership on specific files if they need to differ from the defaults. Example:

%attr (444,root,root) %{_sysconfdir}/%{name}/rms.authNote the space between "%attr" and the first "(" character. If what you need is the "default" file attributes, that's done like so,

%files
%defattr(-,root,root,-)
yum install rpmlintCheck your spec file for errors and warnings...

rpmlint my.spec


Actually it isn't any more


https://fedoraproject.org/wiki/Packaging:Guidelines#File_Permissions


IMO it would be best to set the permissions with chmod

Diametric
11th July 2011, 09:03 PM
Thanks for your reply - however, I was able to figure out what happened.

For anyone that is interested, the Fedora rpm site says the following:

" %files Basics
The %files section normally begins with a %defattr line which sets the default file permissions. The format of this is %defattr(<file permissions>, <user>, <group>, <directory permissions>), that is, one can specify the permissions to apply to files and directories in the %files section. The fourth parameter is often omitted. Usually one uses %defattr(-,root,root,-), where "-" means "use the default permissions"."

However, I found that when setting the attibutes for a directory, it only needed to be:

(<dirpermission>, <user>, <group>)

Once I had this changed, the rpm was created without errors.