[riot-notifications] [RIOT-OS/RIOT] makefiles/utils: add util to compare to software versions (#15458)

Alexandre Abadie notifications at github.com
Sun Nov 22 14:46:38 CET 2020


@aabadie commented on this pull request.



> +#   $2: version
+_version = $(word $1, $(subst ., ,$2))
+
+# Returns padded version 'mayor.minor.patch' to 3 digits
+# eg: 4.2.1 -> 004.002.001
+#   $1: version
+_padded_version = $(subst $(space),.,$(foreach var,1 2 3,$(call _pad_number,3,$(call _version,$(var),$1))))
+
+# Checks if  $1 is greater than $2
+#   $1, $2: The values to compare must be padded to the same length
+#           otherwise when using '$(sort)' make wil consider '2' larger
+#           than '19'
+#   Return 1 if $1 is greater than $2, nothing otherwise
+_is_greater = $(if $(filter $1,$(firstword $(sort $1 $2))),,1)
+
+# Checks if versions $1 is greater than version $2

```suggestion
# Checks if version $1 is greater than version $2
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15458#pullrequestreview-536063815
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201122/9b3eec28/attachment.htm>


More information about the notifications mailing list