[virt-tools-list] [PATCH virt-viewer 2/4] Add virt_viewer_compare_version()

Hans de Goede hdegoede at redhat.com
Fri Mar 8 13:49:09 UTC 2013


Hi,

On 03/08/2013 01:35 PM, Marc-André Lureau wrote:
>
>
> ----- Mensaje original -----
>> Hi,
>>
>> On 03/07/2013 08:55 PM, Marc-André Lureau wrote:
>>> ---
>>>    src/virt-viewer-util.c | 54
>>>    ++++++++++++++++++++++++++++++++++++++++++++++++++
>>>    src/virt-viewer-util.h |  1 +
>>>    2 files changed, 55 insertions(+)
>>>
>>> diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c
>>> index f0b1182..a32138c 100644
>>> --- a/src/virt-viewer-util.c
>>> +++ b/src/virt-viewer-util.c
>>> @@ -414,6 +414,60 @@ spice_hotkey_to_gtk_accelerator(const gchar
>>> *key)
>>>        return accel;
>>>    }
>>>
>>> +/**
>>> + * virt_viewer_compare_version:
>>> + * @s1: a version-like string
>>> + * @s2: a version-like string
>>> + *
>>> + * Compare two version-like strings: 1.1 > 1.0, 1.0.1 > 1.0, 1.0c
>>>>
>>> + * 1.0a, but 1.0rc < 1.0 for example.
>>
>> Ugh, no lets not do that please. Example if I read the above comment
>> and
>> the code correctly then 1.0a < 1.0 which will surprise some people.
>
> We are not trying to be generic. We are just trying to fit with virt-viewer visioning.

AFAIK there has never been an rc or a or such release for virt-viewer.

> Since string suffix is quite common, especially the "rc" case, the function is fine too.

string suffix is bad news, very bad news. Please read:
https://fedoraproject.org/wiki/Packaging:NamingGuidelines#Non-Numeric_Version_in_Release

Then read it again, rinse repeat until you fully understand, then
you will hopefully see that having non numeric characters in a version
is just a very very bad idea. I've packaged and maintain circa 200
pkgs, please trust me when it comes to things like this I speak from experience here,
long and painful experience.

> Now if we never use string suffix, then that shouldn't change the result of this function.

I would prefer this function to simply do a g_return_if_fail on string suffixes, so
that if we ever encounter them it will return 0 and a loud complaint will get logged.

Regards,

Hans




More information about the virt-tools-list mailing list