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?
Regards, Christoph
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.
Am Samstag, den 09.04.2011, 19:14 +0200 schrieb Michael Schwendt:
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?
Regards, Christoph
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
On Sat, Apr 09, 2011 at 19:48:47 +0200, Michael Schwendt mschwendt@gmail.com wrote:
$ rpmdev-vercmp 4.8.10 4.8.3 0:4.8.10-None is newer
Would it be possible to run something like: rpmdev-vercmp 4.8.10 4.8.3 > /dev/null;echo $? in the spec file and compare the output to 0, 11 or 12?
On Sat, 9 Apr 2011 12:52:51 -0500, Bruno wrote:
$ rpmdev-vercmp 4.8.10 4.8.3 0:4.8.10-None is newer
Would it be possible to run something like: rpmdev-vercmp 4.8.10 4.8.3 > /dev/null;echo $? in the spec file and compare the output to 0, 11 or 12?
Sounds doable.
Be prepared to deal with a little bit of extra burden, however.
When running "rpm" inside the spec file to fill macros with the EVR of installed packages, expect this to break during src.rpm rebuild outside of the buildroot (and when the rpms to be queried are not available yet). It is not uncommon for packagers to test their conditional spec files only on a system where the queried/grepped files are available.
Plus, running "rpm" inside a spec file is not guaranteed to work. Because depending on the used build-system, the RPM database found in the buildroot may be incompatible due to host/guest RPM differences - as a result of using an external RPM when populating the buildroot.
On 04/09/2011 08:52 PM, Bruno Wolff III wrote:
On Sat, Apr 09, 2011 at 19:48:47 +0200, Michael Schwendtmschwendt@gmail.com wrote:
$ rpmdev-vercmp 4.8.10 4.8.3 0:4.8.10-None is newer
Would it be possible to run something like: rpmdev-vercmp 4.8.10 4.8.3> /dev/null;echo $? in the spec file and compare the output to 0, 11 or 12?
Just FWIW, in rpm >= 4.7.0 you can use Lua for this, eg:
rpm --eval "%{lua:print(rpm.vercmp('4.8.10', '4.8.3'))}"
Of course inside a spec you don't need to execute rpm for that, you'd just use something like
%if %{lua:rpm.vercmp('4.8.10', '4.8.3')} > 0 ... %endif
Am Samstag, den 09.04.2011, 19:48 +0200 schrieb Michael Schwendt:
On Sat, 09 Apr 2011 19:34:48 +0200, Christoph wrote:
What would that look like in a spec?
String comparison in general? It uses double-quotes as in shell scripts:
Ok, for some reason I thought it was different in a spec.
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"
Good point. For "Requires:" it doesn't make much sense anyway and even the %if clause will break in Xfce 4.10, which renders the whole patch pretty useless. It only makes sense if used in long term because I don't want to revert the changes again in one year.
Thanks for your help!
Regards, Christoph
On 04/09/2011 10:01 PM, Christoph Wickert wrote:
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"
Good point. For "Requires:" it doesn't make much sense anyway and even the %if clause will break in Xfce 4.10, which renders the whole patch pretty useless. It only makes sense if used in long term because I don't want to revert the changes again in one year.
Using pkg-config in plain shell code could be a better approach if you can't make the patch work with whatever xfce4-panel version, something like:
if pkg-config --atleast-version 4.7 libxfce4panel-1.0 ; then %patch3 -p1 fi
packaging@lists.fedoraproject.org