summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-utils.h
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-10-18 20:47:16 +0100
committerRichard Hughes <richard@hughsie.com>2015-10-18 20:56:46 +0100
commitc60e682baffc86c6ed85b77960fe0a17d62f67ea (patch)
tree150251bac82b7d881028d444cef9bf6a761bca5d /libappstream-glib/as-utils.h
parent16b4707618841eb884a861f2c65d8237cb83ed76 (diff)
downloadappstream-glib-c60e682baffc86c6ed85b77960fe0a17d62f67ea.tar.gz
Use a MS-style version number when parsing a hex version
If we're comparing versions that are both converted to strings it doesn't really matter how the strings are stored (e.g. AA.BB.CC.DD or AA.BB.CCDD) as the integer rules still apply **if** we don't remove the prefixed zeros. The only time we have to be careful is where the firmware metainfo uses the triplet and the .inf file uses the hex version format. By using the triplet-style by default we match what Intel and Microsoft are providing in the firmware release notes. Basically: * If you're not using the MS-style versioning scheme, just use hex numbers in both places. * If you don't care about applying the update on Microsoft Windows, just don't supply an .inf file at all. Fixes the other half of https://github.com/hughsie/fwupd/issues/34 This does break API, but we've never had the method in a released version so I think it's fine to break at this stage. Make sure you update fwupd at the same time if you're using git master. The last bit of this fix would to be somehow encode the "display version" onto the AppStream <release> object, but this needs discussion upstream first.
Diffstat (limited to 'libappstream-glib/as-utils.h')
-rw-r--r--libappstream-glib/as-utils.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/libappstream-glib/as-utils.h b/libappstream-glib/as-utils.h
index 58944e9..bfc4a38 100644
--- a/libappstream-glib/as-utils.h
+++ b/libappstream-glib/as-utils.h
@@ -108,6 +108,20 @@ typedef enum {
AS_MARKUP_CONVERT_FLAG_LAST
} AsMarkupConvertFlag;
+/**
+ * AsVersionParseFlag:
+ * @AS_VERSION_PARSE_FLAG_NONE: No flags set
+ * @AS_VERSION_PARSE_FLAG_USE_TRIPLET: Use Microsoft-style version numbers
+ *
+ * The flags used when parsing version numbers.
+ **/
+typedef enum {
+ AS_VERSION_PARSE_FLAG_NONE = 0,
+ AS_VERSION_PARSE_FLAG_USE_TRIPLET = 1 << 0,
+ /*< private >*/
+ AS_VERSION_PARSE_FLAG_LAST
+} AsVersionParseFlag;
+
gchar *as_markup_convert_simple (const gchar *markup,
GError **error);
gchar *as_markup_convert (const gchar *markup,
@@ -149,7 +163,8 @@ gint as_utils_vercmp (const gchar *version_a,
const gchar *version_b);
gboolean as_utils_guid_is_valid (const gchar *guid);
gchar *as_utils_guid_from_string (const gchar *str);
-gchar *as_utils_version_from_uint32 (guint32 val);
+gchar *as_utils_version_from_uint32 (guint32 val,
+ AsVersionParseFlag flags);
gchar *as_utils_version_parse (const gchar *version);
G_END_DECLS