Re: Conditional comparision doesn't work

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

 



On Sat, 09 Apr 2011 19:34:48 +0200, Christoph wrote:

> > On Sat, 09 Apr 2011 19:01:20 +0200, Christoph wrote:
> > 
> > > I have a spec with
> > > 
> > >         %global panelversion 4.8.3
> > > or 
> > >         %global panelversion %(rpm -q --qf='%{VERSION}' xfce4-panel)
> > > 
> > > As expected this returns "4.8.3" and
> > > 
> > >         Requires: xfce4-panel >= %{panelversion}
> > > 
> > > works fine. However 
> > > 
> > >         %if 0%{?panelversion} >= 4.7
> > >         %patch3 -p1
> > >         %endif
> > > 
> > > does not but returns:
> > > 
> > > Error: xfce4-cellmodem-plugin.spec:54: parseExpressionBoolean returns -1
> > > 
> > > Do I miss something obvious?
> > 
> > Neither 04.8.3 nor 4.7 can be converted into an integer as expected by
> > the >= comparison. For values like that, you would need to use string
> > comparison.
> 
> What would that look like in a spec?

String comparison in general? It uses double-quotes as in shell scripts:

  %if "blubb" >= "blah"
  %echo blubb >= blah
  %endif

  %if "4.8.3" >= "4.7"
  %echo 4.8.3 >= 4.7
  %endif

You can use RPM macros in there, too, of course.

But with regard to what you try to do, it will be severely limited,
because it is not a substitute for full RPM Version Comparison. Example:
"4.8.10" is less than "4.8.3", but in RPM space, that isn't true:

$ rpmdev-vercmp 4.8.10 4.8.3
0:4.8.10-None is newer
--
packaging mailing list
packaging@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/packaging


[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux