Detecting version of rpm in a spec file

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

 



I want to take advantage of the new Suggests: tag, but I want to (if at
all possible) keep the spec files so they will build under older rpm.

Some places where might be useful are packages like pan - which requires
gedit because it needs a text editor (and uses gedit by default in the
rpm), but could be configured to be used with a different one.

This works -

%define my_rpm_v %(eval "echo `rpm -q rpm |cut -d '-' -f2 |sed
s?'\.'?''?g`")
%define use_suggest %(eval "if [ %{my_rpm_v} -ge 443 ]; then echo 1;
else echo 0
; fi")

then later

%if %{use_suggest}
Suggests: foobar
%else
Requires: foobar
%endif

but I know it is wrong -

1) It assumes that rpm version will always be numbers, with only 3
fields
2) It assumes first rpm in path is what is building the spec file
3) Probably other stuff wrong with it.

What would be the best way to create a use_suggest macro so that the
spec file will build on rpm < 4.4.3 ?

_______________________________________________
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