[libvirt] [PATCH] version: Add ParseVersion and a Version struct

John Ferlan jferlan at redhat.com
Thu Dec 6 21:06:58 UTC 2018



On 12/6/18 4:04 PM, John Ferlan wrote:
> 
> 
> On 10/11/18 7:58 PM, W. Trevor King wrote:
>> Make it easier to convert version integers to the more human-readable
>> major.minor.release format.

Oh, and I'll need you to "OK" me adding an Signed-off-by: or you need to
provide one. See:

https://libvirt.org/hacking.html

and point 6 of general tips:

Contributors to libvirt projects must assert that they are in compliance
with the Developer Certificate of Origin 1.1. This is achieved by adding
a "Signed-off-by" line containing the contributor's name and e-mail to
every commit message. The presence of this line attests that the
contributor has read the above lined DCO and agrees with its statements.

https://developercertificate.org/

John

>> ---
>>  connect.go      |  8 ++++++++
>>  version.go      | 52 ++++++++++++++++++++++++++++++++++++++++++++++
>>  version_test.go | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>  3 files changed, 124 insertions(+)
>>  create mode 100644 version.go
>>  create mode 100644 version_test.go
>>
> 
> Well I'm far from the expert here, but since this has been "out there"
> for a while, I'll given it a go.
> 
> [...]
> 
>> diff --git a/version_test.go b/version_test.go
> 
> [...]
> 
>> +func TestParseVersion(t *testing.T) {
>> +	for _, testCase := range []struct{
>> +		input    uint32
>> +		expected *Version
>> +	}{
>> +		{
>> +			input: 3009000,
>> +			expected: &Version{Major: 3, Minor: 9},
> 
> NIT: Should the above have the "Release: 0" if nothing more than to
> prove your algorithm?  I can add it or leave it as is.
> 
> Reviewed-by: John Ferlan <jferlan at redhat.com>
> 
> John
> 
> [let me know either way on the above and I can push this]
> 
> [...]
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
> 




More information about the libvir-list mailing list