Re: Newbie trying to build a binary RPM

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

 



On Tue, 2005-06-07 at 02:02 -0600, Bob Proulx wrote:
> Frank W. Miller wrote:
> > Here's my current spec file:
> > 
[...]
> 
>   %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. The right
place to specify them is in the %files section:

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

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.

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}
%{__install} -v -D -s sip %{buildroot}%{_bindir}/sip
%{__install} -v -D ring.wav %{buildroot}%{_sysconfdir}/sip/ring.wav

The rpm setup takes care of defining those macros so that they point to
the full path of system commands.

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.

.TM.
-- 
      ____/  ____/   /
     /      /       /                   Marco Colombo
    ___/  ___  /   /                  Technical Manager
   /          /   /                      ESI s.r.l.
 _____/ _____/  _/                      Colombo@xxxxxx


[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