Bump appstream-glib minimum version to 0.7.4

Ubuntu's LTS and Fedora's newest releases have it.  All CI targets
have it.
This commit is contained in:
Mario Limonciello 2018-04-19 13:42:29 -05:00 committed by Mario Limonciello
parent 693497b961
commit ce2a8231ea
6 changed files with 9 additions and 80 deletions

View File

@ -145,7 +145,7 @@ gudev = dependency('gudev-1.0')
if gudev.version().version_compare('>= 232')
conf.set('HAVE_GUDEV_232', '1')
endif
appstream_glib = dependency('appstream-glib', version : '>= 0.6.13')
appstream_glib = dependency('appstream-glib', version : '>= 0.7.4')
gusb = dependency('gusb', version : '>= 0.2.9')
sqlite = dependency('sqlite3')
libarchive = dependency('libarchive')

View File

@ -627,18 +627,6 @@ dfu_firmware_write_file (DfuFirmware *firmware, GFile *file, GError **error)
error);
}
static gchar *
_bcd_version_from_uint16 (guint16 val)
{
#if AS_CHECK_VERSION(0,7,3)
return as_utils_version_from_uint16 (val, AS_VERSION_PARSE_FLAG_USE_BCD);
#else
guint maj = ((val >> 12) & 0x0f) * 10 + ((val >> 8) & 0x0f);
guint min = ((val >> 4) & 0x0f) * 10 + (val & 0x0f);
return g_strdup_printf ("%u.%u", maj, min);
#endif
}
/**
* dfu_firmware_to_string:
* @firmware: a #DfuFirmware
@ -658,7 +646,8 @@ dfu_firmware_to_string (DfuFirmware *firmware)
g_return_val_if_fail (DFU_IS_FIRMWARE (firmware), NULL);
release_str = _bcd_version_from_uint16 (priv->release);
release_str = as_utils_version_from_uint16 (priv->release,
AS_VERSION_PARSE_FLAG_USE_BCD);
str = g_string_new ("");
g_string_append_printf (str, "vid: 0x%04x\n", priv->vid);
g_string_append_printf (str, "pid: 0x%04x\n", priv->pid);

View File

@ -2016,18 +2016,6 @@ dfu_tool_list_target (DfuTarget *target)
}
}
static gchar *
_bcd_version_from_uint16 (guint16 val)
{
#if AS_CHECK_VERSION(0,7,3)
return as_utils_version_from_uint16 (val, AS_VERSION_PARSE_FLAG_USE_BCD);
#else
guint maj = ((val >> 12) & 0x0f) * 10 + ((val >> 8) & 0x0f);
guint min = ((val >> 4) & 0x0f) * 10 + (val & 0x0f);
return g_strdup_printf ("%u.%u", maj, min);
#endif
}
static gboolean
dfu_tool_list (DfuToolPrivate *priv, gchar **values, GError **error)
{
@ -2061,7 +2049,8 @@ dfu_tool_list (DfuToolPrivate *priv, gchar **values, GError **error)
dfu_device_set_usb_context (device, usb_context);
if (!fu_usb_device_probe (FU_USB_DEVICE (device), NULL))
continue;
version = _bcd_version_from_uint16 (g_usb_device_get_release (usb_device));
version = as_utils_version_from_uint16 (g_usb_device_get_release (usb_device),
AS_VERSION_PARSE_FLAG_USE_BCD);
g_print ("%s %04x:%04x [v%s]:\n",
/* TRANSLATORS: detected a DFU device */
_("Found"),

View File

@ -873,19 +873,6 @@ fu_engine_verify (FuEngine *self, const gchar *device_id, GError **error)
return TRUE;
}
static AsScreenshot *
_as_app_get_screenshot_default (AsApp *app)
{
#if AS_CHECK_VERSION(0,7,3)
return as_app_get_screenshot_default (app);
#else
GPtrArray *array = as_app_get_screenshots (app);
if (array->len == 0)
return NULL;
return g_ptr_array_index (array, 0);
#endif
}
static GPtrArray *
_as_store_get_apps_by_provide (AsStore *store, AsProvideKind kind, const gchar *value)
{
@ -1027,7 +1014,6 @@ fu_engine_check_version_requirement (AsApp *app,
return TRUE;
}
#if AS_CHECK_VERSION(0,7,4)
static gboolean
fu_engine_check_hardware_requirement (FuEngine *self, AsApp *app, GError **error)
{
@ -1052,7 +1038,6 @@ fu_engine_check_hardware_requirement (FuEngine *self, AsApp *app, GError **error
/* success */
return TRUE;
}
#endif
static gboolean
fu_engine_check_requirements (FuEngine *self, AsApp *app, FuDevice *device, GError **error)
@ -1065,10 +1050,8 @@ fu_engine_check_requirements (FuEngine *self, AsApp *app, FuDevice *device, GErr
error)) {
return FALSE;
}
#if AS_CHECK_VERSION(0,7,4)
if (!fu_engine_check_hardware_requirement (self, app, error))
return FALSE;
#endif
if (device != NULL) {
if (!fu_engine_check_version_requirement (app,
@ -1383,7 +1366,7 @@ fu_engine_install (FuEngine *self,
/* not in bootloader mode */
if (fu_device_has_flag (device, FWUPD_DEVICE_FLAG_NEEDS_BOOTLOADER)) {
const gchar *caption = NULL;
AsScreenshot *ss = _as_app_get_screenshot_default (app);
AsScreenshot *ss = as_app_get_screenshot_default (app);
if (ss != NULL)
caption = as_screenshot_get_caption (ss, NULL);
if (caption != NULL) {
@ -1853,22 +1836,6 @@ fu_engine_get_action_id_for_device (FuEngine *self,
return "org.freedesktop.fwupd.update-internal";
}
static AsRelease *
_as_app_get_release_by_version (AsApp *app, const gchar *version)
{
#if AS_CHECK_VERSION(0,7,3)
return as_app_get_release_by_version (app, version);
#else
GPtrArray *releases = as_app_get_releases (app);
for (guint i = 0; i < releases->len; i++) {
AsRelease *release = g_ptr_array_index (releases, i);
if (g_strcmp0 (version, as_release_get_version (release)) == 0)
return release;
}
return NULL;
#endif
}
static void
fu_engine_add_component_to_store (FuEngine *self, AsApp *app)
{
@ -1892,7 +1859,7 @@ fu_engine_add_component_to_store (FuEngine *self, AsApp *app)
AsRelease *release = g_ptr_array_index (releases, j);
AsRelease *release_old;
const gchar *version = as_release_get_version (release);
release_old = _as_app_get_release_by_version (app_old, version);
release_old = as_app_get_release_by_version (app_old, version);
if (release_old != NULL) {
g_debug ("skipping release %s that already exists for %s",
version, as_app_get_id (app_old));

View File

@ -122,11 +122,6 @@ fu_engine_require_hwid_func (void)
g_autoptr(GBytes) blob_cab = NULL;
g_autoptr(GError) error = NULL;
#if !AS_CHECK_VERSION(0,7,4)
g_test_skip ("HWID requirements only supported with appstream-glib 0.7.4");
return;
#endif
#if !defined(HAVE_GCAB_0_8) && defined(__s390x__)
/* See https://github.com/hughsie/fwupd/issues/318 for more information */
g_test_skip ("Skipping HWID test on s390x due to known problem with gcab");

View File

@ -379,18 +379,6 @@ fu_usb_device_probe (FuUsbDevice *device, GError **error)
return TRUE;
}
static gchar *
_bcd_version_from_uint16 (guint16 val)
{
#if AS_CHECK_VERSION(0,7,3)
return as_utils_version_from_uint16 (val, AS_VERSION_PARSE_FLAG_USE_BCD);
#else
guint maj = ((val >> 12) & 0x0f) * 10 + ((val >> 8) & 0x0f);
guint min = ((val >> 4) & 0x0f) * 10 + (val & 0x0f);
return g_strdup_printf ("%u.%u", maj, min);
#endif
}
/**
* fu_usb_device_set_dev:
* @device: A #FuUsbDevice
@ -439,7 +427,8 @@ fu_usb_device_set_dev (FuUsbDevice *device, GUsbDevice *usb_device)
/* set the version if the release has been set */
if (release != 0x0) {
g_autofree gchar *version = _bcd_version_from_uint16 (release);
g_autofree gchar *version = as_utils_version_from_uint16 (release,
AS_VERSION_PARSE_FLAG_USE_BCD);
fu_device_set_version (FU_DEVICE (device), version);
}