Macros
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=397
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user