2017-07-05 14:44:31 +00:00
committed by Git OBS Bridge
parent 4f399f5a0c
commit d3453831ea
2 changed files with 32 additions and 0 deletions

View File

@@ -264,3 +264,17 @@ BuildArch: noarch \
%description %{-n:-n %{-n*}-}lang \
Provides translations for the \"%{name}\" package.
# package version comparison macros
# compare two versions, returns -1, 0, 1, ~~~
%rpm_vercmp() %{lua:print(rpm.expand('%1') == '~~~' and '~~~' or rpm.vercmp(rpm.expand('%1'), rpm.expand('%2')))}
# expand to the installed version of a package/provides
%pkg_version() %(LC_ALL=C rpm -q --whatprovides --qf "%%{version}" "%1" | sed -e "s/^no package provides .*/~~~/")
# compare the installed version to a value. returns -1, 0, 1, ~~~
%pkg_version_cmp() %{expand:%{expand:%%%%{rpm_vercmp %%{pkg_version %1} %%2}}}
# convenience/readability
%pkg_vcmp() (%{expand:%%{pkg_version_cmp %1 %3}} %2 0)