[Rpm-maint] [rpm-software-management/rpm] RFC: support rpm version comparison in expression parser (#1220)

Panu Matilainen notifications at github.com
Thu May 14 10:50:09 UTC 2020


Inspired by #1217, this is a proof-of-concept patch series to add support for version comparison in the expression parser, allowing things like this to do the right thing:

```
%if `%{python_version}` < `3.9`
...
%endif
```

...and also macros, eg
```
$ ./rpm --eval '%["5.3.0" == "5.3.0+"]'
0
$ ./rpm --eval '%[`5.3.0` == `5.3.0+`]'
1
```

Backticks are used to denote versions as opposed to regular strings not because I particularly like them but just because I had to use something and single quotes get painful when testing with shell. 
As noted in the commit messages, this isn't right as it uses rpmvercmp() whereas this would need to compare entire EVR labels, but suffices for PoC purposes.
You can view, comment on, or merge this pull request online at:

  https://github.com/rpm-software-management/rpm/pull/1220

-- Commit Summary --

  * Move rpmVersionCompare() to headerutil.c for better layer match
  * Move rpmvercmp() to librpmio
  * Support rpm version comparison in expressions

-- File Changes --

    M Makefile.am (1)
    M lib/Makefile.am (2)
    M lib/headerutil.c (21)
    M lib/rpmlib.h (10)
    M preinstall.am (4)
    M rpmio/Makefile.am (2)
    M rpmio/expression.c (55)
    R rpmio/rpmvercmp.c (20)

-- Patch Links --

https://github.com/rpm-software-management/rpm/pull/1220.patch
https://github.com/rpm-software-management/rpm/pull/1220.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/1220
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20200514/bd55ef9b/attachment.html>


More information about the Rpm-maint mailing list