[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:45:34 CET 2020


@aabadie commented on this pull request.



> +# Padds $2 number to $1 digits
+_pad_number = $(shell printf '%0$1d' $2)
+
+# Gets mayor, minor, patch from 'mayor.minor.patch', e.g.: 4.2.1 by index
+#   $1: index
+#   $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

```suggestion
#           otherwise when using '$(sort)' make will consider '2' larger
```

-- 
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-536063724
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20201122/84b0d7d0/attachment.htm>


More information about the notifications mailing list