Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-27 Thread Florian Festi
Closed #1217 via #1233. -- 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/issues/1217#event-3377935109___ Rpm-maint mailing list Rpm-mai

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-15 Thread Panu Matilainen
To further elaborate on that, if deemed necessary/useful, a macro primitive such as %{V:...} could be added for *converting to* the expression syntax. Eg assuming the proposed pythonisque syntax, %{V:1.2} would simply expand to v"1.2" which the expression parser would then understand as a native

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-15 Thread Panu Matilainen
It's not just a matter of what's nice, it's to a large degree also a question of what's technically possible and available. The quest at hand is to find the most reasonable syntax to identify strings as versions at the most fundamental level of the "rpm language" which is the expression parser,

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-15 Thread Vít Ondruch
I don't understand how the discussion come from something reasonably nice and expressive which is within current RPM functionality such as `%if %{vercmp %{python3_version} >= 3.9}` to proposing something weird such as `@1.2@ < @1.0@` -- You are receiving this because you are subscribed to this

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
> v"%{php_version}" < v"5.6" I initially failed to register the Python connection. I kinda like this as it's a far stronger hint at what it is than the other variants, and has precedent in at least one major language. -- You are receiving this because you are subscribed to this thread. Reply t

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
While `@1.2@ < @1.0@` looks quite OK, when combined with macros, it's not very readable either: ```spec %if @%{php_version}@ < @5.6@ ``` -- 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-manage

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
Yup, the way the expression parser works there are basically two possibilities: either tag the version strings or the comparison operator, somehow. I think the former is the far less weird option. @ does ensure the reader attention more than any of the quoting variants: `@1.2 < @1.0` `@1.2@ < @

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Florian Festi
Another option would be having special operators. But this is also confusion as we use the normal `<`, `>`, ... in dependencies. I also don't have a good suggestion. `%if %{php_version} ver>= "1.2.3"` looks weird, too. But may be someone has an better idea. -- You are receiving this because

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
Reopened #1217. -- 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/issues/1217#event-3335805799___ Rpm-maint mailing list Rpm-maint@lists

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
Closed #1217. -- 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/issues/1217#event-3335805261___ Rpm-maint mailing list Rpm-maint@lists.r

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
So, here are couple examples. I haven't checked if they don't collide with existing syntax. ```spec # int comparison, fallbacks to version comparison if at least one operand has nondigits? %if %{php_version} < 5.6 # string comparison, produces incorrect results some time %if "%{php_version}" <

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
Yeah... might get too weird really. Another, saner option might be using single quotes (or similar) to denote rpm version strings over regular strings. -- 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-s

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
also "01" == "1" -- 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/issues/1217#issuecomment-628493078___ Rpm-maint mailing list Rpm-main

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
Hmm. The other hmm is that rpmvercmp() can actually return 0 for strings that are very obviously different (#925), which can get decidedly weird. -- 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-softwar

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
Yeah - right now would actually be the optimal time to implement this as there are some other incompatibilities in the 4.16 expression parser as well, and the macro side of this is all new now, so there's not that much that is incompatible. There are some technical obstacles though, for exampl

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
right. ok then, comparing `""` as stings works for me \o/ Obviously, that'll be 4.16+ only, so in Fedora terms, rawhide+. -- 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/issues/

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
We can't really hijack integers because we support simple mathematical operations on them besides just comparison, and might be some other technical restrictions. In any case, string comparisons in specs typically are either == or !=, in which case treating them as versions wouldn't affect the o

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Miro Hrončok
OTOH this is backwards incompatible and a bit weird. What if `""` would still compare strings, but without `""` would compare versions? That is backwards compatible with comparing integers. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
...except that versions are not integers, they're strings, and the expression parser now explicitly separates the two. So we could make the string comparison *be* version comparison, at which point you could do this in a spec ``` %if "%{python3_version}" >= "3.9" ... %endif ``` ...and it'd do t

Re: [Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-14 Thread Panu Matilainen
This is closely related to, but perhaps not a duplicate of #897. Having an actually usable version comparison macro is one of the rare things that truly are generic enough to belong to rpm, it's actually rather hysterical how little we have in that space. This being rpm, versions are the primar

[Rpm-maint] [rpm-software-management/rpm] RFE: Convenient version comparison macro (#1217)

2020-05-13 Thread Miro Hrončok
Hello. I had a recent discussion with @Conan-Kudo about version comparison in spec conditionals. https://lists.fedoraproject.org/archives/list/python-de...@lists.fedoraproject.org/message/467NMLL3DTRZQBEX5LPFU6ZD5P56SSF3/ So I dug a bit and found the excellent `rpm.vercmp()` Lua function. Unfor