pmacct package proposal

Paul Howarth paul at city-fan.org
Wed Aug 3 11:16:04 UTC 2011


On 08/03/2011 11:42 AM, Chris Wilson wrote:
>>>>>> %if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
>>>>>> Requires: mysql postgresql-libs
>>>>>> %else
>>>>>> Requires: mysql-shared postgresql-libs
>>>>>> %endif
>>
>> did you define and pass to rpmbuild one of the variables which triggers
>> the first branch of the test ? By default these variables are not
>> defined and therefore the whole branch is skipped. in koji the needed
>> variables are defined by the build environment but for local builds you
>> must define them yourself, as appropriate for your use case.
>
> Ah, I didn't know that. Is there a sensible way to detect the distro
> automatically so that users can run rpmbuild without worrying about
> unusual/non-standard command-line options and it will just work?

For the example above you could probably use something like:

%if %([ -e /etc/redhat-release ] && echo 1 || echo 0)
Requires: mysql postgresql-libs
%else
Requires: mysql-shared postgresql-libs
%endif

since /etc/redhat-release exists on Fedora/RHEL/CentOS but not on SuSE.

Normally though you would use conditionals like this for BuildRequires 
and let rpm work out the library dependencies (runtime Requires) for itself.

Paul.




More information about the epel-devel-list mailing list