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 01-17-2008, 11:45 AM
Doron Shoham
 
Default Create two different rpms in the same spec file

Hi,

I want to create two different rpms (one for redhat and the other for suse) in the same spec file.
I have a file that is needed be in the same path (/etc/init) for both distros,
The file's name is the same but its content is not the same for the two distros.
How can I do it?
Can %install can get "-n" as a parameter?

Thanks,
Doron Shoham

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 01-20-2008, 06:44 AM
Doron Shoham
 
Default Create two different rpms in the same spec file

Maybe I didn't explain my problem:

I'm writing a spec file that creates 2 packages. Both packages contain a file that has the same name and path:

/etc/init.d/my_file - for package #1
/etc/init.d/my_file - for package #2

During the %install phase, I need to put these 2 different files in the same location (/etc/init.d/), so when I copy the 2nd file, it overwrites the 1st file. What can I do to solve that?

Thanks,
Doron

Doron Shoham wrote:
> Hi,
>
> I want to create two different rpms (one for redhat and the other for suse) in the same spec file.
> I have a file that is needed be in the same path (/etc/init) for both distros,
> The file's name is the same but its content is not the same for the two distros.
> How can I do it?
> Can %install can get "-n" as a parameter?
>
> Thanks,
> Doron Shoham
>
> _______________________________________________
> 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 01-20-2008, 07:06 AM
Valery Reznic
 
Default Create two different rpms in the same spec file

--- Doron Shoham <dorons@voltaire.com> wrote:

> Maybe I didn't explain my problem:
>
> I'm writing a spec file that creates 2 packages.
> Both packages contain a file that has the same name
> and path:
>
> /etc/init.d/my_file - for package #1
> /etc/init.d/my_file - for package #2
I don't think it's possible.
But you can use another approcah:
Have in this package both of those files:
/etc/init.d/my_file_for_package_1
/etc/init.d/my_file_for_package_2

And make %postinstall script, which should determine
what system is in use and create
/etc/init.d/my_file as link to
/etc/init.d/my_file_for_package_1 or
/etc/init.d/my_file_for_package_2

Valery.

>
> During the %install phase, I need to put these 2
> different files in the same location (/etc/init.d/),
> so when I copy the 2nd file, it overwrites the 1st
> file. What can I do to solve that?
>
> Thanks,
> Doron
>
> Doron Shoham wrote:
> > Hi,
> >
> > I want to create two different rpms (one for
> redhat and the other for suse) in the same spec
> file.
> > I have a file that is needed be in the same path
> (/etc/init) for both distros,
> > The file's name is the same but its content is not
> the same for the two distros.
> > How can I do it?
> > Can %install can get "-n" as a parameter?
> >
> > Thanks,
> > Doron Shoham
> >
> > _______________________________________________
> > 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
>



__________________________________________________ __________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 01-20-2008, 09:10 AM
Jos Vos
 
Default Create two different rpms in the same spec file

On Thu, Jan 17, 2008 at 02:45:55PM +0200, Doron Shoham wrote:

> I want to create two different rpms (one for redhat and the other for suse) in the same spec file.
> I have a file that is needed be in the same path (/etc/init) for both distros,
> The file's name is the same but its content is not the same for the two distros.
> How can I do it?
> Can %install can get "-n" as a parameter?

Why do you think of "-n"? Will the resulting package have different
names on RH and SUSE?

Anyway, it's simple when you use the %if / %endif constructions.
Note that it's a matter of taste if you really want this. In my
personal opinion, maintaining one spec file for multiple distros
often (with more complex packages) results in unnecessary complex
spec files.

Simplified example:


%if %(test -f /etc/redhat-release && echo 1 || echo 0)
%define target redhat
%endif

%if %(test -f ... && echo 1 || echo 0)
%define target suse
%endif

...

%install

%if %[target} == %{redhat}
cp %{SOURCE1} %{buildroot}/etc/rc.d/init.d/foo.init
%endif

%if %[target} == %{suse}
cp %{SOURCE2} %{buildroot}/etc/init.d/foo.init
%endif

...

%files

%if %[target} == %{redhat}
/etc/rc.d/init.d/foo.init
%endif
%if %[target} == %{suse}
/etc/init.d/foo.init
%endif


Note that this example is not complete and/or robust, of course.

--
-- Jos Vos <jos@xos.nl>
-- X/OS Experts in Open Systems BV | Phone: +31 20 6938364
-- Amsterdam, The Netherlands | Fax: +31 20 6948204

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list
 
Old 01-20-2008, 06:04 PM
Tony Earnshaw
 
Default Create two different rpms in the same spec file

Jos Vos skrev, on 20-01-2008 11:10:


I want to create two different rpms (one for redhat and the other for suse) in the same spec file.
I have a file that is needed be in the same path (/etc/init) for both distros,
The file's name is the same but its content is not the same for the two distros.
How can I do it?
Can %install can get "-n" as a parameter?


Why do you think of "-n"? Will the resulting package have different
names on RH and SUSE?

Anyway, it's simple when you use the %if / %endif constructions.
Note that it's a matter of taste if you really want this. In my
personal opinion, maintaining one spec file for multiple distros
often (with more complex packages) results in unnecessary complex
spec files.


As far as "production quality" specs that I use go, Sam Varshavchik
(Courier) and Buchan Milne (OpenLDAP) both do it with impunity (Buchan's
distinguishes purely between Mandriva and Red Hat derivatives).


Simon J Mudd (Postfix) forces the user first to run a script to
determine the OS/distro and build the spec file.


My own spec files use a version of Sam's, which I stole from him ...

Best,

--Tonni

--
Tony Earnshaw
Email: tonni at hetnet dot nl

_______________________________________________
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 01:03 PM.

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