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

Re: [rpm-list] Setting binary rpm name according to a condition



On 24 October 2006 at 17:00, Erez Zilber <erezz voltaire com> wrote:

> I want to build a src rpm file that can be built to a binary rpm. The 
> name of the binary rpm depends on a condition (actually, I want to check 
> the distribution type and set the binary rpm name accordingly). How can 
> I do that?
> 
> Example:
> 
> The src rpm:
> my_src_rpm.src.rpm
> 
> If it is built on RedHat:
> redhat_name.<arch>.rpm
> 
> If it is built on SuSE:
> suse_name.<arch>.rpm

I do something like that.  What I do is to use the same source
RPM package for work and home.  This is complicated by the fact
that at work I run both Solaris 5.8 and Red Hat Enterprise 3.0.
At home I run Mandrake 9.0 & 10.1 and Mandriva 2006 & 2007.
Here's a part of my spec file template that manages that.


%define srcname	encdec
%define binname	%{srcname}_%{_os}
%define version	12.17.1
%define release	0

%if %at_work
    %ifos linux
	%define name %{binname}
	%define distversion %(rpm -qf --qf='%{VERSION}' /etc/redhat-release)
	%define systag rhe
    %else
	%define name %{srcname}
	%define distversion %(uname -r)
	%define systag sol
    %endif
%else
    %define name %{srcname}
    %define distversion %{mdkversion}
    %define systag mdk
%endif

Name: %{name}
Version: %{version}
Release: %{release}_%{distversion}%{systag}_1home_1work
Provides: %{srcname}


%_os is defined by default with RPM.  I define %at_work in ~/.rpmmacros
I almost forgot, at home I install my RPMs as root into standard 
places, like /usr and /usr/local.  At work I install into /home/me
This is also managed via ~/.rpmmacros as are things like locations
for perl, etc.


Good luck....


--
Kevin




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