FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > RPM Package Manager

 
 
LinkBack Thread Tools
 
Old 12-13-2007, 02:20 PM
"Bob Beers"
 
Default preserving file attributes from make install in rpm spec file

I am new to rpm building and trying to do the right thing.

I want to build an rpm from a set of files which comes
with a Makefile install target that sets ownership
and permissions differently for different files.

When executing make install (as root) everything is ok,
but trying to build the rpm as non-root fails
with "cannot change ownership of `/var/tmp/...' : Operation not permitted"

The Makefile has (simplified version)
install:
$(INSTALL) -d $(DESTDIR)$(BINDIR)
#any group
$(INSTALL) -m 755 file01 $(DESTDIR)$(BINDIR)
$(INSTALL) -m 644 file02 $(DESTDIR)$(BINDIR)
#wheel group
$(INSTALL) -m 750 -g wheel file03 $(DESTDIR)$(BINDIR)
#aaa group
$(INSTALL) -m 750 -g aaa file04 $(DESTDIR)$(BINDIR)
#bbb group
$(INSTALL) -m 750 -g bbb file05 $(DESTDIR)$(BINDIR)

The spec file has:

%install
make DESTDIR=%buildroot/ install

Obviously I'm overlooking something. I am sure this is not that unusual.

BTW, and I know I should not do it, if I build the rpm as root,
the permissions are fine, but all files are root:root.

-Bob

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 02:24 PM
Matthew Miller
 
Default preserving file attributes from make install in rpm spec file

On Thu, Dec 13, 2007 at 10:20:45AM -0500, Bob Beers wrote:
> Obviously I'm overlooking something. I am sure this is not that unusual.
> BTW, and I know I should not do it, if I build the rpm as root,
> the permissions are fine, but all files are root:root.

The solution is to not set the permissions (for permissions out of the
ordinary) in the Makefile but to do so in the %files section of the
specfile.

--
Matthew Miller mattdm@mattdm.org <http://mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 02:35 PM
"Jeff Johnson"
 
Default preserving file attributes from make install in rpm spec file

On Dec 13, 2007 10:20 AM, Bob Beers <bob.beers@gmail.com> wrote:

I am new to rpm building and trying to do the right thing.

I want to build an rpm from a set of files which comes
*with a Makefile install target that sets ownership
*and permissions differently for different files.


When executing make install (as root) everything is ok,
*but trying to build the rpm as non-root fails
*with "cannot change ownership of `/var/tmp/...' : Operation not permitted"

The Makefile has (simplified version)

install:
* $(INSTALL) -d $(DESTDIR)$(BINDIR)
#any group
* $(INSTALL) -m 755 file01 $(DESTDIR)$(BINDIR)
* $(INSTALL) -m 644 file02 $(DESTDIR)$(BINDIR)
#wheel group
* $(INSTALL) -m 750 -g wheel file03 $(DESTDIR)$(BINDIR)

#aaa group
* $(INSTALL) -m 750 -g aaa file04 $(DESTDIR)$(BINDIR)
#bbb group
* $(INSTALL) -m 750 -g bbb file05 $(DESTDIR)$(BINDIR)

The spec file has:

%install
make DESTDIR=%buildroot/ install


Obviously I'm overlooking something. *I am sure this is not that unusual.

BTW, and I know I should not do it, if I build the rpm as root,
*the permissions are fine, but all files are root:root.
*What you miss is %attr markers in the %files manifest.

Add explicit
***%attr(mode,user,group)(substituting the actual values for "mode", "user", "group" above)
for paths listed in the %files manifest.

There is also %defattr, and there's a certain art to expressing
%attr so that itscopes correctly across glob patterns, but rpmpackaging easily separates the actual {mode,user,group} used
during build from the same tuple used during install.

hth

73 de Jeff*
_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 03:03 PM
"Bob Beers"
 
Default preserving file attributes from make install in rpm spec file

On Dec 13, 2007 10:35 AM, Jeff Johnson <n3npq.jbj@gmail.com> wrote:
>

> What you miss is %attr markers in the %files manifest.
>
> Add explicit
> %attr(mode,user,group)
> (substituting the actual values for "mode", "user", "group" above)
> for paths listed in the %files manifest.
>
> There is also %defattr, and there's a certain art to expressing
> %attr so that itscopes correctly across glob patterns, but rpm
> packaging easily separates the actual {mode,user,group} used
> during build from the same tuple used during install.
>

Thank you Jeff and Matthew for the rapid responses!

Do I understand correctlythat I can
omit the make install line in %install section
if I add appropriate %attr lines in the %file section?

Something like this?

%files
%attr(755,root,root)
/usr/local/bin/file01
%attr(644,root,root)
/usr/local/bin/file02
%attr(750,root,wheel)
/usr/local/bin/file03
%attr(750,root,aaa)
/usr/local/bin/file04
%attr(750,root,bbb)
/usr/local/bin/file05

-Bob

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 03:26 PM
"Jeff Johnson"
 
Default preserving file attributes from make install in rpm spec file

On Dec 13, 2007 11:03 AM, Bob Beers <bob.beers@gmail.com> wrote:

On Dec 13, 2007 10:35 AM, Jeff Johnson <n3npq.jbj@gmail.com> wrote:
>

> What you miss is %attr markers in the %files manifest.
>

> Add explicit
> * *%attr(mode,user,group)
> (substituting the actual values for "mode", "user", "group" above)
> for paths listed in the %files manifest.
>
> There is also %defattr, and there's a certain art to expressing

> *%attr so that itscopes correctly across glob patterns, but rpm
> packaging easily separates the actual {mode,user,group} used
> during build from the same tuple used during install.
>


Thank you Jeff and Matthew for the rapid responses!

Do I understand correctlythat I can
*omit the make install line in %install section
*if I add appropriate %attr lines in the %file section?

You can't omit "make install" (and adding the DESTDIR=%{buildroot}
is perfectly sane if that is what you are doing).Think of %{buildroot} as a staging area for package contents. However
you populate, with cp, or install or ... any other means. But you need topopulate the %{buildroot} with the contents that you want in packages.
(Note: yes I'm perfectly aware that one can package w/o BuildRoot:, but
let's not go there please.)*

Something like this?

%files
%attr(755,root,root)
/usr/local/bin/file01
%attr(644,root,root)
/usr/local/bin/file02
%attr(750,root,wheel)
/usr/local/bin/file03
%attr(750,root,aaa)
/usr/local/bin/file04

%attr(750,root,bbb)
/usr/local/bin/file05
The scoping is up to next newline, so make sure the %attr is*
on the same line as the path or pattern.73 de Jeff*
_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 03:27 PM
Matthew Miller
 
Default preserving file attributes from make install in rpm spec file

On Thu, Dec 13, 2007 at 11:03:55AM -0500, Bob Beers wrote:
> Do I understand correctlythat I can
> omit the make install line in %install section
> if I add appropriate %attr lines in the %file section?

You can't completely omit installing the files into the buildroot -- you'll
still need to get them there somehow.

--
Matthew Miller mattdm@mattdm.org <http://mattdm.org/>
Boston University Linux ------> <http://linux.bu.edu/>

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 03:40 PM
"Bob Beers"
 
Default preserving file attributes from make install in rpm spec file

On Dec 13, 2007 11:27 AM, Matthew Miller <mattdm@mattdm.org> wrote:
> On Thu, Dec 13, 2007 at 11:03:55AM -0500, Bob Beers wrote:
> > Do I understand correctlythat I can
> > omit the make install line in %install section
> > if I add appropriate %attr lines in the %file section?
>
> You can't completely omit installing the files into the buildroot -- you'll
> still need to get them there somehow.
>
>

ok, got it. I made a new target in the Make file: plaininstall, which
does not try to change ownership. I also changed .spec to
%install
make DESTDIR=/ plaininstall

> --
> Matthew Miller mattdm@mattdm.org <http://mattdm.org/>
> Boston University Linux ------> <http://linux.bu.edu/>
>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list
>

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 12-13-2007, 03:44 PM
"Bob Beers"
 
Default preserving file attributes from make install in rpm spec file

On Dec 13, 2007 11:26 AM, Jeff Johnson <n3npq.jbj@gmail.com> wrote:

> The scoping is up to next newline, so make sure the %attr is
> on the same line as the path or pattern.

Oh, ok, great!

I've got it correct now!

Thanks very much to Matthew Miller and Jeff Johnson for the rapid,
expert advice!

-Bob

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 

Thread Tools




All times are GMT. The time now is 12:22 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org