Macros
OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=397
This commit is contained in:
parent
4f399f5a0c
commit
d3453831ea
@ -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)
|
||||
|
||||
|
18
rpm.changes
18
rpm.changes
@ -11,6 +11,24 @@ Wed Jul 5 16:28:46 CEST 2017 - ngompa13@gmail.com
|
||||
timestamps
|
||||
New patch: changes-doc.diff
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Jun 15 07:08:45 UTC 2017 - alarrosa@suse.com
|
||||
|
||||
- Added a %rpm_vercmp macro which accepts two versions as parameters and
|
||||
returns -1, 0, 1 if the first version is less than, equal or
|
||||
greater than the second version respectively.
|
||||
- Added a %pkg_version macro that accepts a package or capability name
|
||||
as argument and returns the version number of the installed package. If
|
||||
no package provides the argument, it returns the string ~~~
|
||||
- Added a %pkg_vcmp macro that accepts 3 parameters. The first parameter
|
||||
is a package name or provided capability name, the second argument is an
|
||||
operator ( < <= = >= > != ) and the third parameter is a version string
|
||||
to compare the installed version of the first argument with.
|
||||
- Added a %pkg_version_cmp macro which accepts a package or capability name
|
||||
as first argument and a version number as second argument and returns
|
||||
-1, 0, 1 or ~~~ . The number values have the same meaning as in %rpm_vercmp
|
||||
and the ~~~ string is returned if the package or capability can't be found.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Jun 9 15:33:01 UTC 2017 - sriedel@suse.com
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user