fwupd/libfwupdplugin/fu-common-version.h
Richard Hughes 9a68084dbc Always check for PLAIN when doing vercmp() operations
In 1de7cc we checked the version format when checking for update, but there are
many other places that are doing verfmt-insensitive comparisons. For instance,
the predicates in <requires> all fail if the device version format is plain.
his breaks updating some NVMe drives where the `ne` requirements are not
semantic versions.

To avoid trying to catch all the bugs in different places, and in case we have
a future verfmt that should be treated another way, refactor this out in to a
common function and deprecate the old function.
2020-02-20 15:49:27 +00:00

33 lines
1.1 KiB
C

/*
* Copyright (C) 2017-2018 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <gio/gio.h>
#include <fwupd.h>
gint fu_common_vercmp (const gchar *version_a,
const gchar *version_b)
G_DEPRECATED_FOR(fu_common_vercmp_full);
gint fu_common_vercmp_full (const gchar *version_a,
const gchar *version_b,
FwupdVersionFormat fmt);
gchar *fu_common_version_from_uint64 (guint64 val,
FwupdVersionFormat kind);
gchar *fu_common_version_from_uint32 (guint32 val,
FwupdVersionFormat kind);
gchar *fu_common_version_from_uint16 (guint16 val,
FwupdVersionFormat kind);
gchar *fu_common_version_parse (const gchar *version)
G_DEPRECATED_FOR(fu_common_version_parse_from_format);
gchar *fu_common_version_parse_from_format (const gchar *version,
FwupdVersionFormat fmt);
gchar *fu_common_version_ensure_semver (const gchar *version);
FwupdVersionFormat fu_common_version_guess_format (const gchar *version);
gboolean fu_common_version_verify_format (const gchar *version,
FwupdVersionFormat fmt,
GError **error);