Re: Newbie trying to build a binary RPM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marco Colombo wrote:
> Bob Proulx wrote:
> >   %install
> >   rm -rf $RPM_BUILD_ROOT
> >   install -o 0 -g 0 -s -v -m 755 sip $RPM_BUILD_ROOT%{_bindir}/sip
> >   install -o 0 -g 0 -v -m 644 ring.wav $RPM_BUILD_ROOT%{_sysconfdir}/sip/ring.wav
> 
> It's useless to specify permission modes and ownership at %install time.
> This again forces the build process to be executed as root.

I agree about the owner:group setting.  That is a good catch.  Thanks
for pointing it out.  Because I do not want to suggest building as
root.  I just preserved that because it was in the original post and I
did not have a good reason to change it at that moment.  Normally I
would be compiling in the rpm and would have a Makefile available and
using the more typical 'make install DESTDIR=$RPM_BUILD_ROOT' type of
thing.

But I disagree about the permissions.

> %files
> %defattr(-,root,root)
> %attr(755,-,-) %{_bindir}/sip
> %attr(644,-,-) %{_sysconfdir}/sip/ring.wav

I would much rather see those permissions set in the buildroot and
then not have them set explicitly on each and every file listed.  For
the permissions quoted there is no problem.

There was some discussion about strange and unusual permissions.  In a
case of needing an atypical permission or ownership then in that case
I would set that explicitly with %attr().  But that is very atypical,
by definition.  If you find yourself doing that you should ask if it
is really the right thing for the package.  Generally it is not.

> It's likely that $RPM_BUILD_ROOT%{_bindir} and
> $RPM_BUILD_ROOT%{_sysconfdir}/sip do not exist yet. Remember to create
> them. Use either mkdir -p or add -D to the install command.

Yes.  Good catch.  I usually don't need to worry about that when doing
the %makeinstall usage.

> To make your script more robust to the weirdest environments, you may
> use the predefined macros to access system commands, like this:
> 
> %{__rm} -rf %{buildroot}

If 'rm' does not exist normally then I think I do not want to know or
care about that environment.  :-) I think I will stick to POSIX usage
whenever possible and not worry further about these things.  Making
things too parameterized can obscure the meaning and in my opinion can
make the scripts much harder to read.

> I've also used the %{buildroot} rpm macro instead of the $RPM_BUILD_ROOT
> environment variable, which is perfectly equivalent - it just looks
> nicer to my eyes, as matter of pure personal taste.

I use $RPM_BUILD_ROOT because it has been the most documented way to
do this.  Really I am a moderate and try to keep to the main roads.
As to whether $VAR or %{var} looks nicer, well, there is no accounting
for taste.  :-)

Bob


[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux