[Fedora-packaging] Re: Macro question for rpm gurus

Gagadget gagadget at gmail.com
Mon May 4 10:34:25 UTC 2009


2009/5/4 Enrico Scholz <enrico.scholz at informatik.tu-chemnitz.de>

> Gagadget <gagadget at gmail.com> writes:
>
> > %define VERSION 9.6.0
> > %define PATCHVER 1
> > [ ... ]
> > %if %{PATCHVER}
> > Source0:
> >
> ftp://ftp.isc.org/isc/bind9/%{VERSION}-P%{PATCHVER}/bind-%{VERSION}-P%{PATCHVER}.tar.gz<ftp://ftp.isc.org/isc/bind9/%%7BVERSION%7D-P%%7BPATCHVER%7D/bind-%%7BVERSION%7D-P%%7BPATCHVER%7D.tar.gz>
> > %else
> > Source0:
> > ftp://ftp.isc.org/isc/bind9/%{VERSION}/bind-%{VERSION}.tar.gz<ftp://ftp.isc.org/isc/bind9/%%7BVERSION%7D/bind-%%7BVERSION%7D.tar.gz>
> > %endif
> >
> > It works, but I'd like to know if there is a more recursive way to avoid
> > if/else ? Using "?" macro or something like that ?
>
> %global XVER      %VERSION%{?PATCHVER:-P%PATCHVER}
> Source0:          ftp://ftp.isc.org/isc/bind9/%XVER/bind-%XVER.tar.gz
>
> and do not define 'PATCHVER 0'
>

Thank you, here is what I did :

%define VERSION 9.6.0
%define PATCHVER 1
%define DISTVER mylocaldist
%define PKGVER 1
[...]
Version:        %{VERSION}
Release:        %{?PATCHVER:P%PATCHVER.}%{DISTVER}.%{PKGVER}
[...]
Source0:
ftp://ftp.isc.org/isc/bind9/%{VERSION}%{?PATCHVER:-P%PATCHVER}/bind-%{VERSION}%{?PATCHVER:-P%PATCHVER}.tar.gz
[...]
%prep
%setup -q -n %{name}-%{VERSION}%{?PATCHVER:-P%PATCHVER}

I can't define a BINDVER or XVER because I want to have the Patchlevel in
the Release tag, and it refuse the "-". With the above, my rpm is named
bind-9.6.0-P1.mylocaldist.1

One question :

If i do
# %define PATCHVER 1

The PATCHVER is still define, I have to delete it to get it work ??? Is it
normal ?


>
> Enrico
>
> --
> Fedora-packaging mailing list
> Fedora-packaging at redhat.com
> https://www.redhat.com/mailman/listinfo/fedora-packaging
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-packaging/attachments/20090504/0a4a6495/attachment.htm>


More information about the Fedora-packaging mailing list