Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai commented on this pull request. > @@ -15,6 +15,7 @@ #include #include +#include Yup, preinstall.am sometimes needs a little kick (aka rm -f) when public headers change. -- 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/1233#discussion_r435010083___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@jessorensen commented on this pull request. > @@ -15,6 +15,7 @@ #include #include +#include Nevermind, doing a git reset --hard, cleared some local changes to preinstall.am, which fixed it. Sorry for the noise. -- 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/1233#discussion_r434706096___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@jessorensen commented on this pull request. > @@ -15,6 +15,7 @@ #include #include +#include This change breaks the build for me here: ``` libtool: compile: gcc -DHAVE_CONFIG_H -I.. -I.. -I../include/ -I../misc -DRPMCONFIGDIR=\"/usr/lib/rpm\" -DLOCALSTATEDIR=\"/var\" -I../luaext/ -D_REENTRANT -Wall -Wpointer-arith -Wmissing-prototypes -Wstrict-prototypes -fno-strict-aliasing -fstack-protector -Wempty-body -g -O2 -MT expression.lo -MD -MP -MF .deps/expression.Tpo -c expression.c -fPIC -DPIC -o .libs/expression.o expression.c:18:10: fatal error: rpm/rpmver.h: No such file or directory 18 | #include | ^~ compilation terminated. ``` Should it be "rpmio/rpmver.h" ? -- 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/1233#pullrequestreview-423736825___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
:fireworks: -- 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/1233#issuecomment-634635458___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
Merged #1233 into master. -- 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/1233#event-3377935097___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
Rebased. -- 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/1233#issuecomment-634630500___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
This looks good (only looking at the last three - parser related - patches). -- 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/1233#issuecomment-634570810___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai commented on this pull request. > You can use the standard operators to combine terms: logical operators &&, ||, !, relational operators !=, ==, <, > , <=, >=, arithmetic operators +, -, /, *, the ternary operator ? :, and parentheses. For example, "%[ 3 + 4 * (1 + %two) ]" will expand -to "15" if "%two" expands to "2". +to "15" if "%two" expands to "2". Version terms are compared using +rpm version comparison algorith, rather than regular string comparison. Well, to me rpm version comparison algorithm *is* EVR comparison, but okay clarified + typo fixed. -- 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/1233#discussion_r427320978___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai commented on this pull request. > @@ -241,15 +241,17 @@ newline is deleted). Note the 2nd % needed to escape > the arguments to Expression expansion can be performed using "%[expression]". An expression consists of terms that can be combined using -operators. Rpm supports two kinds of terms, numbers made up -from digits and strings enclosed in double quotes. Rpm will -expand macros when evaluating terms. +operators. Rpm supports three kinds of terms, numbers made up +from digits, strings enclosed in double quotes (eg "somestring") and +versions enclosed in double quotes preceded by (eg v"3:1.2-1"). Fixed, thanks. -- 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/1233#discussion_r427320275___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@pmatilai pushed 1 commit. 27d30c2a7566becc31d9048781f9f56115a424dd Support rpm version comparison in expressions -- You are receiving this because you are subscribed to this thread. View it on GitHub: https://github.com/rpm-software-management/rpm/pull/1233/files/6e97d6cd8598c57c927c0bdf9a8755a6643ec68f..27d30c2a7566becc31d9048781f9f56115a424dd ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
> So, this basically compares evrs, correct? Yes. It also has provisions for validating EVR strings, but the only validation currently done is that an EVR string cannot be empty. -- 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/1233#issuecomment-630820676___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
@hroncok commented on this pull request. > @@ -241,15 +241,17 @@ newline is deleted). Note the 2nd % needed to escape > the arguments to Expression expansion can be performed using "%[expression]". An expression consists of terms that can be combined using -operators. Rpm supports two kinds of terms, numbers made up -from digits and strings enclosed in double quotes. Rpm will -expand macros when evaluating terms. +operators. Rpm supports three kinds of terms, numbers made up +from digits, strings enclosed in double quotes (eg "somestring") and +versions enclosed in double quotes preceded by (eg v"3:1.2-1"). ```suggestion versions enclosed in double quotes preceded by v (eg v"3:1.2-1"). ``` > You can use the standard operators to combine terms: logical operators &&, ||, !, relational operators !=, ==, <, > , <=, >=, arithmetic operators +, -, /, *, the ternary operator ? :, and parentheses. For example, "%[ 3 + 4 * (1 + %two) ]" will expand -to "15" if "%two" expands to "2". +to "15" if "%two" expands to "2". Version terms are compared using +rpm version comparison algorith, rather than regular string comparison. ```suggestion rpm epoch:version-release comparison algorithm, rather than regular string comparison. ``` -- 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/1233#pullrequestreview-414441468___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
So, this basically compares evrs, correct? -- 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/1233#issuecomment-630815654___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
This is on top of #1221 as that is required for this to work, but in a separate PR to hopefully keep it more reviewable. We might want to add s"" as an alias to regular "" just for symmetry if/when this goes in, but leaving that out for now as it doesn't add anything new. -- 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/1233#issuecomment-630812107___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint
[Rpm-maint] [rpm-software-management/rpm] RFE: Support rpm version comparison in expressions (#1233)
Adds rpm version as a new expression value type, denoted by v"" (similar to Python u"", b"" etc), which are compared using rpm version comparison algorithm rather than regular string comparison. For example in specs: ``` %if v"%{python_version}" < v"3.9" ... %endif ``` ...but also command lines, arbitrary macros etc: `rpm --eval '%[v"1:1.2" < v"2.0"]'` Fixes: #1217 You can view, comment on, or merge this pull request online at: https://github.com/rpm-software-management/rpm/pull/1233 -- Commit Summary -- * Move rpmVersionCompare() to headerutil.c for better layer match * Move rpmvercmp() to librpmio * Consolidate our Lua-bindings to librpmio now that we can * Axe --nopromote and most of the related infrastructure * Add (beginnings of) a rpm version API (parsing, comparison) * Refactor rpmdsCompare() to use the new version API * Refactor python labelCompare() to use the new version API, add more tests * Fix Lua rpm.vercmp() to compare actual EVRs instead of segments (#897) * Refactor expression parser comparisons to use common logic for all types * Handle expression value reset centrally * Support rpm version comparison in expressions -- File Changes -- M Makefile.am (1) M doc/librpm/Doxyheader.h (3) M doc/manual/macros (10) M lib/Makefile.am (8) M lib/depends.c (6) M lib/headerutil.c (21) M lib/poptALL.c (5) M lib/rpmds.c (137) M lib/rpmds.h (28) M lib/rpmds_internal.h (3) M lib/rpmlib.h (10) D lib/rpmliblua.c (41) D lib/rpmliblua.h (18) M lib/rpmrc.c (6) M lib/rpmtypes.h (1) M lib/transaction.c (2) M po/POTFILES.in (2) M preinstall.am (4) M python/header-py.c (34) M python/rpmmodule.c (11) M rpmio/Makefile.am (2) M rpmio/expression.c (165) M rpmio/rpmlua.c (26) A rpmio/rpmver.c (214) A rpmio/rpmver.h (99) R rpmio/rpmvercmp.c (20) M tests/rpmmacro.at (21) M tests/rpmpython.at (25) -- Patch Links -- https://github.com/rpm-software-management/rpm/pull/1233.patch https://github.com/rpm-software-management/rpm/pull/1233.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/1233 ___ Rpm-maint mailing list Rpm-maint@lists.rpm.org http://lists.rpm.org/mailman/listinfo/rpm-maint