Re: Building RPMs for different distributions

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

 



james.oden@xxxxxxxxx (James Olin Oden) writes:

> None built in Joe.  Rembember this though; you can take the extrnal
> external output of a command run on the build system as the definition
> of a macro (similar to backticks but uses the %() syntax).   So you
> could do something like:
> 
>    %define distro %(getDistroCmd)
>    Name: package_name
>    Version: 1.0
>    Release: %{distro}-1
> 
> The reason this might be usefull is then your external command (which
> can be one of your sources) can express much more complicated logic to
> figure out what distro its on without being tied to the abilities of
> rpm macro's.

It's a shame that the distributions don't provide a common way to
determine what they are called and what version they have.  Writing
distribution portable RPMs is quite tricky and worse if the spec file
itself is supposed to do this automatically.

If anyone is interested in the "getDistroCmd" that I use for my Postfix
RPMS please take a look at:

http://www.wl0.org/cgi-bin/viewcvs.cgi/postfix-rpm/postfix-get-distribution?only_with_tag=POSTFIX_2_2_8_2

This supports:
# - RedHat Linux (6.x-9)                    rhXX
# - RedHat Enterprise Linux (2.x-4)         rhelX
# - Fedora Core                             fcX
# - YellowDog Linux
# - Whitebox Linux (reports as RedHat Enterprise Linux for building)
# - CentOS Linux (reports as RedHat Enterprise Linux for building)
# - TaoLinux (reports as RedHat Enterprise Linux for building)
# - Mandrake Linux                          mdkXX

Please note that most people make the release of the form

Release: 1.%{distro}

not as described above.

If people want to provide me patches to this script for other
distributions I'll accept them and then may change the script's name
just to get_distribution.

My spec file uses the script as follows (the script is included in the src.rpm):

# distribution which we are building Postfix on
%define distro_info     %(sh $(rpm --eval '%{_sourcedir}')/postfix-get-distribution --distro-info)
%define build_dist_full %(echo "%distro_info" | cut -d" " -f5)       # centos-release-4-2.1
%define build_name      %(echo "%distro_info" | cut -d" " -f1)       # rhel
%define build_major     %(echo "%distro_info" | cut -d" " -f3)       # 4
%define build_minor     %(echo "%distro_info" | cut -d" " -f4)       # 0
%define build_dist      %{build_name}-%{build_major}.%{build_minor}  # rhel4

And this shows up finally in the installed rpm as follows:

$ rpm -qi postfix
Name        : postfix                      Relocations: (not relocatable)
Version     : 2.2.8                             Vendor: Built on centos-release-4-2.1 (rhel-4.0)
Release     : 1.rhel4                       Build Date: jue 05 ene 2006 22:57:13 CET
...

Joe probably does not need to know about the distribution major and
minor version number but some rpms (Postfix included) do need this to
correctly adapt to the environment on which they are building.

Hope this info is useful.

Regards,

Simon

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

[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